(NEXRAD) Basics of opening a file and writing in new format

130 views
Skip to first unread message

David H

unread,
Jul 21, 2020, 1:05:24 AM7/21/20
to Py-ART Users
Greetings,

I have posted here before but because of unknown reasons I could not get pyart to work on my machine. That is now resolved. With that said I am very new with pyart but only a novice programmer so I may need some help.

My ultimate goal is to use pyart to extract moments out of NEXRAD volume scans *before* a volume scan is complete. I then want to immediately convert them to gridded netCDF to process with GDAL tools. (with the exception of velocity, I would like to dealias this and then convert to nc).


So, my first question is : Is it possible to request specific elevation slices before a volume scan is complete (assuming that particular elevation has been written to the file?) I will code the logic to download the partial file, I just need to know if pyart can extract out of an incomplete file.

My main issue is assistance with getting the basics working. Here is my code to open a file, convert to a grid and then write as netcdf. it currently does not work for obvious reasons.



--------------

import pyart

radar = pyart.io.read_nexrad_archive('KEWX20170220_044018_V06', field_names='RadialVelocity',scans=[0])

filename = "output.nc"

pyart.map.map_to_grid(radar, grid_shape=???, grid_limits,grid_shape=???)


pyart.io.write_grid(filename, radar, format='NETCDF4')

----------

Of course, this does not work. I am trying to get the lowest tilt [0] of RadialVelocity and simply write it to netCDF. What are the grid_shape and grid_limits? Is this resolution of some sort? I have tried looking in the documentation, but I am lost.


Thank you for any assistance. I am really looking forward to using this tool!

David



Zach Sherman

unread,
Jul 21, 2020, 11:26:17 AM7/21/20
to Py-ART Users
Hi David,

For your first question, i'm honestly not entirely sure. If the files has elevation azimuth range and all other fields, I can't see why it wouldn't be readable. For your code question,
grid limits is your limits in meters, so -100000, 100000 for x would be 200km same with y if you did -100000, 100000, z is your height so like 0, 10000. Grid shape is how many points between each limit.
So if you do 101 for x with limits of -100000, 100000 your doing your grid spacing or points at ever 1000m

Cheers,
Zach S.

Zach Sherman

unread,
Jul 21, 2020, 8:47:39 PM7/21/20
to Py-ART Users
David,

So grid_shape will be a tuple of 3 values and grid limits a 3 tuple with 2 tuples going in order z, y, x more here:
https://arm-doe.github.io/pyart/API/generated/pyart.map.grid_from_radars.html#pyart.map.grid_from_radars

Your example your grid limits are missing a z and either an x or y, so maybe for example ((0, 10000), (-100000, 100000), (-100000, 10000)) adjust z to your liking.
For shape you want z first then y, x so do (0, 101, 101)

Hope that helps
Zach S.
Reply all
Reply to author
Forward
0 new messages