xarray-subset-grid 0.0.1__tar.gz → 0.1.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {xarray_subset_grid-0.0.1 → xarray_subset_grid-0.1.1}/.gitattributes +2 -3
- {xarray_subset_grid-0.0.1 → xarray_subset_grid-0.1.1}/.readthedocs.yaml +13 -13
- {xarray_subset_grid-0.0.1 → xarray_subset_grid-0.1.1}/CONTRIBUTING.md +129 -129
- {xarray_subset_grid-0.0.1 → xarray_subset_grid-0.1.1}/DevelopmentNotes.txt +15 -17
- {xarray_subset_grid-0.0.1 → xarray_subset_grid-0.1.1}/LICENSE +28 -28
- xarray_subset_grid-0.1.1/MANIFEST.in +15 -0
- {xarray_subset_grid-0.0.1 → xarray_subset_grid-0.1.1}/PKG-INFO +44 -36
- {xarray_subset_grid-0.0.1 → xarray_subset_grid-0.1.1}/README.md +148 -140
- {xarray_subset_grid-0.0.1 → xarray_subset_grid-0.1.1}/conda_requirements.txt +23 -23
- {xarray_subset_grid-0.0.1 → xarray_subset_grid-0.1.1}/conda_requirements_dev.txt +13 -14
- {xarray_subset_grid-0.0.1 → xarray_subset_grid-0.1.1}/pixi.lock +23792 -26820
- xarray_subset_grid-0.1.1/pixi.toml +77 -0
- {xarray_subset_grid-0.0.1 → xarray_subset_grid-0.1.1}/profiling/README.md +1 -2
- {xarray_subset_grid-0.0.1 → xarray_subset_grid-0.1.1}/profiling/STOFS_benchmarks.py +46 -45
- {xarray_subset_grid-0.0.1 → xarray_subset_grid-0.1.1}/profiling/p_in_p_perf.py +119 -119
- xarray_subset_grid-0.1.1/pyproject.toml +91 -0
- {xarray_subset_grid-0.0.1 → xarray_subset_grid-0.1.1}/xarray_subset_grid/__init__.py +10 -10
- {xarray_subset_grid-0.0.1 → xarray_subset_grid-0.1.1}/xarray_subset_grid/accessor.py +200 -185
- {xarray_subset_grid-0.0.1 → xarray_subset_grid-0.1.1}/xarray_subset_grid/grid.py +203 -208
- xarray_subset_grid-0.1.1/xarray_subset_grid/grids/__init__.py +6 -0
- {xarray_subset_grid-0.0.1 → xarray_subset_grid-0.1.1}/xarray_subset_grid/grids/fvcom_grid.py +140 -139
- xarray_subset_grid-0.1.1/xarray_subset_grid/grids/regular_grid.py +179 -0
- {xarray_subset_grid-0.0.1 → xarray_subset_grid-0.1.1}/xarray_subset_grid/grids/regular_grid_2d.py +101 -95
- {xarray_subset_grid-0.0.1 → xarray_subset_grid-0.1.1}/xarray_subset_grid/grids/selfe_grid.py +87 -87
- {xarray_subset_grid-0.0.1 → xarray_subset_grid-0.1.1}/xarray_subset_grid/grids/sgrid.py +232 -226
- {xarray_subset_grid-0.0.1 → xarray_subset_grid-0.1.1}/xarray_subset_grid/grids/ugrid.py +490 -493
- {xarray_subset_grid-0.0.1 → xarray_subset_grid-0.1.1}/xarray_subset_grid/selector.py +69 -69
- {xarray_subset_grid-0.0.1 → xarray_subset_grid-0.1.1}/xarray_subset_grid/utils.py +176 -153
- {xarray_subset_grid-0.0.1 → xarray_subset_grid-0.1.1}/xarray_subset_grid/visualization/mpl_plotting.py +184 -185
- xarray_subset_grid-0.1.1/xarray_subset_grid.egg-info/SOURCES.txt +28 -0
- xarray_subset_grid-0.0.1/.github/workflows/test.yaml +0 -50
- xarray_subset_grid-0.0.1/.gitignore +0 -168
- xarray_subset_grid-0.0.1/docs/Makefile +0 -20
- xarray_subset_grid-0.0.1/docs/conf.py +0 -62
- xarray_subset_grid-0.0.1/docs/contributing.rst +0 -173
- xarray_subset_grid-0.0.1/docs/design.rst +0 -36
- xarray_subset_grid-0.0.1/docs/examples/.gitignore +0 -1
- xarray_subset_grid-0.0.1/docs/examples/README.md +0 -7
- xarray_subset_grid-0.0.1/docs/examples/RegularGridTHREDDS.ipynb +0 -194
- xarray_subset_grid-0.0.1/docs/examples/example_data/SCHISM/horizontalVelX_1.nc +0 -0
- xarray_subset_grid-0.0.1/docs/examples/example_data/SCHISM/horizontalVelY_1.nc +0 -0
- xarray_subset_grid-0.0.1/docs/examples/example_data/SCHISM/out2d_1.nc +0 -0
- xarray_subset_grid-0.0.1/docs/examples/example_data/SCHISM/salinity_1.nc +0 -0
- xarray_subset_grid-0.0.1/docs/examples/example_data/SCHISM/zCoordinates_1.nc +0 -0
- xarray_subset_grid-0.0.1/docs/examples/example_data/SFBOFS_subset1.nc +0 -0
- xarray_subset_grid-0.0.1/docs/examples/example_data/image.png +0 -0
- xarray_subset_grid-0.0.1/docs/examples/example_data/northeastUSA2d_bb3d126e.pkl +0 -0
- xarray_subset_grid-0.0.1/docs/examples/example_data/northeastUSA3d_076e4d62.pkl +0 -0
- xarray_subset_grid-0.0.1/docs/examples/example_data/small_ugrid_zero_based.nc +0 -0
- xarray_subset_grid-0.0.1/docs/examples/example_data/stofs_2d_glo.subset.nc +0 -0
- xarray_subset_grid-0.0.1/docs/examples/example_data/tris_and_bounds.nc +0 -0
- xarray_subset_grid-0.0.1/docs/examples/example_data/wcofs-subset-control.nc +0 -0
- xarray_subset_grid-0.0.1/docs/examples/fvcom.ipynb +0 -8404
- xarray_subset_grid-0.0.1/docs/examples/fvcom_3d.ipynb +0 -10676
- xarray_subset_grid-0.0.1/docs/examples/gfs_opendap.ipynb +0 -18922
- xarray_subset_grid-0.0.1/docs/examples/nam_opendap.ipynb +0 -12953
- xarray_subset_grid-0.0.1/docs/examples/regular_grid_2d.ipynb +0 -1506
- xarray_subset_grid-0.0.1/docs/examples/roms-compare.ipynb +0 -244
- xarray_subset_grid-0.0.1/docs/examples/roms.ipynb +0 -331
- xarray_subset_grid-0.0.1/docs/examples/roms_3d.ipynb +0 -7483
- xarray_subset_grid-0.0.1/docs/examples/rtofs.ipynb +0 -4812
- xarray_subset_grid-0.0.1/docs/examples/selfe.ipynb +0 -7741
- xarray_subset_grid-0.0.1/docs/examples/sscofs.ipynb +0 -3941
- xarray_subset_grid-0.0.1/docs/examples/stofs_2d.ipynb +0 -3861
- xarray_subset_grid-0.0.1/docs/examples/stofs_3d.ipynb +0 -7860
- xarray_subset_grid-0.0.1/docs/examples/subset_file.py +0 -112
- xarray_subset_grid-0.0.1/docs/examples/subset_from_ncfile.ipynb +0 -1358
- xarray_subset_grid-0.0.1/docs/grids.rst +0 -34
- xarray_subset_grid-0.0.1/docs/index.rst +0 -19
- xarray_subset_grid-0.0.1/docs/installation.rst +0 -94
- xarray_subset_grid-0.0.1/docs/make.bat +0 -35
- xarray_subset_grid-0.0.1/docs/notebooks.rst +0 -22
- xarray_subset_grid-0.0.1/docs/requirements.txt +0 -8
- xarray_subset_grid-0.0.1/pyproject.toml +0 -158
- xarray_subset_grid-0.0.1/tests/__init__.py +0 -0
- xarray_subset_grid-0.0.1/tests/conftest.py +0 -38
- xarray_subset_grid-0.0.1/tests/example_data/AMSEAS-subset.nc +0 -0
- xarray_subset_grid-0.0.1/tests/example_data/arakawa_c_test_grid.nc +0 -0
- xarray_subset_grid-0.0.1/tests/example_data/arakawa_c_test_grid.png +0 -0
- xarray_subset_grid-0.0.1/tests/test_grids/__init__.py +0 -0
- xarray_subset_grid-0.0.1/tests/test_grids/test_regular_grid.py +0 -210
- xarray_subset_grid-0.0.1/tests/test_grids/test_sgrid.py +0 -118
- xarray_subset_grid-0.0.1/tests/test_grids/test_ugrid.py +0 -597
- xarray_subset_grid-0.0.1/tests/test_utils.py +0 -125
- xarray_subset_grid-0.0.1/tests/test_visualization/.gitignore +0 -1
- xarray_subset_grid-0.0.1/tests/test_visualization/__init__.py +0 -0
- xarray_subset_grid-0.0.1/tests/test_visualization/output/README.txt +0 -1
- xarray_subset_grid-0.0.1/tests/test_visualization/test_mpl_plotting.py +0 -83
- xarray_subset_grid-0.0.1/xarray_subset_grid/_version.py +0 -21
- xarray_subset_grid-0.0.1/xarray_subset_grid/grids/__init__.py +0 -6
- xarray_subset_grid-0.0.1/xarray_subset_grid/grids/regular_grid.py +0 -138
- xarray_subset_grid-0.0.1/xarray_subset_grid.egg-info/PKG-INFO +0 -212
- xarray_subset_grid-0.0.1/xarray_subset_grid.egg-info/SOURCES.txt +0 -89
- xarray_subset_grid-0.0.1/xarray_subset_grid.egg-info/dependency_links.txt +0 -1
- xarray_subset_grid-0.0.1/xarray_subset_grid.egg-info/requires.txt +0 -22
- xarray_subset_grid-0.0.1/xarray_subset_grid.egg-info/top_level.txt +0 -1
- {xarray_subset_grid-0.0.1 → xarray_subset_grid-0.1.1}/setup.cfg +0 -0
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
# GitHub syntax highlighting
|
|
2
|
-
pixi.lock linguist-language=YAML
|
|
3
|
-
|
|
1
|
+
# GitHub syntax highlighting
|
|
2
|
+
pixi.lock linguist-language=YAML
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
version: "2"
|
|
2
|
-
|
|
3
|
-
build:
|
|
4
|
-
os: "ubuntu-20.04"
|
|
5
|
-
tools:
|
|
6
|
-
python: "3.10"
|
|
7
|
-
|
|
8
|
-
sphinx:
|
|
9
|
-
configuration: docs/conf.py
|
|
10
|
-
|
|
11
|
-
python:
|
|
12
|
-
install:
|
|
13
|
-
- requirements: docs/requirements.txt
|
|
1
|
+
version: "2"
|
|
2
|
+
|
|
3
|
+
build:
|
|
4
|
+
os: "ubuntu-20.04"
|
|
5
|
+
tools:
|
|
6
|
+
python: "3.10"
|
|
7
|
+
|
|
8
|
+
sphinx:
|
|
9
|
+
configuration: docs/conf.py
|
|
10
|
+
|
|
11
|
+
python:
|
|
12
|
+
install:
|
|
13
|
+
- requirements: docs/requirements.txt
|
|
@@ -1,129 +1,129 @@
|
|
|
1
|
-
# Contributors Guide
|
|
2
|
-
|
|
3
|
-
Interested in improving xarray-subset-grid?
|
|
4
|
-
Have a few minutes to tackle an issue? Or improve the documentation?
|
|
5
|
-
|
|
6
|
-
## Introduction
|
|
7
|
-
|
|
8
|
-
First off, thank you for considering contributing to xarray-subset-grid.
|
|
9
|
-
Following these guidelines helps to communicate that you respect the time of the developers managing and developing these open source projects.
|
|
10
|
-
In return, they should reciprocate that respect in addressing your issue,
|
|
11
|
-
assessing changes, and helping you finalize your pull requests.
|
|
12
|
-
So, please take a few minutes to read through this guide.
|
|
13
|
-
|
|
14
|
-
## What Can I Do?
|
|
15
|
-
|
|
16
|
-
* Tackle any issues you wish!
|
|
17
|
-
* Contribute code you already have. It does not need to be perfect! We will help you clean
|
|
18
|
-
things up, test it, etc.
|
|
19
|
-
* Make a tutorial or example of how to do something.
|
|
20
|
-
* Improve documentation of a feature you found troublesome.
|
|
21
|
-
* File a new issue if you run into problems!
|
|
22
|
-
|
|
23
|
-
## Ground Rules
|
|
24
|
-
|
|
25
|
-
The goal is to maintain a diverse community that's pleasant for everyone. Please
|
|
26
|
-
be considerate and respectful of others by following our
|
|
27
|
-
[code of conduct](https://github.com/ioos/.github/blob/main/CODE_OF_CONDUCT.md).
|
|
28
|
-
|
|
29
|
-
* Each pull request should consist of a logical collection of changes.
|
|
30
|
-
You can include multiple bug fixes in a single pull request,
|
|
31
|
-
but they should be related.
|
|
32
|
-
For unrelated changes, please submit multiple pull requests.
|
|
33
|
-
* Do not commit changes to files that are irrelevant to your feature or bug fix
|
|
34
|
-
(eg: .gitignore).
|
|
35
|
-
* Be willing to accept criticism and work on improving your code; we don't want
|
|
36
|
-
to break other users' code, so care must be taken not to introduce bugs.
|
|
37
|
-
* Be aware that the pull request review process is not immediate, and is
|
|
38
|
-
generally proportional to the size of the pull request.
|
|
39
|
-
* PRs with new features, or bugfixes, should not fix existing lints. The more changes in a PR, the harder it will be for the reviewer. We can always send a separate PR with the lint fix later.
|
|
40
|
-
* Avoid making the project "look like your project." We tend to make ourselves at home when writing contributions, but we should avoid renaming things just for renaming sake, moving files around to "organize" the project, or make aesthetic changes without asking the upstream devs first. Such changes, while sometimes desirable, don't bring much value to a PR but do bring extra burden to the reviewers.
|
|
41
|
-
* Do not tackle more than one issue or one feature per PR. While tempting, the smaller the PR, the easier will be to get it merged, reducing merge conflicts, without holding other PRs. Many small ones are always better than a single massive PR.
|
|
42
|
-
* Always state your PR objective clearly in the title "New Feature X", "Bug Fix Y", or "Fixing doc typo".
|
|
43
|
-
* Always add a "longer, but not too long, description of your PR in the body of the first comment.
|
|
44
|
-
* Always write meaningful, short, concise, commit messages. The kind of message your future self will congratulate you.
|
|
45
|
-
* When copying code from other places, like Stack-Overflow (SO), always add the link. That is not only a way to credit the original author of the code, but also add a way to look for the source when debugging. Also, it is not uncommon for a SO answer to be updated with better code.
|
|
46
|
-
* When using AI, also add a comment that you did! And, if possible, add the questions/chat report in a gist and link to it in the PR. While AI can be of great aid, it can also write obfuscated code that is hard to debug if you don't know it was machine generated.
|
|
47
|
-
* Be sure to search the existing issues and PRs before submitting yours. Sometimes these changes are already there and all we need is an extra person on the hill to make the final push. Be that second person and not the one that starts a new hill climb by yourself.
|
|
48
|
-
Always read the development notes when they exist, many questions are already answered there.
|
|
49
|
-
|
|
50
|
-
## Reporting a bug
|
|
51
|
-
|
|
52
|
-
The easiest way to get involved is to report issues you encounter when using IOOS Software or by
|
|
53
|
-
requesting something you think is missing.
|
|
54
|
-
|
|
55
|
-
* Head over to the project issues page.
|
|
56
|
-
* Search to see if your issue already exists or has even been solved previously.
|
|
57
|
-
* If you indeed have a new issue or request, click the "New Issue" button.
|
|
58
|
-
* Fill in as much of the issue template as is relevant. Please be as specific as possible.
|
|
59
|
-
Include the version of the code you were using, as well as what operating system you
|
|
60
|
-
are running. If possible, include complete, minimal example code that reproduces the problem.
|
|
61
|
-
|
|
62
|
-
## Setting up your development environment
|
|
63
|
-
|
|
64
|
-
We recommend using the [conda](https://conda.io/docs/) or [pixi](https://prefix.dev/) package managers for your Python environments.
|
|
65
|
-
Please take some time to go over the [README](https://github.com/asascience-open/xarray-subset-grid/blob/main/README.md).
|
|
66
|
-
|
|
67
|
-
Install [git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git)
|
|
68
|
-
(link with instructions) on your system if not already available
|
|
69
|
-
(check with ``git --version`` at the command line.)
|
|
70
|
-
|
|
71
|
-
Login to your [GitHub](https://github.com) account and make a fork of the
|
|
72
|
-
repository by clicking the "Fork" button.
|
|
73
|
-
Clone your fork of the repository (in terminal on Mac/Linux or git shell/GUI on Windows)
|
|
74
|
-
to the location you'd like to keep it.
|
|
75
|
-
We are partial to creating a ``git_repos`` or ``projects`` directory in our home folder.
|
|
76
|
-
|
|
77
|
-
```sh
|
|
78
|
-
git clone https://github.com/asascience-open/xarray-subset-grid.git
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
## Pull Requests
|
|
82
|
-
|
|
83
|
-
The changes to the code source (and documentation)
|
|
84
|
-
should be made via GitHub pull requests against ``main``,
|
|
85
|
-
even for those with administration rights.
|
|
86
|
-
While it's tempting to make changes directly to ``main`` and push them up,
|
|
87
|
-
it is better to make a pull request so that others can give feedback.
|
|
88
|
-
If nothing else,
|
|
89
|
-
this gives a chance for the automated tests to run on the PR.
|
|
90
|
-
This can eliminate "brown paper bag" moments with buggy commits on the main branch.
|
|
91
|
-
|
|
92
|
-
Push to your fork and submit a pull request.
|
|
93
|
-
|
|
94
|
-
## What happens after the pull request
|
|
95
|
-
|
|
96
|
-
You've made your changes, documented them, added some tests, and submitted a pull request.
|
|
97
|
-
What now?
|
|
98
|
-
|
|
99
|
-
### Code Review
|
|
100
|
-
|
|
101
|
-
At this point you're waiting on us. You should expect to hear at least a comment within a
|
|
102
|
-
couple of days. We may suggest some changes or improvements or alternatives.
|
|
103
|
-
|
|
104
|
-
Some things that will increase the chance that your pull request is accepted quickly:
|
|
105
|
-
|
|
106
|
-
* Write tests.
|
|
107
|
-
* Fix any failed lints shown by pre-commit-ci.
|
|
108
|
-
* Write a [good commit message](https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html).
|
|
109
|
-
|
|
110
|
-
Pull requests will automatically have tests run by CIs.
|
|
111
|
-
This includes running both the unit tests as well as the code linters.
|
|
112
|
-
The test suite, documentation, style, and more will be checked on various versions of Python with current and legacy packages.
|
|
113
|
-
CIs will run testing on Linux, and Mac, and Windows.
|
|
114
|
-
|
|
115
|
-
### Merging
|
|
116
|
-
|
|
117
|
-
Once we're all happy with the pull request, it's time for it to get merged in. Only the
|
|
118
|
-
maintainers can merge pull requests and you should never merge a pull request you have commits
|
|
119
|
-
on as it circumvents the code review. If this is your first or second pull request, we'll
|
|
120
|
-
likely help by rebasing and cleaning up the commit history for you. As your development skills
|
|
121
|
-
increase, we'll help you learn how to do this.
|
|
122
|
-
|
|
123
|
-
## Further Reading
|
|
124
|
-
|
|
125
|
-
There are a ton of great resources out there on contributing to open source and on the
|
|
126
|
-
importance of writing tested and maintainable software.
|
|
127
|
-
|
|
128
|
-
* [How to Contribute to Open Source Guide](https://opensource.guide/how-to-contribute/)
|
|
129
|
-
* [Zen of Scientific Software Maintenance](https://jrleeman.github.io/ScientificSoftwareMaintenance/)
|
|
1
|
+
# Contributors Guide
|
|
2
|
+
|
|
3
|
+
Interested in improving xarray-subset-grid?
|
|
4
|
+
Have a few minutes to tackle an issue? Or improve the documentation?
|
|
5
|
+
|
|
6
|
+
## Introduction
|
|
7
|
+
|
|
8
|
+
First off, thank you for considering contributing to xarray-subset-grid.
|
|
9
|
+
Following these guidelines helps to communicate that you respect the time of the developers managing and developing these open source projects.
|
|
10
|
+
In return, they should reciprocate that respect in addressing your issue,
|
|
11
|
+
assessing changes, and helping you finalize your pull requests.
|
|
12
|
+
So, please take a few minutes to read through this guide.
|
|
13
|
+
|
|
14
|
+
## What Can I Do?
|
|
15
|
+
|
|
16
|
+
* Tackle any issues you wish!
|
|
17
|
+
* Contribute code you already have. It does not need to be perfect! We will help you clean
|
|
18
|
+
things up, test it, etc.
|
|
19
|
+
* Make a tutorial or example of how to do something.
|
|
20
|
+
* Improve documentation of a feature you found troublesome.
|
|
21
|
+
* File a new issue if you run into problems!
|
|
22
|
+
|
|
23
|
+
## Ground Rules
|
|
24
|
+
|
|
25
|
+
The goal is to maintain a diverse community that's pleasant for everyone. Please
|
|
26
|
+
be considerate and respectful of others by following our
|
|
27
|
+
[code of conduct](https://github.com/ioos/.github/blob/main/CODE_OF_CONDUCT.md).
|
|
28
|
+
|
|
29
|
+
* Each pull request should consist of a logical collection of changes.
|
|
30
|
+
You can include multiple bug fixes in a single pull request,
|
|
31
|
+
but they should be related.
|
|
32
|
+
For unrelated changes, please submit multiple pull requests.
|
|
33
|
+
* Do not commit changes to files that are irrelevant to your feature or bug fix
|
|
34
|
+
(eg: .gitignore).
|
|
35
|
+
* Be willing to accept criticism and work on improving your code; we don't want
|
|
36
|
+
to break other users' code, so care must be taken not to introduce bugs.
|
|
37
|
+
* Be aware that the pull request review process is not immediate, and is
|
|
38
|
+
generally proportional to the size of the pull request.
|
|
39
|
+
* PRs with new features, or bugfixes, should not fix existing lints. The more changes in a PR, the harder it will be for the reviewer. We can always send a separate PR with the lint fix later.
|
|
40
|
+
* Avoid making the project "look like your project." We tend to make ourselves at home when writing contributions, but we should avoid renaming things just for renaming sake, moving files around to "organize" the project, or make aesthetic changes without asking the upstream devs first. Such changes, while sometimes desirable, don't bring much value to a PR but do bring extra burden to the reviewers.
|
|
41
|
+
* Do not tackle more than one issue or one feature per PR. While tempting, the smaller the PR, the easier will be to get it merged, reducing merge conflicts, without holding other PRs. Many small ones are always better than a single massive PR.
|
|
42
|
+
* Always state your PR objective clearly in the title "New Feature X", "Bug Fix Y", or "Fixing doc typo".
|
|
43
|
+
* Always add a "longer, but not too long, description of your PR in the body of the first comment.
|
|
44
|
+
* Always write meaningful, short, concise, commit messages. The kind of message your future self will congratulate you.
|
|
45
|
+
* When copying code from other places, like Stack-Overflow (SO), always add the link. That is not only a way to credit the original author of the code, but also add a way to look for the source when debugging. Also, it is not uncommon for a SO answer to be updated with better code.
|
|
46
|
+
* When using AI, also add a comment that you did! And, if possible, add the questions/chat report in a gist and link to it in the PR. While AI can be of great aid, it can also write obfuscated code that is hard to debug if you don't know it was machine generated.
|
|
47
|
+
* Be sure to search the existing issues and PRs before submitting yours. Sometimes these changes are already there and all we need is an extra person on the hill to make the final push. Be that second person and not the one that starts a new hill climb by yourself.
|
|
48
|
+
Always read the development notes when they exist, many questions are already answered there.
|
|
49
|
+
|
|
50
|
+
## Reporting a bug
|
|
51
|
+
|
|
52
|
+
The easiest way to get involved is to report issues you encounter when using IOOS Software or by
|
|
53
|
+
requesting something you think is missing.
|
|
54
|
+
|
|
55
|
+
* Head over to the project issues page.
|
|
56
|
+
* Search to see if your issue already exists or has even been solved previously.
|
|
57
|
+
* If you indeed have a new issue or request, click the "New Issue" button.
|
|
58
|
+
* Fill in as much of the issue template as is relevant. Please be as specific as possible.
|
|
59
|
+
Include the version of the code you were using, as well as what operating system you
|
|
60
|
+
are running. If possible, include complete, minimal example code that reproduces the problem.
|
|
61
|
+
|
|
62
|
+
## Setting up your development environment
|
|
63
|
+
|
|
64
|
+
We recommend using the [conda](https://conda.io/docs/) or [pixi](https://prefix.dev/) package managers for your Python environments.
|
|
65
|
+
Please take some time to go over the [README](https://github.com/asascience-open/xarray-subset-grid/blob/main/README.md).
|
|
66
|
+
|
|
67
|
+
Install [git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git)
|
|
68
|
+
(link with instructions) on your system if not already available
|
|
69
|
+
(check with ``git --version`` at the command line.)
|
|
70
|
+
|
|
71
|
+
Login to your [GitHub](https://github.com) account and make a fork of the
|
|
72
|
+
repository by clicking the "Fork" button.
|
|
73
|
+
Clone your fork of the repository (in terminal on Mac/Linux or git shell/GUI on Windows)
|
|
74
|
+
to the location you'd like to keep it.
|
|
75
|
+
We are partial to creating a ``git_repos`` or ``projects`` directory in our home folder.
|
|
76
|
+
|
|
77
|
+
```sh
|
|
78
|
+
git clone https://github.com/asascience-open/xarray-subset-grid.git
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Pull Requests
|
|
82
|
+
|
|
83
|
+
The changes to the code source (and documentation)
|
|
84
|
+
should be made via GitHub pull requests against ``main``,
|
|
85
|
+
even for those with administration rights.
|
|
86
|
+
While it's tempting to make changes directly to ``main`` and push them up,
|
|
87
|
+
it is better to make a pull request so that others can give feedback.
|
|
88
|
+
If nothing else,
|
|
89
|
+
this gives a chance for the automated tests to run on the PR.
|
|
90
|
+
This can eliminate "brown paper bag" moments with buggy commits on the main branch.
|
|
91
|
+
|
|
92
|
+
Push to your fork and submit a pull request.
|
|
93
|
+
|
|
94
|
+
## What happens after the pull request
|
|
95
|
+
|
|
96
|
+
You've made your changes, documented them, added some tests, and submitted a pull request.
|
|
97
|
+
What now?
|
|
98
|
+
|
|
99
|
+
### Code Review
|
|
100
|
+
|
|
101
|
+
At this point you're waiting on us. You should expect to hear at least a comment within a
|
|
102
|
+
couple of days. We may suggest some changes or improvements or alternatives.
|
|
103
|
+
|
|
104
|
+
Some things that will increase the chance that your pull request is accepted quickly:
|
|
105
|
+
|
|
106
|
+
* Write tests.
|
|
107
|
+
* Fix any failed lints shown by pre-commit-ci.
|
|
108
|
+
* Write a [good commit message](https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html).
|
|
109
|
+
|
|
110
|
+
Pull requests will automatically have tests run by CIs.
|
|
111
|
+
This includes running both the unit tests as well as the code linters.
|
|
112
|
+
The test suite, documentation, style, and more will be checked on various versions of Python with current and legacy packages.
|
|
113
|
+
CIs will run testing on Linux, and Mac, and Windows.
|
|
114
|
+
|
|
115
|
+
### Merging
|
|
116
|
+
|
|
117
|
+
Once we're all happy with the pull request, it's time for it to get merged in. Only the
|
|
118
|
+
maintainers can merge pull requests and you should never merge a pull request you have commits
|
|
119
|
+
on as it circumvents the code review. If this is your first or second pull request, we'll
|
|
120
|
+
likely help by rebasing and cleaning up the commit history for you. As your development skills
|
|
121
|
+
increase, we'll help you learn how to do this.
|
|
122
|
+
|
|
123
|
+
## Further Reading
|
|
124
|
+
|
|
125
|
+
There are a ton of great resources out there on contributing to open source and on the
|
|
126
|
+
importance of writing tested and maintainable software.
|
|
127
|
+
|
|
128
|
+
* [How to Contribute to Open Source Guide](https://opensource.guide/how-to-contribute/)
|
|
129
|
+
* [Zen of Scientific Software Maintenance](https://jrleeman.github.io/ScientificSoftwareMaintenance/)
|
|
@@ -1,17 +1,15 @@
|
|
|
1
|
-
Development notes:
|
|
2
|
-
|
|
3
|
-
Various notes you want to know when working on this code.
|
|
4
|
-
|
|
5
|
-
Data Structures:
|
|
6
|
-
|
|
7
|
-
Polygons:
|
|
8
|
-
|
|
9
|
-
Defined as an Nx2 array of (lon, lat) float64
|
|
10
|
-
|
|
11
|
-
First point is not repeated.
|
|
12
|
-
|
|
13
|
-
Bounding Box:
|
|
14
|
-
|
|
15
|
-
A tuple of floats: (min_lon, min_lat, max_lon, max_lat).
|
|
16
|
-
|
|
17
|
-
|
|
1
|
+
Development notes:
|
|
2
|
+
|
|
3
|
+
Various notes you want to know when working on this code.
|
|
4
|
+
|
|
5
|
+
Data Structures:
|
|
6
|
+
|
|
7
|
+
Polygons:
|
|
8
|
+
|
|
9
|
+
Defined as an Nx2 array of (lon, lat) float64
|
|
10
|
+
|
|
11
|
+
First point is not repeated.
|
|
12
|
+
|
|
13
|
+
Bounding Box:
|
|
14
|
+
|
|
15
|
+
A tuple of floats: (min_lon, min_lat, max_lon, max_lat).
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
BSD 3-Clause License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2024, Applied Science Associates
|
|
4
|
-
|
|
5
|
-
Redistribution and use in source and binary forms, with or without
|
|
6
|
-
modification, are permitted provided that the following conditions are met:
|
|
7
|
-
|
|
8
|
-
1. Redistributions of source code must retain the above copyright notice, this
|
|
9
|
-
list of conditions and the following disclaimer.
|
|
10
|
-
|
|
11
|
-
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
12
|
-
this list of conditions and the following disclaimer in the documentation
|
|
13
|
-
and/or other materials provided with the distribution.
|
|
14
|
-
|
|
15
|
-
3. Neither the name of the copyright holder nor the names of its
|
|
16
|
-
contributors may be used to endorse or promote products derived from
|
|
17
|
-
this software without specific prior written permission.
|
|
18
|
-
|
|
19
|
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
20
|
-
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
21
|
-
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
22
|
-
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
23
|
-
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
24
|
-
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
25
|
-
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
26
|
-
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
27
|
-
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
28
|
-
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
1
|
+
BSD 3-Clause License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024, Applied Science Associates
|
|
4
|
+
|
|
5
|
+
Redistribution and use in source and binary forms, with or without
|
|
6
|
+
modification, are permitted provided that the following conditions are met:
|
|
7
|
+
|
|
8
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
9
|
+
list of conditions and the following disclaimer.
|
|
10
|
+
|
|
11
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
12
|
+
this list of conditions and the following disclaimer in the documentation
|
|
13
|
+
and/or other materials provided with the distribution.
|
|
14
|
+
|
|
15
|
+
3. Neither the name of the copyright holder nor the names of its
|
|
16
|
+
contributors may be used to endorse or promote products derived from
|
|
17
|
+
this software without specific prior written permission.
|
|
18
|
+
|
|
19
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
20
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
21
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
22
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
23
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
24
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
25
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
26
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
27
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
28
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
include *.txt
|
|
2
|
+
include README.md
|
|
3
|
+
include pyproject.toml
|
|
4
|
+
|
|
5
|
+
graft xarray_subset_grid
|
|
6
|
+
|
|
7
|
+
prune .github
|
|
8
|
+
prune *.egg-info
|
|
9
|
+
prune docs
|
|
10
|
+
prune tests
|
|
11
|
+
|
|
12
|
+
exclude .gitignore
|
|
13
|
+
exclude .pre-commit-config.yaml
|
|
14
|
+
exclude *.yml
|
|
15
|
+
exclude xarray_subset_grid/_version.py
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
|
-
Name:
|
|
3
|
-
Version: 0.
|
|
2
|
+
Name: xarray-subset-grid
|
|
3
|
+
Version: 0.1.1
|
|
4
4
|
Summary: Subset Xarray datasets in time and space
|
|
5
5
|
Author-email: Matthew Iannucci <matt.iannucci@tetratech.com>, "Christopher H. Barker" <chris.barker@noaa.gov>
|
|
6
6
|
License: BSD 3-Clause License
|
|
@@ -32,42 +32,42 @@ License: BSD 3-Clause License
|
|
|
32
32
|
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
33
33
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
34
34
|
|
|
35
|
-
Project-URL: Homepage, https://github.com/
|
|
35
|
+
Project-URL: Homepage, https://github.com/ioos/xarray-subset-grid/
|
|
36
36
|
Keywords: xarray
|
|
37
37
|
Classifier: Development Status :: 5 - Production/Stable
|
|
38
38
|
Classifier: Intended Audience :: Science/Research
|
|
39
|
-
Classifier: Operating System :: OS Independent
|
|
40
39
|
Classifier: License :: OSI Approved :: BSD License
|
|
40
|
+
Classifier: Operating System :: OS Independent
|
|
41
41
|
Classifier: Programming Language :: Python
|
|
42
|
-
Classifier: Programming Language :: Python :: 3
|
|
42
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
43
43
|
Classifier: Programming Language :: Python :: 3.10
|
|
44
44
|
Classifier: Programming Language :: Python :: 3.11
|
|
45
45
|
Classifier: Programming Language :: Python :: 3.12
|
|
46
46
|
Classifier: Programming Language :: Python :: 3.13
|
|
47
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
47
48
|
Classifier: Topic :: Scientific/Engineering
|
|
48
49
|
Requires-Python: >=3.10
|
|
49
50
|
Description-Content-Type: text/markdown
|
|
50
51
|
License-File: LICENSE
|
|
51
|
-
Requires-Dist:
|
|
52
|
-
Requires-Dist: xarray>=2024.6
|
|
53
|
-
Requires-Dist: cf_xarray
|
|
52
|
+
Requires-Dist: cf-xarray
|
|
54
53
|
Requires-Dist: cftime
|
|
55
54
|
Requires-Dist: dask
|
|
56
55
|
Requires-Dist: netcdf4
|
|
56
|
+
Requires-Dist: numpy
|
|
57
|
+
Requires-Dist: xarray>=2024.6
|
|
57
58
|
Provides-Extra: dev
|
|
58
|
-
Requires-Dist: ruff; extra == "dev"
|
|
59
59
|
Requires-Dist: pre-commit; extra == "dev"
|
|
60
|
-
Requires-Dist: pyright; extra == "dev"
|
|
61
60
|
Requires-Dist: pytest; extra == "dev"
|
|
62
61
|
Requires-Dist: pytest-cov; extra == "dev"
|
|
62
|
+
Requires-Dist: ruff; extra == "dev"
|
|
63
63
|
Requires-Dist: sphinx; extra == "dev"
|
|
64
64
|
Requires-Dist: sphinx-rtd-theme; extra == "dev"
|
|
65
65
|
Provides-Extra: examples
|
|
66
66
|
Requires-Dist: fsspec; extra == "examples"
|
|
67
|
-
Requires-Dist: s3fs; extra == "examples"
|
|
68
|
-
Requires-Dist: zarr; extra == "examples"
|
|
69
|
-
Requires-Dist: matplotlib; extra == "examples"
|
|
70
67
|
Requires-Dist: h5netcdf; extra == "examples"
|
|
68
|
+
Requires-Dist: matplotlib; extra == "examples"
|
|
69
|
+
Requires-Dist: s3fs; extra == "examples"
|
|
70
|
+
Requires-Dist: zarr<3; extra == "examples"
|
|
71
71
|
Dynamic: license-file
|
|
72
72
|
|
|
73
73
|
# xarray-subset-grid
|
|
@@ -78,36 +78,42 @@ Subset Xarray datasets in space while retaining the original grid for complex gr
|
|
|
78
78
|
|
|
79
79
|
### `pip compatible`
|
|
80
80
|
|
|
81
|
-
This package is
|
|
81
|
+
This package is available on pypi:
|
|
82
82
|
|
|
83
83
|
```
|
|
84
|
-
pip install
|
|
84
|
+
python -m pip install xarray-subset-grid
|
|
85
85
|
```
|
|
86
86
|
|
|
87
|
-
|
|
87
|
+
And also on conda-forge:
|
|
88
|
+
|
|
89
|
+
```
|
|
90
|
+
conda install -c conda-forge xarray-subset-grid
|
|
91
|
+
```
|
|
88
92
|
|
|
89
93
|
## Usage
|
|
90
94
|
|
|
91
|
-
This package is designed to be used in
|
|
95
|
+
This package is designed to be used in conjunction with [`xarray`](https://xarray.dev/). Given a [CF Compliant](https://cfconventions.org/) `xarray` dataset named `ds`, this package can be accessed using the `xsg` accessor:
|
|
92
96
|
|
|
93
97
|
```python
|
|
94
98
|
# Get the interprested grid class
|
|
95
99
|
grid = ds.xsg
|
|
96
100
|
|
|
97
101
|
# subset to only include temperature
|
|
98
|
-
ds_temp = ds.xsg.subset_vars([
|
|
102
|
+
ds_temp = ds.xsg.subset_vars(["temp"])
|
|
99
103
|
|
|
100
104
|
# subset by bounding box
|
|
101
105
|
ds_subset_bbox = ds.xsg.subset_bbox([-72, 32, -70, 35])
|
|
102
106
|
|
|
103
107
|
# or by polygon
|
|
104
|
-
poly = np.array(
|
|
105
|
-
[
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
]
|
|
108
|
+
poly = np.array(
|
|
109
|
+
[
|
|
110
|
+
[-72, 32],
|
|
111
|
+
[-72, 33],
|
|
112
|
+
[-73, 33],
|
|
113
|
+
[-73, 31],
|
|
114
|
+
[-72, 32],
|
|
115
|
+
]
|
|
116
|
+
)
|
|
111
117
|
ds_subset_poly = ds.xsg.subset_polygon(poly)
|
|
112
118
|
```
|
|
113
119
|
|
|
@@ -130,7 +136,7 @@ Then install the project in local edit mode:
|
|
|
130
136
|
pip install -e .
|
|
131
137
|
```
|
|
132
138
|
|
|
133
|
-
Once installed, the tests can be run:
|
|
139
|
+
Once installed, the tests can be run:
|
|
134
140
|
|
|
135
141
|
```bash
|
|
136
142
|
python -m pytest
|
|
@@ -151,10 +157,11 @@ There are three "environments" set up for pixi:
|
|
|
151
157
|
- `dev`
|
|
152
158
|
- `examples`
|
|
153
159
|
|
|
154
|
-
And
|
|
160
|
+
And three "tasks":
|
|
155
161
|
|
|
156
162
|
- `lint`
|
|
157
|
-
- `test`
|
|
163
|
+
- `test` : run most of the tests
|
|
164
|
+
- `test_all` : run the tests that access AWS -- i.e. download data directly.
|
|
158
165
|
|
|
159
166
|
To run the tests in an isolated environment:
|
|
160
167
|
|
|
@@ -162,25 +169,26 @@ To run the tests in an isolated environment:
|
|
|
162
169
|
pixi run -e dev test
|
|
163
170
|
```
|
|
164
171
|
|
|
165
|
-
|
|
166
|
-
|
|
172
|
+
Or with a specific python version:
|
|
167
173
|
```bash
|
|
168
|
-
pixi
|
|
174
|
+
pixi run -e test312 test
|
|
169
175
|
```
|
|
170
176
|
|
|
171
|
-
|
|
177
|
+
Options are: `test310` `test311` `test312` `test313`
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
To run a shell to do dev work:
|
|
172
181
|
|
|
173
182
|
```bash
|
|
174
|
-
pixi shell -e
|
|
183
|
+
pixi shell -e dev
|
|
175
184
|
```
|
|
176
185
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
To run a shell in which you can run the examples:
|
|
186
|
+
To run a shell in which you can run the examples (notebooks and al that):
|
|
180
187
|
|
|
181
188
|
```bash
|
|
182
189
|
pixi shell -e examples
|
|
183
190
|
```
|
|
191
|
+
|
|
184
192
|
To run a shell with everything (dev and example deps:
|
|
185
193
|
|
|
186
194
|
```bash
|