pyart icon indicating copy to clipboard operation
pyart copied to clipboard

Writing specific fields

Open bdolan44 opened this issue 6 years ago • 5 comments
trafficstars

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']")

bdolan44 avatar Jun 12 '19 20:06 bdolan44

Great idea! Assigning @zssherman

scollis avatar Jun 12 '19 20:06 scollis

Sounds good to me, I don't think it will be difficult to implement at all. I will take a look.

zssherman avatar Jun 12 '19 21:06 zssherman

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 avatar Jun 12 '19 21:06 swnesbitt

@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.

zssherman avatar Jun 12 '19 23:06 zssherman

Yes, 1-up on @swnesbitt's comment. That would be fantastic.

bdolan44 avatar Jun 13 '19 02:06 bdolan44

Completed in #1319 , closing.

zssherman avatar Nov 08 '22 19:11 zssherman

@bdolan44 this is now available in the latest release of Py-ART

mgrover1 avatar Nov 08 '22 19:11 mgrover1

Fantastic! I was just thinking about this functionality again recently. Thanks!

bdolan44 avatar Nov 08 '22 20:11 bdolan44