-
Notifications
You must be signed in to change notification settings - Fork 33
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
Add HEALPix Support #1147
base: main
Are you sure you want to change the base?
Add HEALPix Support #1147
Conversation
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
how do you get healpix mesh data, what is the format? do you have an example? |
I've put a few examples in #1028 which are a good read |
…Y/uxarray into philipc2/healpix-to-ugrid
…Y/uxarray into philipc2/healpix-to-ugrid
@@ -0,0 +1,266 @@ | |||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you link the equation to a HEALPix resource, I think this one: https://easy.gems.dkrz.de/Processing/healpix/index.html#healpix-spatial-resolution ?
Reply via ReviewNB
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure! I need to fix the latex as well.
@@ -0,0 +1,266 @@ | |||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few things:
- The first sentence seems incomplete. Maybe just removing "Since" will fix it.
- "...requires explicitly defined connectivity...", i.e. "explicitly" instead of "explicit"
- It is a bit unclear how this paragraph connects to the previous code cell and the use of
pixels_only
in the following code cell. Also, the message of this paragraph (i.e. The most important one is theface_node_connectivity
) and how the current implementation is done (i.e. defaulting to pixels only) seems a bit disconnected. Should it be something like this: "This above code creates a UXarrayGrid
with only HEALPix pixels' coordinates, i.e. not boundaries. However, much of UXarray's functionality requires explicitly defined connectivity arrays. The most important one is theface_node_connectivity
, which contains the indices of the boundaries of each pixel (i.e. corner nodes? in this implementation). Generating theface_node_connectivity
also constructs thenode_lat
andnode_lon
coordinates, corresponding to the latitude and longitude of the boundaries of each pixel. We can enforce construction of these by usingpixels_only
as follows:"
Reply via ReviewNB
@@ -0,0 +1,266 @@ | |||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Slight rephrase: "However, even if you load in a HEALPix grid specifying that you do not want the connectivity upfront, they can still be constructed when desired because of UXarray's internal design."
Reply via ReviewNB
@@ -0,0 +1,266 @@ | |||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A bit of rephrase maybe: "Once loaded in, UXarray does not care about the underlying grid format as it represents all formats in its unified UGRID-like convention; hence, all existing functionality is supported on HEALPix through the same UXarray interface, such as plotting."
Reply via ReviewNB
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea.
Just a quick comment for now: |
Thanks for the initial comment! Do you have any example datasets that have region cut-outs? |
This works with the easygems package: import xarray as xr
import numpy as np
from easygems import healpix as egh
da = xr.DataArray (np.arange (48,0.,-1), dims = ("cell",))
crs = xr.DataArray(0, coords = dict (crs=np.nan))
crs.attrs = dict (grid_mapping_name = 'healpix', healpix_nside=2**1, healpix_order='nest')
da.attrs['grid_mapping'] = "crs"
ds = xr.Dataset(dict (data= da), coords = dict (cell = np.arange(48), crs = crs))
subset = ds.isel(cell=slice(3,41))
egh.healpix_show(subset['data']) Maybe @lkluft has more thoughts on this. He's been working with regional grids. |
I've put together some revisions to the user guide, should be much cleaner now. |
To give some more context: A "regional grid" in our test cases is simply a slice of a full global HEALPix grid, which we store along with its global indices. This way it is still possible to facilitate the fast When it comes to plotting, this offers several possibilities. In |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job.
Closes #1097 #1028
Overview
Grid.from_healpix(zoom, nest, pixels_only)
classmethod that constructs a UGRID-compliant representation of a HEALPix Grid, and a ``UxDataset.from_healpix()` classmethod to load in data.face_node_connectivity,
node_lonand
node_lat` computed when the user requires them (i.e. for plotting)Examples