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
ENH: xarray grid output #1477
base: main
Are you sure you want to change the base?
ENH: xarray grid output #1477
Conversation
if self.radar_name is not None: | ||
radar_name = self.radar_name["data"] | ||
ds["radar_name"] = xarray.DataArray( | ||
np.array([b"".join(radar_name)]), |
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.
What is the reason for using a byte-encoded name here?
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.
Because some radar data use the following convention:
print(grid.radar_name)
{'long_name': 'Name of radar used to make the grid',
'data': masked_array(data=[[b'D', b'O', b'W', b'8']],
mask=False,
fill_value=b'N/A',
dtype='|S1')}
To make it look like b'DOW8
, because if you read a pyart
or radx
generated grid
using xarray
, it shows up like array([b'DOW8'], dtype='|S4')
. That's why, I am using byte-encoded name so the result looks like
ds["radar_name"] = xarray.DataArray(
np.array([b"".join(grid.radar_name)])
print(ds["radar_name"])
array([b'DOW8'], dtype='|S4')
if "_include_lon_0_lat_0" in projection: | ||
include = projection["_include_lon_0_lat_0"] | ||
projection["_include_lon_0_lat_0"] = ["false", "true"][include] | ||
ds["projection"] = xarray.DataArray( |
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.
I think this variable, along with the other origin_latitude, etc. variables belong as coordinates - can you add those to the list of coordinates? I think that is what is causing the failure in CI here.
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.
@mgrover1 My apologies for the late response; I've been tied up with exams recently and have another busy week ahead. I'll get to it as soon as possible. Thanks for your suggestion.
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.
No worries! Take your time - just let me know when you are ready for another review!
To streamline the process of extracting a subset from
pyart.core.grid
or the grid object, I propose to add a few more variables to thexarray dataset
that mirrors the grid object. When thisxarray dataset
is written to aNetCDF
file, it becomes equivalent to the originalpyart.core.grid
object.How can this be utilized?
Subsequently, it is possible to read the modified dataset using
pyart
as follows:This enhances the process of working with grid data, making it more convenient and efficient for users.