pyart
pyart copied to clipboard
Writing specific fields
I think it would be very useful to be able to specify the fields to write out. Something along the lines of
pyart.io.write(radar,fields = ['reflectivity','differential_reflectivity','velocity']")
Great idea! Assigning @zssherman
Sounds good to me, I don't think it will be difficult to implement at all. I will take a look.
Chiming in here – would it be more useful to write a function that selected fields from a radar object?This could make it easier to also do memory management, etc. Also would expand on a more pandas/xarray-like syntax. We already have extract_sweeps but this could get unified into a more general slicing/dicing syntax.
This could follow the xarray syntax, for example
radar1.sel(field=[‘reflectivity’,’velocity’]) and maybe in the future radar1.sel(azimuth=slice([90,150])) radar1.sel(sweep=slice(1,3))
This could easily be put into a one-liner pyart.io.write(radar1.sel(fields = ['reflectivity','differential_reflectivity','velocity'])) or eventually (to follow pandas/xarray syntax) radar1.sel(field=[‘reflectivity’,‘velocity’]).to_cfradial(‘file.nc’)
Just my two pennies, -Steve
@swnesbitt I do like that idea, and now with xarray being used for the grids, its already a dependency. I'll see what I can code up.
Yes, 1-up on @swnesbitt's comment. That would be fantastic.
Completed in #1319 , closing.
@bdolan44 this is now available in the latest release of Py-ART
Fantastic! I was just thinking about this functionality again recently. Thanks!