Project

General

Profile

convert netcdf file from polar stereographic to lat/lon

Added by Micheal Simpson over 1 year ago

I have not been using cdo long, but it seems to be exactly what I need to get the desired result --> remap polar radar data to a regular lat/lon grid.

I have a dataset (attached) that contains radial radar data with dimensions 720(azimuth) x 4320 (gates). I try to do a basic remap command such as:

cdo remapbil,r360x180 tmp.netcdf out.nc

And get the error:
cdo remapbil (Abort): Unsupported generic coordinates (Variable: ReflectivityQC)!

Reading some of the previous forums, it would seem this is an issue with the coordinates of my variable ReflectivityQC but I am not 100% sure how to fix this so that I can begin to remap.

Once this is fixed, I would like to remap this polar stereographic dataset to a latlon grid with user-defined resolution of lat/lon while also defining the grid limits to constrain the dataset. For example:

Ex1) 0.01-degree grid-spacing grid between lat = [30,40] and lon = [-90,-80]
Ex2) 0.005-degree grid-spacing grid between lat = [40,45] and lon = [-110,-100]

What would be the best way of achieving this?

tmp.netcdf (23.8 MB) tmp.netcdf netcdf file containing data for the current question

Replies (27)

RE: convert netcdf file from polar stereographic to lat/lon - Added by Estanislao Gavilan over 1 year ago

Hi Mike,

It is probably an object. Try something like this

ds = xr.open_dataset(reproj, engine='cfgrib')

or

reproj = cdo.remapnn(gridfile,input=' -setmissval,-999. '+outfile,output='radar_data_lonlat_0.005.nc',returnArray='t')

or

reproj = cdo.remapnn(gridfile,input=' -setmissval,-999. '+outfile,output='radar_data_lonlat_0.005.nc',returnArray='Reflectivity')

I never tried. So you need to do a bit of trial erro

Kind regards,

Estanislao

RE: convert netcdf file from polar stereographic to lat/lon - Added by Karin Meier-Fleischer over 1 year ago

If you use the output parameter in the cdo call it will create an output file but you can use an other parameter (returnXArray, returnXDataset, ...) to return an xarray array or dataset what I recommend to use.

For instance, the returned object ds_remap of the following call is an xarray Dataset.

ds_remap = cdo.remapnn(gridfile, input=' -setmissval,-999. '+outfile, returnXDataset=True)

Btw, there is a tutorial in the Wiki about python-cdo, see https://code.mpimet.mpg.de/attachments/download/27273/python_cdo_introduction.pdf.

(26-27/27)