diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9f4d8f8d..584cae79 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -95,6 +95,6 @@ jobs: --cov-report=term --durations=20 - name: Upload coverage report - uses: codecov/codecov-action@v4.3.1 + uses: codecov/codecov-action@v4.5.0 env: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index fb5ca3a3..b18934a8 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -21,7 +21,7 @@ exclude: | .github/ISSUE_TEMPLATE/bug_report.md| .github/ISSUE_TEMPLATE/feature_request.md| .github/config.yml| - CONTRIBUTING.md| + docs/contributing.md| templates/CHANGELOG.md.j2| README.md| paper/paper.bib| diff --git a/CHANGELOG.md b/CHANGELOG.md index cba5fb10..43c7a8f0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,24 @@ Automatically updated by [python-semantic-release](https://python-semantic-release.readthedocs.io/en/latest/) with commit parsing of [angular commits](https://github.com/angular/angular.js/blob/master/DEVELOPERS.md#commits). +## Unreleased +### 📦️ Build +### 🧰 Chores / Maintenance +* update binder env wih polartoolkit v0.4.0 ([`47ff400`](https://github.com/mdtanker/polartoolkit/commit/47ff400f81c3c33f4ab626e94c5f526b8a22f832)) +### 📖 Documentation +* remove install info from readme ([`09ef175`](https://github.com/mdtanker/polartoolkit/commit/09ef175c3a9096ec014e3ee86880eb397fcd0f42)) +* typos in notebook ([`d539795`](https://github.com/mdtanker/polartoolkit/commit/d539795396d9c8675e71c797492a17f3cd44e09b)) +* fix missing instruction in contrib guide ([`8128a8f`](https://github.com/mdtanker/polartoolkit/commit/8128a8f0389f673dc91916f659b0e32417f7a3ea)) +* move contrib guide into docs/ ([`3001032`](https://github.com/mdtanker/polartoolkit/commit/30010329bed35bd608b1f40f1c23bd403d639ad2)) +* update license to 2024 for source files ([`127b173`](https://github.com/mdtanker/polartoolkit/commit/127b173745181ad5fc25686c3d873a4124147862)) +* add citation info ([`d1281da`](https://github.com/mdtanker/polartoolkit/commit/d1281dab3b7c698ee7653be36fd8eaa560c2a861)) +* update docs with numbered tutorials and other fixes ([`fdb7227`](https://github.com/mdtanker/polartoolkit/commit/fdb72271ac9b7cd7f5a59779a0ab6aa619992221)) +* point binder link to tutorials ([`3fddb27`](https://github.com/mdtanker/polartoolkit/commit/3fddb27c5a1c28bf2d8b7807f1cf1913e8393b0f)) +### 🎨 Refactor +* mock import geopandas ([`ab3437d`](https://github.com/mdtanker/polartoolkit/commit/ab3437d17d856fe78e02f34596764e2937463004)) +* use figshare sample shapefiles and remove data/ from repo ([`de684bb`](https://github.com/mdtanker/polartoolkit/commit/de684bb53dd0a09de969160ebf6c32e0f44628e2)) +* remove quotes from scalebar ([`7995f9f`](https://github.com/mdtanker/polartoolkit/commit/7995f9fde71428e8e3f6cc58a917e26642a8ec8f)) + ## v0.4.0 (2024-06-14) ### 💥 Breaking Changes diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md deleted file mode 100644 index a582ce1c..00000000 --- a/CONTRIBUTING.md +++ /dev/null @@ -1,325 +0,0 @@ -# How to contribute -🎉 Thanks for considering contributing to this package! 🎉 - -Adapted from the great contribution guidelines of the [Fatiando a Terra](https://www.fatiando.org/) packages. - -> This document contains some general guidelines to help with contributing to this code. Contributing to a package can be a daunting task, if you want help please reach out on the [GitHub discussions page](https://github.com/mdtanker/polartoolkit/discussions)! - -Any kind of help would be much appreciated. Here are a few ways to contribute: -* 🐛 Submitting bug reports and feature requests -* 📝 Writing tutorials or examples -* 🔍 Fixing typos and improving to the documentation -* 💡 Writing code for everyone to use - -A few easy options: -* Add a new pre-defined region - * this could simple involve adding 1 line of code! -* Add a new dataset to the `fetch` module - * most of the code is reused for each function in `fetch`, just find an existing function which has the same input datatype (filetype, whether it needs unzipping, preprocessing, or both), and reused the code. - -If you get stuck at any point you can create an issue on GitHub (look for the Issues tab in the repository). - -For more information on contributing to open source projects, -[GitHub's own guide](https://guides.github.com/activities/contributing-to-open-source/) -is a great starting point if you are new to version control. -Also, checkout the -[Zen of Scientific Software Maintenance](https://jrleeman.github.io/ScientificSoftwareMaintenance/) -for some guiding principles on how to create high quality scientific software -contributions. - -## Contents - -* [What Can I Do?](#what-can-i-do) -* [Reporting a Bug](#reporting-a-bug) -* [Editing the Documentation](#editing-the-documentation) -* [Contributing Code](#contributing-code) - - [Setting up your environment](#setting-up-your-environment) - - [Code style and linting](#code-style-and-linting) - - [Testing your code](#testing-your-code) - - [Documentation](#documentation) - - [Code Review](#code-review) -* [Publish a new release](#publish-a-new-release) -* [Update the Dependencies](#update-the-dependencies) -* [Create a conda environment file](#create-a-conda-environment-file) -* [Set up Binder](#set-up-the-binder-configuration) -* [Release Checklist](#release-checklist) - -## What Can I Do? - -* Tackle any issue that you wish! Some issues are labeled as **"good first issues"** to - indicate that they are beginner friendly, meaning that they don't require extensive - knowledge of the project. -* Make a tutorial or example of how to do something. -* Provide feedback about how we can improve the project or about your particular use - case. -* Contribute code you already have. It doesn't need to be perfect! We will help you - clean things up, test it, etc. - -## Reporting a Bug - -Find the *Issues* tab on the top of the GitHub repository and click *New Issue*. -You'll be prompted to choose between different types of issue, like bug reports and -feature requests. -Choose the one that best matches your need. -The Issue will be populated with one of our templates. -**Please try to fillout the template with as much detail as you can**. -Remember: the more information we have, the easier it will be for us to solve your -problem. - -## Editing the Documentation - -If you're browsing the documentation and notice a typo or something that could be -improved, please consider letting us know by [creating an issue](#reporting-a-bug) or -submitting a fix (even better 🌟). You can submit fixes to the documentation pages completely online without having to -download and install anything: - -* On each documentation page, there should be a " ✏️ Suggest edit" link at the very - top (click on the GitHub logo). -* Click on that link to open the respective source file on GitHub for editing online (you'll need a GitHub account). -* Make your desired changes. -* When you're done, scroll to the bottom of the page. -* Fill out the two fields under "Commit changes": the first is a short title describing - your fixes; the second is a more detailed description of the changes. Try to be as - detailed as possible and describe *why* you changed something. -* Click on the "Commit changes" button to open a pull request (see below). -* We'll review your changes and then merge them in if everything is OK. -* Done 🎉🍺 - -Alternatively, you can make the changes offline to the files in the `doc` folder or the -example scripts. See [Contributing Code](#contributing-code) for instructions. - -## Contributing Code - -**Is this your first contribution?** -Please take a look at these resources to learn about git and pull requests (don't -hesitate to ask questions in the [GitHub discussions page](https://github.com/mdtanker/polartoolkit/discussions)): - -* [How to Contribute to Open Source](https://opensource.guide/how-to-contribute/). -* Aaron Meurer's [tutorial on the git workflow](http://www.asmeurer.com/git-workflow/) -* [How to Contribute to an Open Source Project on GitHub](https://egghead.io/courses/how-to-contribute-to-an-open-source-project-on-github) - -If you're new to working with git, GitHub, and the Unix Shell, we recommend -starting with the [Software Carpentry](https://software-carpentry.org/) lessons, -which are available in English and Spanish: - -* :gb: [Version Control with Git](http://swcarpentry.github.io/git-novice/) / :es: [Control de -versiones con Git](https://swcarpentry.github.io/git-novice-es/) -* :gb: [The Unix Shell](http://swcarpentry.github.io/shell-novice/) / :es: -[La Terminal de Unix](https://swcarpentry.github.io/shell-novice-es/) - - -### Setting up your environment - -To get the latest version clone the github repo: - -``` -git clone https://github.com/mdtanker/polartoolkit.git -``` -Change into the directory: - -``` -cd polartoolkit -``` - -Run the following command to make a new environment and install the package dependencies: - -``` - make create -``` -Activate the environment: -``` - conda activate polartoolkit -``` -Install your local version: -``` - make install -``` -This environment now contains your local, editable version of PolarToolkit, meaning if you alter code in the package, it will automatically include those changes in your environment (you may need to restart your kernel if using Jupyter). If you need to update the dependencies, see the [update the dependencies](#update-the-dependencies) section below. - -> **Note:** You'll need to activate the environment every time you start a new terminal. - -### Code style and linting - -We use [Ruff](https://docs.astral.sh/ruff/) to format the code so we don't have to -think about it. This allows you to not think about proper indentation, line length, or aligning your code while to development. Before committing, or periodically while you code, run the following to automatically format your code: -``` - make format -``` -Some formatting changes can't be applied automatically. Running the following to see these. -``` - make check -``` -Go through the output of this and try to change the code based on the errors. Search the error codes on the [Ruff documentation](https://docs.astral.sh/ruff/), which should give suggestions. Re-run the check to see if you've fixed it. Somethings can't be resolved (unsplittable urls longer than the line length). For these, add `# noqa: []` at the end of the line and the check will ignore it. Inside the square brackets add the specific error code you want to ignore. - -We also use [Pylint](https://pylint.readthedocs.io/en/latest/), which performs static-linting on the code. This checks the code and catches many common bugs and errors, without running any of the code. This check is slightly slower the the `Ruff` check. Run it with the following: -``` -make pylint -``` -Similar to using `Ruff`, go through the output of this, search the error codes on the [Pylint documentation](https://pylint.readthedocs.io/en/latest/) for help, and try and fix all the errors and warnings. If there are false-positives, or your confident you don't agree with the warning, add ` # pylint: disable=` at the end of the lines, with the warning code following the `=`. - -To run all three of the code checks, use: -``` -make style -``` - -#### Docstrings - -**All docstrings** should follow the -[numpy style guide](https://numpydoc.readthedocs.io/en/latest/format.html#docstring-standard). -All functions/classes/methods should have docstrings with a full description of all -arguments and return values. - -While the maximum line length for code is automatically set by *Ruff*, docstrings -must be formatted manually. To play nicely with Jupyter and IPython, **keep docstrings -limited to 88 characters** per line. We don't have a good way of enforcing this -automatically yet, so please do your best. - -#### Type hints - -We have also opted to use type hints throughout the codebase. This means each function/class/method should be fulled typed, including the docstrings. We use [mypy](https://mypy.readthedocs.io/en/stable/) as a type checker. -``` -make mypy -``` -Try and address all the errors and warnings. If there are complex types, just use `typing.Any`, or if necessary, ignore the line causing the issue by adding `# type: ignore[]` with the error code inside the square brackets. - -### Testing your code - -Automated testing helps ensure that our code is as free of bugs as it can be. -It also lets us know immediately if a change we make breaks any other part of the code. - -All of our test code and data are stored in the `tests` subpackage. -We use the [pytest](https://pytest.org/) framework to run the test suite, and our continuous integration systems with GitHub Actions use CodeCov to display how much of our code is covered by the tests. - -Please write tests for your code so that we can be sure that it won't break any of the -existing functionality. -Tests also help us be confident that we won't break your code in the future. - -If you're **new to testing**, see existing test files for examples of things to do. -**Don't let the tests keep you from submitting your contribution!** -If you're not sure how to do this or are having trouble, submit your pull request -anyway. -We will help you create the tests and sort out any kind of problem during code review. - -Run the tests and calculate test coverage using: - - make test - -To run a specific test by name: - - pytest --cov=. -k "test_name" - -The coverage report will let you know which lines of code are touched by the tests. -**Strive to get 100% coverage for the lines you changed.** -It's OK if you can't or don't know how to test something. -Leave a comment in the PR and we'll help you out. - -### Documentation - -The Docs are build with `Sphinx` and `Read the Docs`. Due to the above mentioned issues with the included C programs, `Read the Docs (RTD)` can't run the scripts which are part of the docs (i.e. the gallery examples). Because of this the notebooks don't execute on a build, as specified by `execute_notebooks: 'off'` in `_config.yml`. Here is how to run/update the docs on your local machine. - -> **Note:** The docs are automatically built on PR's by `RTD`, but it's good practice to build them manually before a PR, to check them for errors. - -#### Run all .ipynb's to update them - - make run_doc_files - -If your edits haven't changed any part of the core package, then there is no need to re-run the notebooks. If you changed a notebook, just clear it's contents and re-run that one notebook. - -#### Check the build manually (optional) - -You can build the docs using, but this will require pandoc to be install on your machine: - -```bash -nox -s docs -``` - -You can see a preview with: - -```bash -nox -s docs -- --serve -``` - -#### Automatically build the docs - -Add, commit, and push all changes to GitHub in a Pull Request, and `RTD` should automatically build the docs. - -In each PR, you will see section of the checks for `RTD`. Click on this to preview the docs for the PR. - -`RTD` uses the conda environment specified in `env/RTD_env.yml` when it's building. - -### Code Review - -After you've submitted a pull request, you should expect to hear at least a comment -within a couple of days. -We may suggest some changes or improvements or alternatives. - -Some things that will increase the chance that your pull request is accepted quickly: - -* Write a good and detailed description of what the PR does. -* Write tests for the code you wrote/modified. -* Readable code is better than clever code (even with comments). -* Write documentation for your code (docstrings) and leave comments explaining the - *reason* behind non-obvious things. -* Include an example of new features in the gallery or tutorials. -* Follow the [numpy guide](https://github.com/numpy/numpy/blob/master/doc/HOWTO_DOCUMENT.rst.txt) - for documentation. -* Run the automatic code formatter and style checks. - -If you're PR involves changing the package dependencies, see the below instructions for [updating the dependencies](#update-the-dependencies). - -Pull requests will automatically have tests run by GitHub Actions. -This includes running both the unit tests as well as code linters. -GitHub will show the status of these checks on the pull request. -Try to get them all passing (green). -If you have any trouble, leave a comment in the PR or -[post on the GH discussions page](https://github.com/mdtanker/polartoolkit/discussions). - -## Publish a new release - -This will almost always be done by the developers, but as a guide for them, here are instructions on how to release a new version of the package. - -Follow all the above instructions for formatting. Push your changes to a new or existing Pull Request. Once the automated GitHub Actions run (and pass), merge the PR into the main branch. - -### PyPI (pip) -PyPI release are made automatically via GitHub actions whenever a pull request is merged. - -### Conda-Forge -Once the new version is on PyPI, within a few hours a bot will automatically open a new PR in the [PolarToolkit conda-forge feedstock](https://github.com/conda-forge/polartoolkit-feedstock). Go through the checklist on the PR. Most of the time the only actions needs are updated any changes made to the dependencies since the last release. Merge the PR and the new version will be available on conda-forge shortly. - -Once the new version is on conda, update the binder .yml file, as below. - -## Update the dependencies - -To add or update a dependencies, add it to `pyproject.toml` either under `dependencies` or `optional-dependencies`. This will be included in the next build uploaded to PyPI. - -If you add a dependency necessary for using the package, make sure to add it to the Binder config file and update the `environment.yml` file in the repository. See below. - -## Create a conda environment file - -As a backup options for users experiencing install issues, we include a `environment.yml` file in the repo, which users can download and install from. To update this, run the following commands: - -``` -make remove -make conda_install -``` - -## Set up the binder configuration - -To run this package online, Read the Docs will automatically create a Binder instance based on the configuration file `environment.yml` in a separate repository [`Polartoolkit-Binder`](https://github.com/mdtanker/polartoolkit-binder). This file should reflect the latest release on Conda-Forge. To allow all optional features in Binder, we need to manually add optional dependencies to the `environment.yml` file. Also, to use the latest version of PolarToolkit within Binder, makes sure to update its version in the file after each release. - -Once updated, rebuild the Binder environment, look at which package versions Binder used for each specified dependency, and update the environment file with these versions. - -Now, when submitting a PR, RTD will automatically build the docs and update the Binder environment. - -## Release Checklist -* re-run any relevant notebooks -* check docs are building correctly using the GitHub actions link within the PR -* merge the PR -* wait for `PyPI` to publish the new version [here](https://pypi.python.org/pypi/polartoolkit) -* wait for a PR to be opened in the [feedstock](https://github.com/conda-forge/polartoolkit-feedstock) -* update any changed dependencies in the feedstock PR and merge -* wait for `conda` to publish the new version [here](https://anaconda.org/conda-forge/polartoolkit) -* update backup `env/environment.yml` -* update polartoolkit version in `environment.yml` in [PolarToolkit-Binder repo](https://github.com/mdtanker/polartoolkit-binder/blob/main/environment.yml) -* test `PyPI` version with `make install_test` and `make test` -* test `conda` version with `make conda_install` and `make test` diff --git a/README.md b/README.md index 7f414705..850e8f4d 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ The software does this by providing:

- + Binder link

@@ -90,49 +90,8 @@ Feel free to use, share, modify, and [contribute](https://polartoolkit.readthedo - -### Pip - -Instead, you can use pip to install `polartoolkit, but first, you need to install a few dependencies with conda. -This is because `PyGMT` `GeoPandas`, and `Cartopy` all rely on C packages, which can only be successfully installed with conda/mamba and not with pip. - -To create a new virtual environment: - -``` -mamba create --name polartoolkit --yes --force pygmt geopandas cartopy --channel conda-forge -``` - -And activate the environment, followed by using `pip` to install `polartoolkit`: - -``` -mamba activate polartoolkit -pip install polartoolkit -``` - -To install the optional dependencies of `polartoolkit`, use this instead: - -``` -`pip install polartoolkit[all]` -``` - -### Development version - -You can use pip, with the above-created environment, to install the latest source from GitHub: - -``` -pip install git+https://github.com/mdtanker/polartoolkit.git -``` - -Or you can clone the repository and install: - -``` -git clone https://github.com/mdtanker/polartoolkit.git -cd polartoolkit -pip install . -``` - ## How to contribute -I welcome all forms of contribution! If you have any questions, comments or suggestions, please open a [discussion](https://github.com/mdtanker/polartoolkit/discussions/new/choose) or [issue (feature request)](https://github.com/mdtanker/polartoolkit/issues/new/choose) on the [GitHub page](https://github.com/mdtanker/polartoolkit/)! +I welcome all forms of contribution! If you have any questions, comments or suggestions, please open a [discussion](https://github.com/mdtanker/polartoolkit/discussions/new/choose) or [issue (feature request)](https://github.com/mdtanker/polartoolkit/issues/new/choose)! Also, please feel free to share how you're using PolarToolkit, I'd love to know. diff --git a/data/Disco_deep_transect.zip b/data/Disco_deep_transect.zip deleted file mode 100644 index b8714882..00000000 Binary files a/data/Disco_deep_transect.zip and /dev/null differ diff --git a/data/Roosevelt_Island.zip b/data/Roosevelt_Island.zip deleted file mode 100644 index f7958f39..00000000 Binary files a/data/Roosevelt_Island.zip and /dev/null differ diff --git a/docs/citing.md b/docs/citing.md index 87c4dd78..3c9e8544 100644 --- a/docs/citing.md +++ b/docs/citing.md @@ -1,5 +1,14 @@ # Citing PolarToolkit +This is research software made by scientists. Citations help us justify the effort that goes into building and maintaining this project. + +If you used `PolarToolkit` in your research, please consider citing our paper: + ```{warning} -Citation info still to come ... +Journal of Open Source Software (JOSS) paper still in review ... ``` + +This is an open-access publication. +The paper and the associated software review can be freely accessed at: https://joss.theoj.org/papers/b3964f290fcd03c7706ef1973bcdf702 + +If you would like to cite the specific version you used, which can improve reproducibility and let users know the state of the software at the time of your analysis, please use the version-specific citation and DOI (available from [Zenodo](https://zenodo.org/doi/10.5281/zenodo.7059091)). \ No newline at end of file diff --git a/docs/conf.py b/docs/conf.py index 4649b907..8b6c54d1 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,3 +1,10 @@ +# Copyright (c) 2024 The Polartoolkit Developers. +# Distributed under the terms of the MIT License. +# SPDX-License-Identifier: MIT +# +# This code is part of the package: +# PolarToolkit (https://github.com/mdtanker/polartoolkit) +# # Copyright (c) 2022 The Polartoolkit Developers. # Distributed under the terms of the MIT License. # SPDX-License-Identifier: MIT diff --git a/docs/contributing.md b/docs/contributing.md index 66c1f98d..ccde62b3 100644 --- a/docs/contributing.md +++ b/docs/contributing.md @@ -1,3 +1,326 @@ -```{include} ../CONTRIBUTING.md +# How to contribute +🎉 Thanks for considering contributing to this package! 🎉 + +Adapted from the great contribution guidelines of the [Fatiando a Terra](https://www.fatiando.org/) packages. + +> This document contains some general guidelines to help with contributing to this code. Contributing to a package can be a daunting task, if you want help please reach out on the [GitHub discussions page](https://github.com/mdtanker/polartoolkit/discussions)! + +Any kind of help would be much appreciated. Here are a few ways to contribute: +* 🐛 Submitting bug reports and feature requests +* 📝 Writing tutorials or examples +* 🔍 Fixing typos and improving to the documentation +* 💡 Writing code for everyone to use + +A few easy options: +* Add a new pre-defined region + * this could simple involve adding 1 line of code! +* Add a new dataset to the `fetch` module + * most of the code is reused for each function in `fetch`, just find an existing function which has the same input datatype (filetype, whether it needs unzipping, preprocessing, or both), and reused the code. + +If you get stuck at any point you can create an issue on GitHub (look for the Issues tab in the repository). + +For more information on contributing to open source projects, +[GitHub's own guide](https://guides.github.com/activities/contributing-to-open-source/) +is a great starting point if you are new to version control. +Also, checkout the +[Zen of Scientific Software Maintenance](https://jrleeman.github.io/ScientificSoftwareMaintenance/) +for some guiding principles on how to create high quality scientific software +contributions. + +## Contents + +* [What Can I Do?](#what-can-i-do) +* [Reporting a Bug](#reporting-a-bug) +* [Editing the Documentation](#editing-the-documentation) +* [Contributing Code](#contributing-code) + - [Setting up your environment](#setting-up-your-environment) + - [Code style and linting](#code-style-and-linting) + - [Testing your code](#testing-your-code) + - [Documentation](#documentation) + - [Code Review](#code-review) +* [Publish a new release](#publish-a-new-release) +* [Update the Dependencies](#update-the-dependencies) +* [Create a conda environment file](#create-a-conda-environment-file) +* [Set up Binder](#set-up-the-binder-configuration) +* [Release Checklist](#release-checklist) + +## What Can I Do? + +* Tackle any issue that you wish! Some issues are labeled as **"good first issues"** to + indicate that they are beginner friendly, meaning that they don't require extensive + knowledge of the project. +* Make a tutorial or example of how to do something. +* Provide feedback about how we can improve the project or about your particular use + case. +* Contribute code you already have. It doesn't need to be perfect! We will help you + clean things up, test it, etc. + +## Reporting a Bug + +Find the *Issues* tab on the top of the GitHub repository and click *New Issue*. +You'll be prompted to choose between different types of issue, like bug reports and +feature requests. +Choose the one that best matches your need. +The Issue will be populated with one of our templates. +**Please try to fillout the template with as much detail as you can**. +Remember: the more information we have, the easier it will be for us to solve your +problem. + +## Editing the Documentation + +If you're browsing the documentation and notice a typo or something that could be +improved, please consider letting us know by [creating an issue](#reporting-a-bug) or +submitting a fix (even better 🌟). You can submit fixes to the documentation pages completely online without having to +download and install anything: + +* On each documentation page, there should be a " ✏️ Suggest edit" link at the very + top (click on the GitHub logo). +* Click on that link to open the respective source file on GitHub for editing online (you'll need a GitHub account). +* Make your desired changes. +* When you're done, scroll to the bottom of the page. +* Fill out the two fields under "Commit changes": the first is a short title describing + your fixes; the second is a more detailed description of the changes. Try to be as + detailed as possible and describe *why* you changed something. +* Click on the "Commit changes" button to open a pull request (see below). +* We'll review your changes and then merge them in if everything is OK. +* Done 🎉🍺 + +Alternatively, you can make the changes offline to the files in the `doc` folder or the +example scripts. See [Contributing Code](#contributing-code) for instructions. + +## Contributing Code + +**Is this your first contribution?** +Please take a look at these resources to learn about git and pull requests (don't +hesitate to ask questions in the [GitHub discussions page](https://github.com/mdtanker/polartoolkit/discussions)): + +* [How to Contribute to Open Source](https://opensource.guide/how-to-contribute/). +* Aaron Meurer's [tutorial on the git workflow](http://www.asmeurer.com/git-workflow/) +* [How to Contribute to an Open Source Project on GitHub](https://egghead.io/courses/how-to-contribute-to-an-open-source-project-on-github) + +If you're new to working with git, GitHub, and the Unix Shell, we recommend +starting with the [Software Carpentry](https://software-carpentry.org/) lessons, +which are available in English and Spanish: + +* :gb: [Version Control with Git](http://swcarpentry.github.io/git-novice/) / :es: [Control de +versiones con Git](https://swcarpentry.github.io/git-novice-es/) +* :gb: [The Unix Shell](http://swcarpentry.github.io/shell-novice/) / :es: +[La Terminal de Unix](https://swcarpentry.github.io/shell-novice-es/) + + +### Setting up your environment + +To get the latest version clone the github repo: + +``` +git clone https://github.com/mdtanker/polartoolkit.git +``` +Change into the directory: + +``` +cd polartoolkit +``` + +Run the following command to make a new environment and install the package dependencies: + +``` + make create +``` +Activate the environment: +``` + conda activate polartoolkit +``` +Install your local version: +``` + make install +``` +This environment now contains your local, editable version of PolarToolkit, meaning if you alter code in the package, it will automatically include those changes in your environment (you may need to restart your kernel if using Jupyter). If you need to update the dependencies, see the [update the dependencies](#update-the-dependencies) section below. + +> **Note:** You'll need to activate the environment every time you start a new terminal. + +### Code style and linting + +We use [Ruff](https://docs.astral.sh/ruff/) to format the code so we don't have to +think about it. This allows you to not think about proper indentation, line length, or aligning your code while to development. Before committing, or periodically while you code, run the following to automatically format your code: +``` + make format +``` +Some formatting changes can't be applied automatically. Running the following to see these. +``` + make check +``` +Go through the output of this and try to change the code based on the errors. Search the error codes on the [Ruff documentation](https://docs.astral.sh/ruff/), which should give suggestions. Re-run the check to see if you've fixed it. Somethings can't be resolved (unsplittable urls longer than the line length). For these, add `# noqa: []` at the end of the line and the check will ignore it. Inside the square brackets add the specific error code you want to ignore. + +We also use [Pylint](https://pylint.readthedocs.io/en/latest/), which performs static-linting on the code. This checks the code and catches many common bugs and errors, without running any of the code. This check is slightly slower the the `Ruff` check. Run it with the following: +``` +make pylint +``` +Similar to using `Ruff`, go through the output of this, search the error codes on the [Pylint documentation](https://pylint.readthedocs.io/en/latest/) for help, and try and fix all the errors and warnings. If there are false-positives, or your confident you don't agree with the warning, add ` # pylint: disable=` at the end of the lines, with the warning code following the `=`. + +To run all three of the code checks, use: +``` +make style +``` + +#### Docstrings + +**All docstrings** should follow the +[numpy style guide](https://numpydoc.readthedocs.io/en/latest/format.html#docstring-standard). +All functions/classes/methods should have docstrings with a full description of all +arguments and return values. + +While the maximum line length for code is automatically set by *Ruff*, docstrings +must be formatted manually. To play nicely with Jupyter and IPython, **keep docstrings +limited to 88 characters** per line. We don't have a good way of enforcing this +automatically yet, so please do your best. + +#### Type hints + +We have also opted to use type hints throughout the codebase. This means each function/class/method should be fulled typed, including the docstrings. We use [mypy](https://mypy.readthedocs.io/en/stable/) as a type checker. +``` +make mypy +``` +Try and address all the errors and warnings. If there are complex types, just use `typing.Any`, or if necessary, ignore the line causing the issue by adding `# type: ignore[]` with the error code inside the square brackets. + +### Testing your code + +Automated testing helps ensure that our code is as free of bugs as it can be. +It also lets us know immediately if a change we make breaks any other part of the code. + +All of our test code and data are stored in the `tests` subpackage. +We use the [pytest](https://pytest.org/) framework to run the test suite, and our continuous integration systems with GitHub Actions use CodeCov to display how much of our code is covered by the tests. + +Please write tests for your code so that we can be sure that it won't break any of the +existing functionality. +Tests also help us be confident that we won't break your code in the future. + +If you're **new to testing**, see existing test files for examples of things to do. +**Don't let the tests keep you from submitting your contribution!** +If you're not sure how to do this or are having trouble, submit your pull request +anyway. +We will help you create the tests and sort out any kind of problem during code review. + +Run the tests and calculate test coverage using: + + make test + +To run a specific test by name: + + pytest --cov=. -k "test_name" + +The coverage report will let you know which lines of code are touched by the tests. +**Strive to get 100% coverage for the lines you changed.** +It's OK if you can't or don't know how to test something. +Leave a comment in the PR and we'll help you out. + +### Documentation + +The Docs are build with `Sphinx` and `Read the Docs`. Due to the above mentioned issues with the included C programs, `Read the Docs (RTD)` can't run the scripts which are part of the docs (i.e. the gallery examples). Because of this the notebooks don't execute on a build, as specified by `execute_notebooks: 'off'` in `_config.yml`. Here is how to run/update the docs on your local machine. + +> **Note:** The docs are automatically built on PR's by `RTD`, but it's good practice to build them manually before a PR, to check them for errors. + +#### Run all .ipynb's to update them + + make run_doc_files + +If your edits haven't changed any part of the core package, then there is no need to re-run the notebooks. If you changed a notebook, just clear it's contents and re-run that one notebook. + +#### Check the build manually (optional) + +You can build the docs using, but this will require pandoc to be install on your machine: + +```bash +nox -s docs +``` + +You can see a preview with: + +```bash +nox -s docs -- --serve +``` + +#### Automatically build the docs + +Add, commit, and push all changes to GitHub in a Pull Request, and `RTD` should automatically build the docs. + +In each PR, you will see section of the checks for `RTD`. Click on this to preview the docs for the PR. + +`RTD` uses the conda environment specified in `env/RTD_env.yml` when it's building. + +### Code Review + +After you've submitted a pull request, you should expect to hear at least a comment +within a couple of days. +We may suggest some changes or improvements or alternatives. + +Some things that will increase the chance that your pull request is accepted quickly: + +* Write a good and detailed description of what the PR does. +* Write tests for the code you wrote/modified. +* Readable code is better than clever code (even with comments). +* Write documentation for your code (docstrings) and leave comments explaining the + *reason* behind non-obvious things. +* Include an example of new features in the gallery or tutorials. +* Follow the [numpy guide](https://github.com/numpy/numpy/blob/master/doc/HOWTO_DOCUMENT.rst.txt) + for documentation. +* Run the automatic code formatter and style checks. + +If you're PR involves changing the package dependencies, see the below instructions for [updating the dependencies](#update-the-dependencies). + +Pull requests will automatically have tests run by GitHub Actions. +This includes running both the unit tests as well as code linters. +GitHub will show the status of these checks on the pull request. +Try to get them all passing (green). +If you have any trouble, leave a comment in the PR or +[post on the GH discussions page](https://github.com/mdtanker/polartoolkit/discussions). + +## Publish a new release + +This will almost always be done by the developers, but as a guide for them, here are instructions on how to release a new version of the package. + +Follow all the above instructions for formatting. Push your changes to a new or existing Pull Request. Once the automated GitHub Actions run (and pass), merge the PR into the main branch. + +### PyPI (pip) +PyPI release are made automatically via GitHub actions whenever a pull request is merged. + +### Conda-Forge +Once the new version is on PyPI, within a few hours a bot will automatically open a new PR in the [PolarToolkit conda-forge feedstock](https://github.com/conda-forge/polartoolkit-feedstock). Go through the checklist on the PR. Most of the time the only actions needs are updated any changes made to the dependencies since the last release. Merge the PR and the new version will be available on conda-forge shortly. + +Once the new version is on conda, update the binder .yml file, as below. + +## Update the dependencies + +To add or update a dependencies, add it to `pyproject.toml` either under `dependencies` or `optional-dependencies`. This will be included in the next build uploaded to PyPI. + +If you add a dependency necessary for using the package, make sure to add it to the Binder config file and update the `environment.yml` file in the repository. See below. + +## Create a conda environment file + +As a backup options for users experiencing install issues, we include a `environment.yml` file in the repo, which users can download and install from. To update this, run the following commands: ``` +make remove +make conda_install +make conda_export +``` + +## Set up the binder configuration + +To run this package online, Read the Docs will automatically create a Binder instance based on the configuration file `environment.yml` in a separate repository [`Polartoolkit-Binder`](https://github.com/mdtanker/polartoolkit-binder). This file should reflect the latest release on Conda-Forge. To allow all optional features in Binder, we need to manually add optional dependencies to the `environment.yml` file. Also, to use the latest version of PolarToolkit within Binder, makes sure to update its version in the file after each release. + +Once updated, rebuild the Binder environment, look at which package versions Binder used for each specified dependency, and update the environment file with these versions. + +Now, when submitting a PR, RTD will automatically build the docs and update the Binder environment. + +## Release Checklist +* re-run any relevant notebooks +* check docs are building correctly using the GitHub actions link within the PR +* merge the PR +* wait for `PyPI` to publish the new version [here](https://pypi.python.org/pypi/polartoolkit) +* wait for a PR to be opened in the [feedstock](https://github.com/conda-forge/polartoolkit-feedstock) +* update any changed dependencies in the feedstock PR and merge +* wait for `conda` to publish the new version [here](https://anaconda.org/conda-forge/polartoolkit) +* update backup `env/environment.yml` +* update polartoolkit version in `environment.yml` in [PolarToolkit-Binder repo](https://github.com/mdtanker/polartoolkit-binder/blob/main/environment.yml) +* test `PyPI` version with `make install_test` and `make test` +* test `conda` version with `make conda_install` and `make test` diff --git a/docs/gallery/index.md b/docs/gallery/index.md deleted file mode 100644 index 6b786090..00000000 --- a/docs/gallery/index.md +++ /dev/null @@ -1,37 +0,0 @@ -## Maps - -Here are some examples for use the module `Maps`. - -```{nbgallery} ---- ---- -basic_map -colormaps -extend_pygmt -setting_projection -3D_stack -subplots -subplot_layout -``` - -## Profiles - -Here are some examples for use the module `Profiles`. - -```{nbgallery} ---- ---- -profile -profile_with_map -profile_with_data -``` - -## Utils - -Here are some examples for use the module `Utils`. - -```{nbgallery} ---- ---- -mask_from_shp -``` diff --git a/docs/install.md b/docs/install.md index cdeed826..b8b9038e 100644 --- a/docs/install.md +++ b/docs/install.md @@ -2,7 +2,7 @@ ## Online usage (Binder) -See below for the full installation instructions. If instead you'd like to use this package online, without needing to install anything, check out our [Binder link](https://mybinder.org/v2/gh/mdtanker/polartoolkit-binder/main?urlpath=git-pull%3Frepo%3Dhttps%253A%252F%252Fgithub.com%252Fmdtanker%252Fpolartoolkit%26urlpath%3Dtree%252Fpolartoolkit%252Fdocs%252Fgallery%26branch%3Dmain), which gives full access to the latest released version of the package in an online environment. +See below for the full installation instructions. If instead you'd like to use this package online, without needing to install anything, check out our [Binder link](https://mybinder.org/v2/gh/mdtanker/polartoolkit-binder/main?urlpath=git-pull%3Frepo%3Dhttps%253A%252F%252Fgithub.com%252Fmdtanker%252Fpolartoolkit%26urlpath%3Dtree%252Fpolartoolkit%252Fdocs%252Ftutorial%26branch%3Dmain), which gives full access to the latest released version of the package in an online environment. ## Install Python diff --git a/docs/overview.md b/docs/overview.md index 0951f1c6..875bf8cd 100644 --- a/docs/overview.md +++ b/docs/overview.md @@ -1,6 +1,6 @@ # Overview -PolarToolkit is a Python package developed to help with conducting polar +`PolarToolkit` is a Python package developed to help with conducting polar science. The 5 modules shown here provide tools to help with a variety of common tasks. @@ -21,7 +21,7 @@ manipulations. ## Maps -Create high-quality maps using PyGMT with functions specifically tailored to +Create high-quality maps using `PyGMT` with functions specifically tailored to Antarctica (and soon to include Greenland and the Arctic). plot types: 2D, 3D, subplots, interactive maps diff --git a/docs/quickstart.ipynb b/docs/quickstart.ipynb index 745fef1c..e23fd425 100644 --- a/docs/quickstart.ipynb +++ b/docs/quickstart.ipynb @@ -6,7 +6,7 @@ "source": [ "# Quickstart\n", "\n", - "Here is a quick demonstration of some of the main things PolarToolkit can do. This assumes you know a bit of Python and have [successfully installed](install.md) this packaged." + "Here is a quick demonstration of some of the main things PolarToolkit can do. This assumes you know a bit of Python and have [successfully installed](install.md) this packaged. See the [tutorials](tutorial/index.md) for a step-by-step introduction to PolarToolkit, and the [how-to guides](how_to/index.md) for more in-depth guides for specific features." ] }, { diff --git a/docs/tracking/stats.py b/docs/tracking/stats.py index d5fdac64..e2835b9c 100644 --- a/docs/tracking/stats.py +++ b/docs/tracking/stats.py @@ -1,3 +1,17 @@ +# Copyright (c) 2024 The Polartoolkit Developers. +# Distributed under the terms of the MIT License. +# SPDX-License-Identifier: MIT +# +# This code is part of the package: +# PolarToolkit (https://github.com/mdtanker/polartoolkit) +# +# Copyright (c) 2022 The Polartoolkit Developers. +# Distributed under the terms of the MIT License. +# SPDX-License-Identifier: MIT +# +# This code is part of the package: +# PolarToolkit (https://github.com/mdtanker/polartoolkit) +# # package = "antarctic-plots" # # package = "polartoolkit" # # Show overall downloads over time, excluding mirrors diff --git a/docs/tutorial/download_data.ipynb b/docs/tutorial/01_download_data.ipynb similarity index 99% rename from docs/tutorial/download_data.ipynb rename to docs/tutorial/01_download_data.ipynb index 7717caf1..a3ca3b4b 100644 --- a/docs/tutorial/download_data.ipynb +++ b/docs/tutorial/01_download_data.ipynb @@ -496,7 +496,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "There are also some shapefiles availble to download. Here we will download a shapefile (`.shp`) of thee Greenland grounding line. In this case, the function returns the path to the download shapefile." + "There are also some shapefiles available to download. Here we will download a shapefile (`.shp`) of the Greenland grounding line. In this case, the function returns the path to the download shapefile." ] }, { diff --git a/docs/tutorial/specify_download_parameters.ipynb b/docs/tutorial/02_specify_download_parameters.ipynb similarity index 100% rename from docs/tutorial/specify_download_parameters.ipynb rename to docs/tutorial/02_specify_download_parameters.ipynb diff --git a/docs/tutorial/simple_map.ipynb b/docs/tutorial/03_simple_map.ipynb similarity index 100% rename from docs/tutorial/simple_map.ipynb rename to docs/tutorial/03_simple_map.ipynb diff --git a/docs/tutorial/map_features.ipynb b/docs/tutorial/04_map_features.ipynb similarity index 100% rename from docs/tutorial/map_features.ipynb rename to docs/tutorial/04_map_features.ipynb diff --git a/docs/tutorial/subplots.ipynb b/docs/tutorial/05_subplots.ipynb similarity index 99% rename from docs/tutorial/subplots.ipynb rename to docs/tutorial/05_subplots.ipynb index e2a3b7b5..11d0d76d 100644 --- a/docs/tutorial/subplots.ipynb +++ b/docs/tutorial/05_subplots.ipynb @@ -191,7 +191,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.9" + "version": "3.1.-1" }, "vscode": { "interpreter": { diff --git a/docs/tutorial/3D_plots.ipynb b/docs/tutorial/06_3D_plots.ipynb similarity index 100% rename from docs/tutorial/3D_plots.ipynb rename to docs/tutorial/06_3D_plots.ipynb diff --git a/docs/tutorial/plotting_point_data.ipynb b/docs/tutorial/07_plotting_point_data.ipynb similarity index 100% rename from docs/tutorial/plotting_point_data.ipynb rename to docs/tutorial/07_plotting_point_data.ipynb diff --git a/docs/tutorial/cross_sections_and_profiles.ipynb b/docs/tutorial/08_cross_sections_and_profiles.ipynb similarity index 100% rename from docs/tutorial/cross_sections_and_profiles.ipynb rename to docs/tutorial/08_cross_sections_and_profiles.ipynb diff --git a/docs/tutorial/interactive_data.ipynb b/docs/tutorial/09_interactive_data.ipynb similarity index 100% rename from docs/tutorial/interactive_data.ipynb rename to docs/tutorial/09_interactive_data.ipynb diff --git a/docs/tutorial/reprojecting_data.ipynb b/docs/tutorial/10_reprojecting_data.ipynb similarity index 99% rename from docs/tutorial/reprojecting_data.ipynb rename to docs/tutorial/10_reprojecting_data.ipynb index db3fce58..5f081776 100644 --- a/docs/tutorial/reprojecting_data.ipynb +++ b/docs/tutorial/10_reprojecting_data.ipynb @@ -321,7 +321,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.9" + "version": "3.1.-1" }, "vscode": { "interpreter": { diff --git a/docs/tutorial/index.md b/docs/tutorial/index.md index 3ad99396..3a900300 100644 --- a/docs/tutorial/index.md +++ b/docs/tutorial/index.md @@ -1,16 +1,23 @@ # Tutorials +These tutorials are designed to introduce a new user to PolarToolkit. They +expect you to be vaguely familiar with Python, and to have PolarToolkit +[successfully installed](../install.md). You should follow these in order, then +refer to the [how-to guides](../how_to/index.md) for more in-depth guides for +specific features. + ```{nbgallery} --- +"numbered": true --- -download_data -specify_download_parameters -simple_map -map_features -subplots -3D_plots -plotting_point_data -cross_sections_and_profiles -interactive_data -reprojecting_data +01_download_data +02_specify_download_parameters +03_simple_map +04_map_features +05_subplots +06_3D_plots +07_plotting_point_data +08_cross_sections_and_profiles +09_interactive_data +10_reprojecting_data ``` diff --git a/env/environment.yml b/env/environment.yml index 29b27c5d..306f5bf2 100644 --- a/env/environment.yml +++ b/env/environment.yml @@ -36,21 +36,23 @@ dependencies: - cairo=1.18.0=h3faef2a_0 - certifi=2024.6.2=pyhd8ed1ab_0 - cfitsio=4.4.0=hbdc6101_1 - - cftime=1.6.3=py312h085067d_1 + - cftime=1.6.4=py312h085067d_0 - charset-normalizer=3.3.2=pyhd8ed1ab_0 - click=8.1.7=unix_pyh707e725_0 - click-plugins=1.1.1=py_0 - cligj=0.7.2=pyhd8ed1ab_1 - cloudpickle=3.0.0=pyhd8ed1ab_0 + - colorama=0.4.6=pyhd8ed1ab_0 - contourpy=1.2.1=py312h8572e83_0 - curl=8.8.0=he654da7_0 - cycler=0.12.1=pyhd8ed1ab_0 - cytoolz=0.12.3=py312h98912ed_0 - - dask=2024.5.2=pyhd8ed1ab_0 - - dask-core=2024.5.2=pyhd8ed1ab_0 - - dask-expr=1.1.2=pyhd8ed1ab_0 + - dask=2024.6.0=pyhd8ed1ab_0 + - dask-core=2024.6.0=pyhd8ed1ab_0 + - dask-expr=1.1.3=pyhd8ed1ab_0 - dcw-gmt=2.1.2=ha770c72_0 - - distributed=2024.5.2=pyhd8ed1ab_0 + - deprecation=2.1.0=pyh9f0ad1d_0 + - distributed=2024.6.0=pyhd8ed1ab_0 - docrep=0.3.2=pyh44b312d_0 - et_xmlfile=1.1.0=pyhd8ed1ab_0 - expat=2.6.2=h59595ed_0 @@ -79,7 +81,7 @@ dependencies: - gflags=2.2.2=he1b5a44_1004 - ghostscript=10.03.1=h59595ed_0 - giflib=5.2.2=hd590300_0 - - glog=0.7.0=hed5481d_0 + - glog=0.7.1=hbabe93e_0 - gmt=6.5.0=h0bfc19b_2 - gshhg-gmt=2.3.7=ha770c72_1003 - harmonica=0.6.0=pyhd8ed1ab_0 @@ -97,7 +99,7 @@ dependencies: - kiwisolver=1.4.5=py312h8572e83_1 - krb5=1.21.2=h659d440_0 - lcms2=2.16=hb7c19ff_0 - - ld_impl_linux-64=2.40=hf3520f5_3 + - ld_impl_linux-64=2.40=hf3520f5_4 - lerc=4.0.0=h27087fc_0 - libabseil=20240116.2=cxx17_h59595ed_0 - libaec=1.1.3=h59595ed_0 @@ -120,12 +122,12 @@ dependencies: - libevent=2.1.12=hf998b51_1 - libexpat=2.6.2=h59595ed_0 - libffi=3.4.2=h7f98852_5 - - libgcc-ng=13.2.0=h77fa898_7 + - libgcc-ng=13.2.0=h77fa898_9 - libgdal=3.9.0=h77540a9_5 - - libgfortran-ng=13.2.0=h69a702a_7 - - libgfortran5=13.2.0=hca663fb_7 + - libgfortran-ng=13.2.0=h69a702a_9 + - libgfortran5=13.2.0=h3d2ce59_9 - libglib=2.80.2=hf974151_0 - - libgomp=13.2.0=h77fa898_7 + - libgomp=13.2.0=h77fa898_9 - libgoogle-cloud=2.24.0=h2736e30_0 - libgoogle-cloud-storage=2.24.0=h3d9a0c8_0 - libgrpc=1.62.2=h15f2491_0 @@ -144,11 +146,11 @@ dependencies: - libprotobuf=4.25.3=h08a7969_0 - libre2-11=2023.09.01=h5a48ba9_2 - librttopo=1.1.0=h8917695_15 - - libspatialindex=1.9.3=he02047a_5 + - libspatialindex=2.0.0=he02047a_0 - libspatialite=5.1.0=h5539517_6 - libsqlite=3.46.0=hde9e2c9_0 - libssh2=1.11.0=h0841786_0 - - libstdcxx-ng=13.2.0=hc0a3c3a_7 + - libstdcxx-ng=13.2.0=hc0a3c3a_9 - libthrift=0.19.0=hb90f79a_1 - libtiff=4.6.0=h1dd3fc0_3 - libutf8proc=2.8.0=h166bdaf_0 @@ -180,10 +182,10 @@ dependencies: - numcodecs=0.12.1=py312h7070661_1 - numpy=1.26.4=py312heda63a1_0 - openjpeg=2.5.2=h488ebb8_0 - - openpyxl=3.1.2=py312h98912ed_1 + - openpyxl=3.1.4=py312h98912ed_0 - openssl=3.3.1=h4ab18f5_0 - orc=2.0.1=h17fec99_1 - - packaging=24.0=pyhd8ed1ab_0 + - packaging=24.1=pyhd8ed1ab_0 - pandas=2.2.2=py312h1d6d2e6_1 - partd=1.4.2=pyhd8ed1ab_0 - pcre=8.45=h9c3ff4c_0 @@ -192,7 +194,7 @@ dependencies: - pip=24.0=pyhd8ed1ab_0 - pixman=0.43.2=h59595ed_0 - platformdirs=4.2.2=pyhd8ed1ab_0 - - polartoolkit=0.3.3=pyhd8ed1ab_0 + - polartoolkit=0.4.0=pyhd8ed1ab_0 - pooch=1.8.2=pyhd8ed1ab_0 - poppler=24.04.0=hb6cd0d7_0 - poppler-data=0.4.12=hd8ed1ab_0 @@ -220,7 +222,7 @@ dependencies: - readline=8.2=h8228510_1 - requests=2.32.3=pyhd8ed1ab_0 - rioxarray=0.15.5=pyhd8ed1ab_0 - - rtree=1.2.0=py312hb0aae1a_0 + - rtree=1.2.0=py312h3ed4c40_1 - s2n=1.4.15=he19d79f_0 - scikit-learn=1.5.0=py312h1fcc3ea_1 - scipy=1.13.1=py312hc2bc53b_0 @@ -238,14 +240,15 @@ dependencies: - tk=8.6.13=noxft_h4845f30_101 - toolz=0.12.1=pyhd8ed1ab_0 - tornado=6.4.1=py312h9a8786e_0 + - tqdm=4.66.4=pyhd8ed1ab_0 - typish=1.9.3=pyhd8ed1ab_0 - tzcode=2024a=h3f72095_0 - tzdata=2024a=h0c530f3_0 - uriparser=0.9.8=hac33072_0 - urllib3=2.2.1=pyhd8ed1ab_0 - - verde=1.8.0=pyhd8ed1ab_0 + - verde=1.8.1=pyhd8ed1ab_0 - wheel=0.43.0=pyhd8ed1ab_1 - - xarray=2024.5.0=pyhd8ed1ab_0 + - xarray=2024.6.0=pyhd8ed1ab_1 - xerces-c=3.2.5=hac6953d_0 - xorg-kbproto=1.0.7=h7f98852_1002 - xorg-libice=1.1.1=hd590300_0 diff --git a/noxfile.py b/noxfile.py index 59587cff..26e8bc28 100644 --- a/noxfile.py +++ b/noxfile.py @@ -1,3 +1,10 @@ +# Copyright (c) 2024 The Polartoolkit Developers. +# Distributed under the terms of the MIT License. +# SPDX-License-Identifier: MIT +# +# This code is part of the package: +# PolarToolkit (https://github.com/mdtanker/polartoolkit) +# # Copyright (c) 2022 The Polartoolkit Developers. # Distributed under the terms of the MIT License. # SPDX-License-Identifier: MIT diff --git a/src/antarctic_plots/__init__.py b/src/antarctic_plots/__init__.py index 882cf247..05d2b41b 100644 --- a/src/antarctic_plots/__init__.py +++ b/src/antarctic_plots/__init__.py @@ -1,3 +1,17 @@ +# Copyright (c) 2024 The Polartoolkit Developers. +# Distributed under the terms of the MIT License. +# SPDX-License-Identifier: MIT +# +# This code is part of the package: +# PolarToolkit (https://github.com/mdtanker/polartoolkit) +# +# Copyright (c) 2022 The Polartoolkit Developers. +# Distributed under the terms of the MIT License. +# SPDX-License-Identifier: MIT +# +# This code is part of the package: +# PolarToolkit (https://github.com/mdtanker/polartoolkit) +# import logging logging.critical( diff --git a/src/polartoolkit/__init__.py b/src/polartoolkit/__init__.py index 840ee43d..9c8db489 100644 --- a/src/polartoolkit/__init__.py +++ b/src/polartoolkit/__init__.py @@ -1,3 +1,10 @@ +# Copyright (c) 2024 The Polartoolkit Developers. +# Distributed under the terms of the MIT License. +# SPDX-License-Identifier: MIT +# +# This code is part of the package: +# PolarToolkit (https://github.com/mdtanker/polartoolkit) +# # Copyright (c) 2022 The Polartoolkit Developers. # Distributed under the terms of the MIT License. # SPDX-License-Identifier: MIT diff --git a/src/polartoolkit/fetch.py b/src/polartoolkit/fetch.py index b6282753..de096e24 100644 --- a/src/polartoolkit/fetch.py +++ b/src/polartoolkit/fetch.py @@ -1,3 +1,10 @@ +# Copyright (c) 2024 The Polartoolkit Developers. +# Distributed under the terms of the MIT License. +# SPDX-License-Identifier: MIT +# +# This code is part of the package: +# PolarToolkit (https://github.com/mdtanker/polartoolkit) +# # Copyright (c) 2022 The Polartoolkit Developers. # Distributed under the terms of the MIT License. # SPDX-License-Identifier: MIT @@ -20,7 +27,10 @@ from pathlib import Path import deprecation -import geopandas as gpd + +if typing.TYPE_CHECKING: + import geopandas as gpd + import harmonica as hm import pandas as pd import pooch @@ -39,9 +49,6 @@ utils, ) -# import polartoolkit.regions as regions -# import polartoolkit.utils as utils - load_dotenv() @@ -278,20 +285,26 @@ def sample_shp(name: str) -> str: str file path as a string """ + if name == "Disco_deep_transect": - known_hash = "70e86b3bf9775dd824014afb91da470263edf23159a9fe34107897d1bae9623e" + known_hash = ( + None # "ffffeef15d7556cd60305e6222852e3b4e09da3b6c628a094c1e99ac6d605303" + ) elif name == "Roosevelt_Island": - known_hash = "83434284808d067b8b18b649e41287a63f01eb2ce581b2c34ee44ae3a1a5ca2a" + known_hash = ( + None # "f3821b8a4d24dd676f75db4b7f2b532a328de18e0bdcce8cee6a6abb3b3e70f6" + ) else: msg = "invalid name string" raise ValueError(msg) + path = pooch.retrieve( - url=f"https://github.com/mdtanker/polartoolkit/raw/main/data/{name}.zip", + url=f"doi:10.6084/m9.figshare.26039578.v1/{name}.zip", path=f"{pooch.os_cache('pooch')}/polartoolkit/shapefiles", + fname=name, processor=pooch.Unzip(), known_hash=known_hash, ) - val: str = next(p for p in path if p.endswith(".shp")) return val diff --git a/src/polartoolkit/maps.py b/src/polartoolkit/maps.py index 35a17a8a..13431e44 100644 --- a/src/polartoolkit/maps.py +++ b/src/polartoolkit/maps.py @@ -1,3 +1,10 @@ +# Copyright (c) 2024 The Polartoolkit Developers. +# Distributed under the terms of the MIT License. +# SPDX-License-Identifier: MIT +# +# This code is part of the package: +# PolarToolkit (https://github.com/mdtanker/polartoolkit) +# # Copyright (c) 2022 The Polartoolkit Developers. # Distributed under the terms of the MIT License. # SPDX-License-Identifier: MIT @@ -1563,7 +1570,7 @@ def round_to_1(x: float) -> float: fig.basemap( region=region_converted, projection=projection, - map_scale=f'{position}+w{scale_length}k+f+l"km"+ar', + map_scale=f"{position}+w{scale_length}k+f+lkm+ar", # verbose="e", box=kwargs.get("scalebar_box", "+gwhite"), ) diff --git a/src/polartoolkit/profile.py b/src/polartoolkit/profile.py index 603acfd8..e922320d 100644 --- a/src/polartoolkit/profile.py +++ b/src/polartoolkit/profile.py @@ -1,3 +1,17 @@ +# Copyright (c) 2024 The Polartoolkit Developers. +# Distributed under the terms of the MIT License. +# SPDX-License-Identifier: MIT +# +# This code is part of the package: +# PolarToolkit (https://github.com/mdtanker/polartoolkit) +# +# Copyright (c) 2022 The Polartoolkit Developers. +# Distributed under the terms of the MIT License. +# SPDX-License-Identifier: MIT +# +# This code is part of the package: +# PolarToolkit (https://github.com/mdtanker/polartoolkit) +# import logging logging.critical( diff --git a/src/polartoolkit/profiles.py b/src/polartoolkit/profiles.py index 34978eee..b483a677 100644 --- a/src/polartoolkit/profiles.py +++ b/src/polartoolkit/profiles.py @@ -1,3 +1,10 @@ +# Copyright (c) 2024 The Polartoolkit Developers. +# Distributed under the terms of the MIT License. +# SPDX-License-Identifier: MIT +# +# This code is part of the package: +# PolarToolkit (https://github.com/mdtanker/polartoolkit) +# # Copyright (c) 2022 The Polartoolkit Developers. # Distributed under the terms of the MIT License. # SPDX-License-Identifier: MIT diff --git a/src/polartoolkit/regions.py b/src/polartoolkit/regions.py index 9709fb0c..d617997d 100644 --- a/src/polartoolkit/regions.py +++ b/src/polartoolkit/regions.py @@ -1,3 +1,10 @@ +# Copyright (c) 2024 The Polartoolkit Developers. +# Distributed under the terms of the MIT License. +# SPDX-License-Identifier: MIT +# +# This code is part of the package: +# PolarToolkit (https://github.com/mdtanker/polartoolkit) +# # Copyright (c) 2022 The Polartoolkit Developers. # Distributed under the terms of the MIT License. # SPDX-License-Identifier: MIT diff --git a/src/polartoolkit/utils.py b/src/polartoolkit/utils.py index 207d282f..7a92a760 100644 --- a/src/polartoolkit/utils.py +++ b/src/polartoolkit/utils.py @@ -1,3 +1,10 @@ +# Copyright (c) 2024 The Polartoolkit Developers. +# Distributed under the terms of the MIT License. +# SPDX-License-Identifier: MIT +# +# This code is part of the package: +# PolarToolkit (https://github.com/mdtanker/polartoolkit) +# # Copyright (c) 2022 The Polartoolkit Developers. # Distributed under the terms of the MIT License. # SPDX-License-Identifier: MIT diff --git a/tests/test_fetch.py b/tests/test_fetch.py index 5ff3a1a6..8d391727 100644 --- a/tests/test_fetch.py +++ b/tests/test_fetch.py @@ -1,3 +1,10 @@ +# Copyright (c) 2024 The Polartoolkit Developers. +# Distributed under the terms of the MIT License. +# SPDX-License-Identifier: MIT +# +# This code is part of the package: +# PolarToolkit (https://github.com/mdtanker/polartoolkit) +# # Copyright (c) 2022 The Polartoolkit Developers. # Distributed under the terms of the MIT License. # SPDX-License-Identifier: MIT diff --git a/tests/test_profiles.py b/tests/test_profiles.py index 5acb45f0..135c5404 100644 --- a/tests/test_profiles.py +++ b/tests/test_profiles.py @@ -1,3 +1,10 @@ +# Copyright (c) 2024 The Polartoolkit Developers. +# Distributed under the terms of the MIT License. +# SPDX-License-Identifier: MIT +# +# This code is part of the package: +# PolarToolkit (https://github.com/mdtanker/polartoolkit) +# # Copyright (c) 2022 The Polartoolkit Developers. # Distributed under the terms of the MIT License. # SPDX-License-Identifier: MIT diff --git a/tests/test_regions.py b/tests/test_regions.py index f4acb2fd..716f0dc1 100644 --- a/tests/test_regions.py +++ b/tests/test_regions.py @@ -1,3 +1,10 @@ +# Copyright (c) 2024 The Polartoolkit Developers. +# Distributed under the terms of the MIT License. +# SPDX-License-Identifier: MIT +# +# This code is part of the package: +# PolarToolkit (https://github.com/mdtanker/polartoolkit) +# # Copyright (c) 2022 The Polartoolkit Developers. # Distributed under the terms of the MIT License. # SPDX-License-Identifier: MIT diff --git a/tests/test_utils.py b/tests/test_utils.py index fb7abe0a..8e8067bf 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -1,3 +1,10 @@ +# Copyright (c) 2024 The Polartoolkit Developers. +# Distributed under the terms of the MIT License. +# SPDX-License-Identifier: MIT +# +# This code is part of the package: +# PolarToolkit (https://github.com/mdtanker/polartoolkit) +# # Copyright (c) 2022 The Polartoolkit Developers. # Distributed under the terms of the MIT License. # SPDX-License-Identifier: MIT diff --git a/tools/license_notice.py b/tools/license_notice.py index 4fd6d75a..ad3fbfbe 100644 --- a/tools/license_notice.py +++ b/tools/license_notice.py @@ -1,3 +1,10 @@ +# Copyright (c) 2024 The Polartoolkit Developers. +# Distributed under the terms of the MIT License. +# SPDX-License-Identifier: MIT +# +# This code is part of the package: +# PolarToolkit (https://github.com/mdtanker/polartoolkit) +# # Copyright (c) 2022 The Polartoolkit Developers. # Distributed under the terms of the MIT License. # SPDX-License-Identifier: MIT @@ -16,7 +23,7 @@ from pathspec import PathSpec PROJECT = "PolarToolkit" -YEAR = "2022" +YEAR = "2024" NOTICE = f""" # Copyright (c) {YEAR} The {PROJECT.title()} Developers. # Distributed under the terms of the MIT License.