[ncl-talk] Converting a polar stereographic netcdf to lat/lon

Karin Meier-Fleischer meier-fleischer at dkrz.de
Mon Jun 3 07:18:17 MDT 2024


Hi Andrew,

you can remap the data using gdal or cdo for instance. I prefer using 
cdo and in the following the way to do it with cdo is described.

1. get grid description from input file
2. change the units of x and y coordinate variable from 'Meter' to 'm'
3. generate the grid description file for the output data on regular 
lonlat grid for Puerto Rico area
4. remap the input file

Sounds difficult but it isn't.

1. get the input file grid description

cdo griddes nws_precip_wytd_20240601_pr.nc > gridfile.txt

2. edit the gridfile.txt and change Meter to m

gridtype  = projection
gridsize  = 42025
xsize     = 205
ysize     = 205
xname     = x
xlongname = "x coordinate of projection"
xunits    = "m"
yname     = y
ylongname = "y coordinate of projection"
yunits    = "m"
xfirst    = 4943283.5160097
xinc      = 4762.5
yfirst    = -6236964.62846119
yinc      = -4762.5
grid_mapping = crs
grid_mapping_name = polar_stereographic
straight_vertical_longitude_from_pole = -105.
false_easting = 0.
standard_parallel = 60.
false_northing = 0.
latitude_of_projection_origin = 90.
earth_radius = 6367470.
proj4 = "+proj=stere +lat_0=90 +lat_ts=60 +lon_0=-105 +x_0=0 +y_0=0 
+a=6367470 +b=6367470 +units=m +no_defs"
crs_wkt = 'PROJCS["NOAA_HRAP_Grid", GEOGCS["GCS_NOAA_HRAP",        
DATUM["D_NOAA_HRAP", SPHEROID["Sphere",6367470,0.0]        ], 
PRIMEM["Greenwich",0.0], UNIT["Degree",0.0174532925199433]    ], 
PROJECTION["Polar_Stereographic"], PARAMETER["false_easting",0.0], 
PARAMETER["false_northing",0.0], PARAMETER["central_meridian",-105.0], 
PARAMETER["latitude_of_origin",60.0],    UNIT["meter",1.0]]'
esri_pe_string = 'PROJCS["NOAA_HRAP_Grid", 
GEOGCS["GCS_NOAA_HRAP",        DATUM["D_NOAA_HRAP", 
SPHEROID["Sphere",6367470,0.0]        ], PRIMEM["Greenwich",0.0], 
UNIT["Degree",0.0174532925199433]    ], 
PROJECTION["Stereographic_North_Pole"], PARAMETER["false_easting",0.0], 
PARAMETER["false_northing",0.0], PARAMETER["central_meridian",-105.0], 
PARAMETER["standard_parallel_1",60.0],    UNIT["meter",1.0]]'

3. generate output grid descption file grid_lonlat.txt

gridtype  = lonlat
gridsize  = 31122
xsize     = 182
ysize     = 171
xname     = lon
xlongname = "longitude"
xunits    = "degrees_east"
yname     = lat
ylongname = "latitude"
yunits    = "degrees_north"
xfirst    = -70.6
xinc      = 0.05
yfirst    = 13.78
yinc      = 0.05

4. remap the data

cdo -remapbil,grid_lonlat.txt -setgrid,gridfile.txt 
nws_precip_wytd_20240601_pr.nc outfile.nc


Hope this will help you,
Karin


Am 01.06.24 um 22:15 schrieb Andrew Kren - NOAA Federal via ncl-talk:
> Hi there,
>
> I am not sure I am asking the right question, but here goes. I am 
> reading noaa stage IV precipitation data, found here: 
> https://water.noaa.gov/resources/downloads/precip/stageIV/2024/06/01/
>
> The new data has been transformed to a polar stereographic grid. When 
> I did an ncl_filedump on the netcdf file, the variables were x, y and 
> not lat/lon. The x, y values are random positive/negative numbers, 
> which I'm guessing is some non lat/lon projection. My question is, is 
> there a way in NCL to convert this file so that the variables are in 
> lat/lon coordinates? Or is this something I need to do outside ncl?
>
> Thanks for any help!
>
> -- 
> Andrew Kren Meteorologist NOAA's National Weather Service Raleigh 
> Forecast Office 1005 Capability Drive, Suite 300 Raleigh, North 
> Carolina 27606 voice: 919-326-1035 mailto: 
> andrew.kren at noaa.govhttp://www.weather.gov/rah  <http://www.weather.gov/rah>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at mailman.ucar.edu
> List instructions, subscriber options, unsubscribe:
> https://mailman.ucar.edu/mailman/listinfo/ncl-talk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20240603/09fabd7a/attachment.htm>


More information about the ncl-talk mailing list