Combine regional files to get one global file
Added by Frosi Ma about 6 years ago
Hello,
I have 7 nc-files; all containing information about the same variable for the same
time period and the same horizontal resolution, but in different regions:
- Europa.nc
- N_America.nc
- S_America.nc
- Asia.nc
- Australia.nc
- Africa.nc
- Antartica.nc
Is there a cdo operation
to combine all these regional files into one global nc-file?
Thank you very much!
Kind regards
Frosi
Replies (5)
RE: Combine regional files to get one global file - Added by kunal bali about 6 years ago
why don't you try
`cdo mergegrid inputfile.nc outputfile.nc`
regards
-------
Kunal
RE: Combine regional files to get one global file - Added by kunal bali about 6 years ago
kunal bali wrote:
why don't you try
<cdo mergegrid inputfile.nc outputfile.nc>
regards
-------
Kunal
RE: Combine regional files to get one global file - Added by Frosi Ma about 6 years ago
Hello Kunal and hello to all the others,
please excuse my late reply.
Unfortunately, cdo mergegrid
is not working on curvilinear grids,
but all of my files have a curvilinear grid.
Here is, for example, an excerpt of the cdo sinfo
of Europa.nc :
Grid coordinates :
1 : curvilinear : points=8100 (90x90)
lon : -37.8379 to 51.8379 degrees_east
lat : 10.4586 to 71.8329 degrees_north
2 : generic : points=1
3 : generic : points=8100 (90x90)
i3 : 1 to 90 by 1 1
i2 : 1 to 90 by 1 1
Vertical coordinates :
1 : surface : levels=1
The other files have the same grid coordinates, except for the
lon and lat ranges of course.
Right now, my plan is to:
- Interpolate all files on my desired lon-lat-grid, see below.
- Use
cdo mergegrid
to combine them to one global file.
My desired lon-lat-grid (gridID 27) is a 0.25° grid, taken from
another global ocean model:
gridtype = lonlat
gridsize = 980640
xname = longitude
xlongname = Longitude
xunits = degrees_east
yname = latitude
ylongname = Latitude
yunits = degrees_north
xsize = 1440
ysize = 681
xfirst = -180
xinc = 0.25
yfirst = -80
yinc = 0.25
Let's take again Europa.nc as an example, with the rounded
coordinates from above:
lon : -38 to 52 degrees_east
lat : 10 to 72 degrees_north
I transform my desired grid description according to those rounded
coordinates:
gridtype = lonlat
gridsize = 89280
xname = longitude
xlongname = Longitude
xunits = degrees_east
yname = latitude
ylongname = Latitude
yunits = degrees_north
xsize = 360
ysize = 248
xfirst = -38
xinc = 0.25
yfirst = 10
yinc = 0.25
and then use:
cdo remapbil,griddes.txt Europa.nc Europa_remap.nc
which leads to the following error:
cdo remapbil (Abort): Unsupported grid type: generic
Can somebody please help me with the interpolation from my curvilinear
to my desired lon-lat-grid?
Thank you very much
Kind regards
Frosi
Europa.nc (892 KB) Europa.nc | Almost no variability, please don't be confused! | ||
global_grid.txt (292 Bytes) global_grid.txt |
RE: Combine regional files to get one global file - Added by kunal bali about 6 years ago
Try This,
you may use NCL and cdo both here
First run the NCL script
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl" load "$NCARG_ROOT/lib/ncarg/nclscripts/esmf/ESMF_regridding.ncl" ; OutFileName = "scrip_grid.nc" ; f = addfile ("Europa.nc", "r") lat2d = f->lat lon2d = f->lon ; Opt = True Opt@InterpMethod = "bilinear" ; default Opt@ForceOverwrite = True Opt@PrintTimings = True ; curvilinear_to_SCRIP(OutFileName,lat2d,lon2d,Opt)
then
cdo -f nc -setgrid,scrip_grid.nc Europa.nc new_out.nc
then
cdo remapbil new_out.nc test.nc
then check grids
cdo griddes test.nc
RE: Combine regional files to get one global file - Added by Frosi Ma about 6 years ago
Great, thank you so much! It worked! :-)