xarray-subset-grid 0.0.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/.gitattributes +3 -0
- xarray_subset_grid-0.0.1/.github/workflows/test.yaml +50 -0
- xarray_subset_grid-0.0.1/.gitignore +168 -0
- xarray_subset_grid-0.0.1/.readthedocs.yaml +13 -0
- xarray_subset_grid-0.0.1/CONTRIBUTING.md +129 -0
- xarray_subset_grid-0.0.1/DevelopmentNotes.txt +17 -0
- xarray_subset_grid-0.0.1/LICENSE +28 -0
- xarray_subset_grid-0.0.1/PKG-INFO +212 -0
- xarray_subset_grid-0.0.1/README.md +140 -0
- xarray_subset_grid-0.0.1/conda_requirements.txt +23 -0
- xarray_subset_grid-0.0.1/conda_requirements_dev.txt +14 -0
- xarray_subset_grid-0.0.1/docs/Makefile +20 -0
- xarray_subset_grid-0.0.1/docs/conf.py +62 -0
- xarray_subset_grid-0.0.1/docs/contributing.rst +173 -0
- xarray_subset_grid-0.0.1/docs/design.rst +36 -0
- xarray_subset_grid-0.0.1/docs/examples/.gitignore +1 -0
- xarray_subset_grid-0.0.1/docs/examples/README.md +7 -0
- xarray_subset_grid-0.0.1/docs/examples/RegularGridTHREDDS.ipynb +194 -0
- 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 +8404 -0
- xarray_subset_grid-0.0.1/docs/examples/fvcom_3d.ipynb +10676 -0
- xarray_subset_grid-0.0.1/docs/examples/gfs_opendap.ipynb +18922 -0
- xarray_subset_grid-0.0.1/docs/examples/nam_opendap.ipynb +12953 -0
- xarray_subset_grid-0.0.1/docs/examples/regular_grid_2d.ipynb +1506 -0
- xarray_subset_grid-0.0.1/docs/examples/roms-compare.ipynb +244 -0
- xarray_subset_grid-0.0.1/docs/examples/roms.ipynb +331 -0
- xarray_subset_grid-0.0.1/docs/examples/roms_3d.ipynb +7483 -0
- xarray_subset_grid-0.0.1/docs/examples/rtofs.ipynb +4812 -0
- xarray_subset_grid-0.0.1/docs/examples/selfe.ipynb +7741 -0
- xarray_subset_grid-0.0.1/docs/examples/sscofs.ipynb +3941 -0
- xarray_subset_grid-0.0.1/docs/examples/stofs_2d.ipynb +3861 -0
- xarray_subset_grid-0.0.1/docs/examples/stofs_3d.ipynb +7860 -0
- xarray_subset_grid-0.0.1/docs/examples/subset_file.py +112 -0
- xarray_subset_grid-0.0.1/docs/examples/subset_from_ncfile.ipynb +1358 -0
- xarray_subset_grid-0.0.1/docs/grids.rst +34 -0
- xarray_subset_grid-0.0.1/docs/index.rst +19 -0
- xarray_subset_grid-0.0.1/docs/installation.rst +94 -0
- xarray_subset_grid-0.0.1/docs/make.bat +35 -0
- xarray_subset_grid-0.0.1/docs/notebooks.rst +22 -0
- xarray_subset_grid-0.0.1/docs/requirements.txt +8 -0
- xarray_subset_grid-0.0.1/pixi.lock +26820 -0
- xarray_subset_grid-0.0.1/profiling/README.md +2 -0
- xarray_subset_grid-0.0.1/profiling/STOFS_benchmarks.py +45 -0
- xarray_subset_grid-0.0.1/profiling/p_in_p_perf.py +119 -0
- xarray_subset_grid-0.0.1/pyproject.toml +158 -0
- xarray_subset_grid-0.0.1/setup.cfg +4 -0
- xarray_subset_grid-0.0.1/tests/__init__.py +0 -0
- xarray_subset_grid-0.0.1/tests/conftest.py +38 -0
- 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 +210 -0
- xarray_subset_grid-0.0.1/tests/test_grids/test_sgrid.py +118 -0
- xarray_subset_grid-0.0.1/tests/test_grids/test_ugrid.py +597 -0
- xarray_subset_grid-0.0.1/tests/test_utils.py +125 -0
- xarray_subset_grid-0.0.1/tests/test_visualization/.gitignore +1 -0
- 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 +1 -0
- xarray_subset_grid-0.0.1/tests/test_visualization/test_mpl_plotting.py +83 -0
- xarray_subset_grid-0.0.1/xarray_subset_grid/__init__.py +10 -0
- xarray_subset_grid-0.0.1/xarray_subset_grid/_version.py +21 -0
- xarray_subset_grid-0.0.1/xarray_subset_grid/accessor.py +185 -0
- xarray_subset_grid-0.0.1/xarray_subset_grid/grid.py +208 -0
- xarray_subset_grid-0.0.1/xarray_subset_grid/grids/__init__.py +6 -0
- xarray_subset_grid-0.0.1/xarray_subset_grid/grids/fvcom_grid.py +139 -0
- xarray_subset_grid-0.0.1/xarray_subset_grid/grids/regular_grid.py +138 -0
- xarray_subset_grid-0.0.1/xarray_subset_grid/grids/regular_grid_2d.py +95 -0
- xarray_subset_grid-0.0.1/xarray_subset_grid/grids/selfe_grid.py +87 -0
- xarray_subset_grid-0.0.1/xarray_subset_grid/grids/sgrid.py +226 -0
- xarray_subset_grid-0.0.1/xarray_subset_grid/grids/ugrid.py +493 -0
- xarray_subset_grid-0.0.1/xarray_subset_grid/selector.py +69 -0
- xarray_subset_grid-0.0.1/xarray_subset_grid/utils.py +153 -0
- xarray_subset_grid-0.0.1/xarray_subset_grid/visualization/mpl_plotting.py +185 -0
- xarray_subset_grid-0.0.1/xarray_subset_grid.egg-info/PKG-INFO +212 -0
- xarray_subset_grid-0.0.1/xarray_subset_grid.egg-info/SOURCES.txt +89 -0
- xarray_subset_grid-0.0.1/xarray_subset_grid.egg-info/dependency_links.txt +1 -0
- xarray_subset_grid-0.0.1/xarray_subset_grid.egg-info/requires.txt +22 -0
- xarray_subset_grid-0.0.1/xarray_subset_grid.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
name: test
|
|
5
|
+
|
|
6
|
+
on: [push, pull_request]
|
|
7
|
+
|
|
8
|
+
env:
|
|
9
|
+
PIXI_VERSION: v0.47.0
|
|
10
|
+
|
|
11
|
+
# # Gave up -- could not figure out how to use environment variables :-(
|
|
12
|
+
# env:
|
|
13
|
+
# # I got these from: https://github.com/prefix-dev/setup-pixi/blob/main/README.md
|
|
14
|
+
# # they seem to keep it pretty up to date
|
|
15
|
+
# SETUP_PIXI_VERSION: v0.8.1
|
|
16
|
+
# PIXI_VERSION: v0.29.0
|
|
17
|
+
|
|
18
|
+
jobs:
|
|
19
|
+
test:
|
|
20
|
+
runs-on: ${{ matrix.os }}
|
|
21
|
+
strategy:
|
|
22
|
+
fail-fast: false
|
|
23
|
+
matrix:
|
|
24
|
+
os: ["ubuntu-latest", "windows-latest", "macos-latest"]
|
|
25
|
+
environment: [test310, test311, test312, test313]
|
|
26
|
+
steps:
|
|
27
|
+
- uses: actions/checkout@v4
|
|
28
|
+
- uses: prefix-dev/setup-pixi@v0.8.8
|
|
29
|
+
with:
|
|
30
|
+
pixi-version: latest
|
|
31
|
+
cache: true
|
|
32
|
+
# auth-host: prefix.dev
|
|
33
|
+
# auth-token: ${{ secrets.PREFIX_DEV_TOKEN }}
|
|
34
|
+
- run: pixi run --environment ${{ matrix.environment }} test
|
|
35
|
+
lint:
|
|
36
|
+
runs-on: ubuntu-latest
|
|
37
|
+
strategy:
|
|
38
|
+
fail-fast: false
|
|
39
|
+
steps:
|
|
40
|
+
- uses: actions/checkout@v4
|
|
41
|
+
- uses: prefix-dev/setup-pixi@v0.8.8
|
|
42
|
+
with:
|
|
43
|
+
pixi-version: latest
|
|
44
|
+
cache: true
|
|
45
|
+
# auth-host: prefix.dev
|
|
46
|
+
# auth-token: ${{ secrets.PREFIX_DEV_TOKEN }}
|
|
47
|
+
- run: pixi run --environment test310 lint
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# PyInstaller
|
|
30
|
+
# Usually these files are written by a python script from a template
|
|
31
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
32
|
+
*.manifest
|
|
33
|
+
*.spec
|
|
34
|
+
|
|
35
|
+
# Installer logs
|
|
36
|
+
pip-log.txt
|
|
37
|
+
pip-delete-this-directory.txt
|
|
38
|
+
|
|
39
|
+
# Unit test / coverage reports
|
|
40
|
+
htmlcov/
|
|
41
|
+
.tox/
|
|
42
|
+
.nox/
|
|
43
|
+
.coverage
|
|
44
|
+
.coverage.*
|
|
45
|
+
.cache
|
|
46
|
+
nosetests.xml
|
|
47
|
+
coverage.xml
|
|
48
|
+
*.cover
|
|
49
|
+
*.py,cover
|
|
50
|
+
.hypothesis/
|
|
51
|
+
.pytest_cache/
|
|
52
|
+
cover/
|
|
53
|
+
|
|
54
|
+
# Translations
|
|
55
|
+
*.mo
|
|
56
|
+
*.pot
|
|
57
|
+
|
|
58
|
+
# Django stuff:
|
|
59
|
+
*.log
|
|
60
|
+
local_settings.py
|
|
61
|
+
db.sqlite3
|
|
62
|
+
db.sqlite3-journal
|
|
63
|
+
|
|
64
|
+
# Flask stuff:
|
|
65
|
+
instance/
|
|
66
|
+
.webassets-cache
|
|
67
|
+
|
|
68
|
+
# Scrapy stuff:
|
|
69
|
+
.scrapy
|
|
70
|
+
|
|
71
|
+
# Sphinx documentation
|
|
72
|
+
docs/_build/
|
|
73
|
+
docs/jupyter_execute
|
|
74
|
+
|
|
75
|
+
# PyBuilder
|
|
76
|
+
.pybuilder/
|
|
77
|
+
target/
|
|
78
|
+
|
|
79
|
+
# Jupyter Notebook
|
|
80
|
+
.ipynb_checkpoints
|
|
81
|
+
|
|
82
|
+
# IPython
|
|
83
|
+
profile_default/
|
|
84
|
+
ipython_config.py
|
|
85
|
+
|
|
86
|
+
# pyenv
|
|
87
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
88
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
89
|
+
# .python-version
|
|
90
|
+
|
|
91
|
+
# pipenv
|
|
92
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
93
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
94
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
95
|
+
# install all needed dependencies.
|
|
96
|
+
#Pipfile.lock
|
|
97
|
+
|
|
98
|
+
# poetry
|
|
99
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
100
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
101
|
+
# commonly ignored for libraries.
|
|
102
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
103
|
+
#poetry.lock
|
|
104
|
+
|
|
105
|
+
# pdm
|
|
106
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
107
|
+
#pdm.lock
|
|
108
|
+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
|
109
|
+
# in version control.
|
|
110
|
+
# https://pdm.fming.dev/#use-with-ide
|
|
111
|
+
.pdm.toml
|
|
112
|
+
|
|
113
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
114
|
+
__pypackages__/
|
|
115
|
+
|
|
116
|
+
# Celery stuff
|
|
117
|
+
celerybeat-schedule
|
|
118
|
+
celerybeat.pid
|
|
119
|
+
|
|
120
|
+
# SageMath parsed files
|
|
121
|
+
*.sage.py
|
|
122
|
+
|
|
123
|
+
# Environments
|
|
124
|
+
.env
|
|
125
|
+
.venv
|
|
126
|
+
env/
|
|
127
|
+
venv/
|
|
128
|
+
ENV/
|
|
129
|
+
env.bak/
|
|
130
|
+
venv.bak/
|
|
131
|
+
|
|
132
|
+
# Spyder project settings
|
|
133
|
+
.spyderproject
|
|
134
|
+
.spyproject
|
|
135
|
+
|
|
136
|
+
# Rope project settings
|
|
137
|
+
.ropeproject
|
|
138
|
+
|
|
139
|
+
# mkdocs documentation
|
|
140
|
+
/site
|
|
141
|
+
|
|
142
|
+
# mypy
|
|
143
|
+
.mypy_cache/
|
|
144
|
+
.dmypy.json
|
|
145
|
+
dmypy.json
|
|
146
|
+
|
|
147
|
+
# Pyre type checker
|
|
148
|
+
.pyre/
|
|
149
|
+
|
|
150
|
+
# pytype static type analyzer
|
|
151
|
+
.pytype/
|
|
152
|
+
|
|
153
|
+
# Cython debug symbols
|
|
154
|
+
cython_debug/
|
|
155
|
+
|
|
156
|
+
# PyCharm
|
|
157
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
158
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
159
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
160
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
161
|
+
#.idea/
|
|
162
|
+
|
|
163
|
+
xarray_subset_grid/_version.py
|
|
164
|
+
# pixi environments
|
|
165
|
+
.pixi
|
|
166
|
+
*.egg-info
|
|
167
|
+
|
|
168
|
+
.ruff_cache/
|
|
@@ -0,0 +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/)
|
|
@@ -0,0 +1,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).
|
|
16
|
+
|
|
17
|
+
|
|
@@ -0,0 +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.
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: xarray_subset_grid
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: Subset Xarray datasets in time and space
|
|
5
|
+
Author-email: Matthew Iannucci <matt.iannucci@tetratech.com>, "Christopher H. Barker" <chris.barker@noaa.gov>
|
|
6
|
+
License: BSD 3-Clause License
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2024, Applied Science Associates
|
|
9
|
+
|
|
10
|
+
Redistribution and use in source and binary forms, with or without
|
|
11
|
+
modification, are permitted provided that the following conditions are met:
|
|
12
|
+
|
|
13
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
14
|
+
list of conditions and the following disclaimer.
|
|
15
|
+
|
|
16
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
17
|
+
this list of conditions and the following disclaimer in the documentation
|
|
18
|
+
and/or other materials provided with the distribution.
|
|
19
|
+
|
|
20
|
+
3. Neither the name of the copyright holder nor the names of its
|
|
21
|
+
contributors may be used to endorse or promote products derived from
|
|
22
|
+
this software without specific prior written permission.
|
|
23
|
+
|
|
24
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
25
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
26
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
27
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
28
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
29
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
30
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
31
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
32
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
33
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
34
|
+
|
|
35
|
+
Project-URL: Homepage, https://github.com/asascience-open/xarray-subset-grid
|
|
36
|
+
Keywords: xarray
|
|
37
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
38
|
+
Classifier: Intended Audience :: Science/Research
|
|
39
|
+
Classifier: Operating System :: OS Independent
|
|
40
|
+
Classifier: License :: OSI Approved :: BSD License
|
|
41
|
+
Classifier: Programming Language :: Python
|
|
42
|
+
Classifier: Programming Language :: Python :: 3
|
|
43
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
44
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
45
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
46
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
47
|
+
Classifier: Topic :: Scientific/Engineering
|
|
48
|
+
Requires-Python: >=3.10
|
|
49
|
+
Description-Content-Type: text/markdown
|
|
50
|
+
License-File: LICENSE
|
|
51
|
+
Requires-Dist: numpy
|
|
52
|
+
Requires-Dist: xarray>=2024.6
|
|
53
|
+
Requires-Dist: cf_xarray
|
|
54
|
+
Requires-Dist: cftime
|
|
55
|
+
Requires-Dist: dask
|
|
56
|
+
Requires-Dist: netcdf4
|
|
57
|
+
Provides-Extra: dev
|
|
58
|
+
Requires-Dist: ruff; extra == "dev"
|
|
59
|
+
Requires-Dist: pre-commit; extra == "dev"
|
|
60
|
+
Requires-Dist: pyright; extra == "dev"
|
|
61
|
+
Requires-Dist: pytest; extra == "dev"
|
|
62
|
+
Requires-Dist: pytest-cov; extra == "dev"
|
|
63
|
+
Requires-Dist: sphinx; extra == "dev"
|
|
64
|
+
Requires-Dist: sphinx-rtd-theme; extra == "dev"
|
|
65
|
+
Provides-Extra: examples
|
|
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
|
+
Requires-Dist: h5netcdf; extra == "examples"
|
|
71
|
+
Dynamic: license-file
|
|
72
|
+
|
|
73
|
+
# xarray-subset-grid
|
|
74
|
+
|
|
75
|
+
Subset Xarray datasets in space while retaining the original grid for complex grid systems.
|
|
76
|
+
|
|
77
|
+
## Installation
|
|
78
|
+
|
|
79
|
+
### `pip compatible`
|
|
80
|
+
|
|
81
|
+
This package is not yet released on pypi, for now install using git:
|
|
82
|
+
|
|
83
|
+
```
|
|
84
|
+
pip install xarray_subset_grid@git+https://github.com/asascience-open/xarray-subset-grid.git
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Or clone the project from git and build / install it from there.
|
|
88
|
+
|
|
89
|
+
## Usage
|
|
90
|
+
|
|
91
|
+
This package is designed to be used in conjuction 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
|
+
|
|
93
|
+
```python
|
|
94
|
+
# Get the interprested grid class
|
|
95
|
+
grid = ds.xsg
|
|
96
|
+
|
|
97
|
+
# subset to only include temperature
|
|
98
|
+
ds_temp = ds.xsg.subset_vars(['temp'])
|
|
99
|
+
|
|
100
|
+
# subset by bounding box
|
|
101
|
+
ds_subset_bbox = ds.xsg.subset_bbox([-72, 32, -70, 35])
|
|
102
|
+
|
|
103
|
+
# or by polygon
|
|
104
|
+
poly = np.array([
|
|
105
|
+
[-72, 32],
|
|
106
|
+
[-72, 33],
|
|
107
|
+
[-73, 33],
|
|
108
|
+
[-73, 31],
|
|
109
|
+
[-72, 32],
|
|
110
|
+
])
|
|
111
|
+
ds_subset_poly = ds.xsg.subset_polygon(poly)
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
For full usage, see the [example notebooks](./examples/)
|
|
115
|
+
|
|
116
|
+
## Development
|
|
117
|
+
|
|
118
|
+
### `pip compatible`
|
|
119
|
+
|
|
120
|
+
First, create a new `virtualenv` and activate it:
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
python -m venv venv
|
|
124
|
+
source venv/bin.activate
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Then install the project in local edit mode:
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
pip install -e .
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
Once installed, the tests can be run:
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
python -m pytest
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
Or alternatively run the notebooks in the same `virtualenv`
|
|
140
|
+
|
|
141
|
+
### `pixi`
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
Learn about `pixi` here: https://prefix.dev/
|
|
145
|
+
|
|
146
|
+
See the pixi docs for details, but for this setup:
|
|
147
|
+
|
|
148
|
+
There are three "environments" set up for pixi:
|
|
149
|
+
|
|
150
|
+
- `default`
|
|
151
|
+
- `dev`
|
|
152
|
+
- `examples`
|
|
153
|
+
|
|
154
|
+
And two "tasks":
|
|
155
|
+
|
|
156
|
+
- `lint`
|
|
157
|
+
- `test`
|
|
158
|
+
|
|
159
|
+
To run the tests in an isolated environment:
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
pixi run -e dev test
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
To run a shell to do dev work:
|
|
166
|
+
|
|
167
|
+
```bash
|
|
168
|
+
pixi shell -e dev
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
If you want to run the examples (notebooks and al that):
|
|
172
|
+
|
|
173
|
+
```bash
|
|
174
|
+
pixi shell -e all
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
That will set up a conda environment with all the develop dependencies.
|
|
178
|
+
|
|
179
|
+
To run a shell in which you can run the examples:
|
|
180
|
+
|
|
181
|
+
```bash
|
|
182
|
+
pixi shell -e examples
|
|
183
|
+
```
|
|
184
|
+
To run a shell with everything (dev and example deps:
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
pixi shell -e all
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
Finally, to when the `pyproject.toml` is updated, be sure to update the `pixi` lockfile:
|
|
191
|
+
|
|
192
|
+
```bash
|
|
193
|
+
pixi install
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
### `conda`
|
|
197
|
+
|
|
198
|
+
If you are using (or want to use) conda, you can install the dependencies with:
|
|
199
|
+
|
|
200
|
+
```
|
|
201
|
+
conda install --file conda_requirements.txt
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
That will get you the full set, including what you need to run the examples, etc.
|
|
205
|
+
|
|
206
|
+
If you need the development tools, you can also install:
|
|
207
|
+
|
|
208
|
+
```
|
|
209
|
+
conda install --file conda_requirements_dev.txt
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
(requirements should all be on the conda-forge channel)
|