-
Notifications
You must be signed in to change notification settings - Fork 41
add cf.grid_mapping_names
#391
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
60 commits
Select commit
Hold shift + click to select a range
5b0af86
added grid_mapping attribute
larsbuntemeyer 015f19e
added get_grid_mapping_name function
larsbuntemeyer 9192470
updated rotds with grid_mapping
larsbuntemeyer 3f72bdc
renamed dummy variable
larsbuntemeyer 9ae838a
updated grid mapping scalar
larsbuntemeyer 252f8bf
update repr tests and rotds dims
larsbuntemeyer 19224af
api docs update
larsbuntemeyer 400e3dd
updated examples in grid_mappings docstring
larsbuntemeyer ab08961
added references
larsbuntemeyer 824b929
remove zero dim from rotds
larsbuntemeyer f165325
format fix
larsbuntemeyer ea53b0b
added basic grid mappings section in docs
larsbuntemeyer b9cd3fe
update section
larsbuntemeyer 2f09483
update docs section
larsbuntemeyer 82d7b7c
added grid_mappgin to associated variables
larsbuntemeyer b0f796f
added grid_mapping accessor tests
larsbuntemeyer 88d8c95
updated docs section
larsbuntemeyer 6f03e4b
syntax fix
larsbuntemeyer 37f27b8
eval-rst
larsbuntemeyer 2615635
typo
larsbuntemeyer e2b18a6
fix eval-rst
larsbuntemeyer 576f31c
polish
larsbuntemeyer a960700
Update cf_xarray/accessor.py
larsbuntemeyer 8df4f0d
Update cf_xarray/accessor.py
larsbuntemeyer e789cce
Update cf_xarray/accessor.py
larsbuntemeyer e4b60bd
Update cf_xarray/accessor.py
larsbuntemeyer 1f5fda7
Update doc/grid_mappings.md
larsbuntemeyer c13e7ba
updated see also sections
larsbuntemeyer 0811b29
added warning tests
larsbuntemeyer dccb7f4
extract warning tests
larsbuntemeyer 182a54c
remove skip_grid_mappings
larsbuntemeyer 6d982ce
added dataarray grid_mapping accessor
larsbuntemeyer 903bb9e
added dataarray grid_mapping_name
larsbuntemeyer aeb20be
docstrings
larsbuntemeyer d17d7f7
docs updates
larsbuntemeyer 4df3c04
merge upstream/main
larsbuntemeyer 2d0d353
fix
larsbuntemeyer ea45eda
skip grid_mapping coords repr
larsbuntemeyer 38e61c7
cf.grid_mappings switchted logic
larsbuntemeyer 0cddee4
update grid_mapping accessor logic
larsbuntemeyer 79ebe4f
test updates
larsbuntemeyer bacd42a
Merge remote-tracking branch 'upstream/main' into grid_mapping
larsbuntemeyer bf532e5
revert changes
larsbuntemeyer 423b9f6
fixed grid_mapping key critera
larsbuntemeyer 49ea7b2
adapted rotds dim names
larsbuntemeyer ead0928
small cleanup
dcherian daed53e
Add "grid_mapping" as special name
dcherian 17e0724
Swtich to .cf.grid_mapping_names
dcherian 9f61859
Avoid DataArray.cf.grid_mapping
dcherian 8dc1293
Avoid misleading n/a grid mapping in DataArray repr
dcherian 4fdb192
Fix repr
dcherian 147544b
Merge branch 'main' into grid_mapping
dcherian d487330
Fix typing
dcherian 301809f
Update docs.
dcherian fcddfac
fix cartopy cell
dcherian 19945f5
fix typing
dcherian 1807e51
Add to quickstart too
dcherian 06f6692
docs udpates
larsbuntemeyer 998e895
Merge branch 'main' into grid_mapping
dcherian 21e9188
Add whats-new note.
dcherian File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -228,6 +228,10 @@ def _create_mollw_ds(): | |
def _create_inexact_bounds(): | ||
# Dataset that creates rotated pole curvilinear coordinates with CF bounds in | ||
# counterclockwise order that have precision issues. | ||
# dataset created using: https://gist.github.com/larsbuntemeyer/105d83c1eb39b1462150d3fabca0b66b | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Very nice. In a future PR, it would be nice to add this as a "demo" notebook which creates a datasets, and illustrates creation of bounds/ extracting grid_mapping etc. |
||
rlon = np.array([17.935, 18.045, 18.155]) | ||
rlat = np.array([21.615, 21.725, 21.835]) | ||
|
||
lon = np.array( | ||
[ | ||
[64.21746363939087, 64.42305921561967, 64.62774455060337], | ||
|
@@ -296,23 +300,70 @@ def _create_inexact_bounds(): | |
|
||
rotated = xr.Dataset( | ||
coords=dict( | ||
rlon=xr.DataArray( | ||
rlon, | ||
dims="rlon", | ||
attrs={ | ||
"units": "degrees", | ||
"axis": "X", | ||
"standard_name": "grid_longitude", | ||
}, | ||
), | ||
rlat=xr.DataArray( | ||
rlat, | ||
dims="rlat", | ||
attrs={ | ||
"units": "degrees", | ||
"axis": "Y", | ||
"standard_name": "grid_latitude", | ||
}, | ||
), | ||
lon=xr.DataArray( | ||
lon, | ||
dims=("x", "y"), | ||
attrs={"units": "degrees_east", "bounds": "lon_bounds"}, | ||
dims=("rlon", "rlat"), | ||
attrs={ | ||
"units": "degrees_east", | ||
"bounds": "lon_bounds", | ||
"standard_name": "longitude", | ||
}, | ||
), | ||
lat=xr.DataArray( | ||
lat, | ||
dims=("x", "y"), | ||
attrs={"units": "degrees_north", "bounds": "lat_bounds"}, | ||
dims=("rlon", "rlat"), | ||
attrs={ | ||
"units": "degrees_north", | ||
"bounds": "lat_bounds", | ||
"standard_name": "latitude", | ||
}, | ||
), | ||
), | ||
data_vars=dict( | ||
lon_bounds=xr.DataArray( | ||
lon_bounds, dims=("bounds", "x", "y"), attrs={"units": "degrees_east"} | ||
lon_bounds, | ||
dims=("bounds", "rlon", "rlat"), | ||
attrs={"units": "degrees_east"}, | ||
), | ||
lat_bounds=xr.DataArray( | ||
lat_bounds, dims=("bounds", "x", "y"), attrs={"units": "degrees_north"} | ||
lat_bounds, | ||
dims=("bounds", "rlon", "rlat"), | ||
attrs={"units": "degrees_north"}, | ||
), | ||
rotated_pole=xr.DataArray( | ||
np.zeros((), dtype=np.int32), | ||
dims=None, | ||
attrs={ | ||
"grid_mapping_name": "rotated_latitude_longitude", | ||
"grid_north_pole_latitude": 39.25, | ||
"grid_north_pole_longitude": -162.0, | ||
}, | ||
), | ||
temp=xr.DataArray( | ||
np.random.rand(3, 3), | ||
dims=("rlat", "rlon"), | ||
attrs={ | ||
"standard_name": "air_temperature", | ||
"grid_mapping": "rotated_pole", | ||
}, | ||
), | ||
), | ||
) | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.