Project

General

Profile

Wrap netCDF file to be fully global

Added by Trond Kristiansen about 2 years ago

Hi all,

I have a set of ERA5 files that covers the northern hemisphere. I will use these files as atmospheric forcing for the ROMS model, but the model complains that the data do not cover the entire model domain.

My ERA5 NetCDF files cover:
Gridded:  LonMin = -180.0000 LonMax =  179.7500 LatMin =   40.0000 LatMax =   90.0000

While my model covers:
Model:    LonMin = -179.9848 LonMax =  179.9680 LatMin =   45.0081 LatMax =   89.9205

To solve this problem I need to replicate the last longitude index at 179.7500 to 180.000 (create a fake point to wrap around the globe).

Is there a way to do this using CDO? I know I could do this using python and wrap_longitude but I am hoping CDO can provide an easier fix.

Thank you.
Cheers,
Trond Kristiansen


Replies (3)

RE: Wrap netCDF file to be fully global - Added by Ralf Mueller about 2 years ago

hi!

Depends on your grid description. you could remap the ERA5 to a new grid with one additional lon.

Normal lonlat grid looks like this:

% cdo -griddes -topo                                                           [Tue 2022-01-11|12:39:43]
cdo(1) topo: Process started
#
# gridID 1
#
gridtype  = lonlat
gridsize  = 259200
xsize     = 720
ysize     = 360
xname     = lon
xlongname = "longitude" 
xunits    = "degrees_east" 
yname     = lat
ylongname = "latitude" 
yunits    = "degrees_north" 
xfirst    = -179.75
xinc      = 0.5
yfirst    = -89.75
yinc      = 0.5

Maybe you can solve the problem by increasing xsize by one and remap to that grid. But then your grid exceeds 180 degrees - no idea if the model is happy in that case.

Basically this sounds like a model issue, because it might only take into account cell centers instead of cell bounds - idk ...

hth
ralf

RE: Wrap netCDF file to be fully global - Added by Uwe Schulzweida about 2 years ago

You can use "cdo sethalo,0,1 infile outfile" for this task.

RE: Wrap netCDF file to be fully global - Added by Trond Kristiansen about 2 years ago

Thank you for your help. It worked perfectly when I used the `sethalo` function.

    (1-3/3)