Generic grid to regular lon/lat grid
Added by praveen rai over 4 years ago
Hello all,
I have a model generated Orography dataset which I am trying to regrid but it is not working.
The CDO sinfo shows the following content-
File format : NetCDF2
-1 : Institut Source T Steptype Levels Num Points Num Dtype : Parameter ID
1 : MPIMET REMO v instant 1 1 15759 1 F32 : 129.128
Grid coordinates :
1 : generic : points=15759 (153x103)
Vertical coordinates :
1 : surface : levels=1
Time coordinate : 1 step
YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss
0020-04-17 00:00:00
I have even tried to add lon/lat using ncatted from nco but it also shows error when opening the file (Warning (cdf_scan_var_attr) : NetCDF: Variable not found - lat: Warning (cdf_scan_var_attr) : NetCDF: Variable not found - lon)
I am attaching my file also here.
Any help will be highly appreciated.
Thanks
Praveen
CAS-44_oro.nc (61.1 KB) CAS-44_oro.nc |
Replies (6)
RE: Generic grid to regular lon/lat grid - Added by Karin Meier-Fleischer over 4 years ago
Hi Praveen,
without the proper latitude and longitude or rather x and y data it is not possible to help.
-Karin
RE: Generic grid to regular lon/lat grid - Added by praveen rai over 4 years ago
Thanks for the reply Karin. I am attaching a regrid file from which I am trying to remap.
RE: Generic grid to regular lon/lat grid - Added by Karin Meier-Fleischer over 4 years ago
Is regrid the grid description file of CAS-44_oro.nc?
cat regrid gridtype = lonlat gridsize = 15453 xsize = 153 ysize = 101 xfirst = 10.75 xinc=0.44 yfirst=17.75 yinc=0.44
If it is the correct grid file then you add the missing lat/lons to the data file by
cdo -setgrid,regrid CAS-44_oro.nc
ncdump -h out.nc ncdump -h out.nc netcdf out { dimensions: time = UNLIMITED ; // (1 currently) lon = 153 ; lat = 101 ; variables: double time(time) ; time:standard_name = "time" ; time:units = "day as %Y%m%d.%f" ; time:calendar = "proleptic_gregorian" ; time:axis = "T" ; double lon(lon) ; lon:standard_name = "longitude" ; lon:long_name = "longitude" ; lon:units = "degrees_east" ; lon:axis = "X" ; double lat(lat) ; lat:standard_name = "latitude" ; lat:long_name = "latitude" ; lat:units = "degrees_north" ; lat:axis = "Y" ; float FIB(time, lat, lon) ; FIB:long_name = "surface geopotential (orography)" ; FIB:units = "m" ; FIB:code = 129 ; FIB:table = 128 ; FIB:institution = "MPIMET" ; // global attributes: :CDI = "Climate Data Interface version 1.9.8 (https://mpimet.mpg.de/cdi)" ; :Conventions = "CF-1.6" ; :history = "Fri Apr 24 12:49:35 2020: cdo -f nc -setgrid,regrid CAS-44_oro.nc out.nc\n", "Tue Apr 14 17:14:37 2020: cdo -t remo -f nc copy CAS-44_oro.srv CAS-44_oro.nc" ; :source = "REMO" ; :institution = "Max-Planck-Institute for Meteorology" ; :CDO = "Climate Data Operators version 1.9.8 (https://mpimet.mpg.de/cdo)" ; }
RE: Generic grid to regular lon/lat grid - Added by praveen rai over 4 years ago
The regrid file is not exactly the description file for the data. But it seems to work now.
Thank you so much Karin.
Greetings
Praveen
RE: Generic grid to regular lon/lat grid - Added by Ryan Murphy over 4 years ago
Thanks for the code! Really helped, as i'm a typical newbie
RE: Generic grid to regular lon/lat grid - Added by mh wahla over 4 years ago
awesome thanks for code,