Project

General

Profile

cdo setgrid

Added by Daniel Goll almost 11 years ago

Hello,

I have problems adjusting the grid of a netCDF file generated with ArcGIS.
The file is in T63: 192 x 96, xincr=1.875.
The grid differs from the standard t63grid in respect to xfirst and the yvals.
Therefore I generated "mygrid" and did "cdo setgrid,mygrid input.nc output.nc".
Although no error message appears the grid of the output file is not changed.

Does somebody know what's wrong?

Daniel


Replies (8)

RE: cdo setgrid - Added by Jaison-Thomas Ambadan almost 11 years ago

Hi,

your xinc is not correct I guess. it should be 1.875 instead of 1.8975 (in your mygrid! it's a typo I guess)

try the following

cdo griddes -random,n48 > mygrid
cdo -setgrid,mygrid input.nc output.nc

OR

cdo -f nc -random,n48 template.nc
cdo -setgrid,template.nc input.nc output.nc

OR

cdo -setgrid,n48 input.nc output.nc

Cheers,
J

RE: cdo setgrid - Added by Daniel Goll almost 11 years ago

Thank Jaison!

It was was indeed a typo, sorry for that,
but I still can't shift the latitudes by changing xfirst.

RE: cdo setgrid - Added by Jaison-Thomas Ambadan almost 11 years ago

but I still can't shift the latitudes by changing xfirst.

Can you please explain a bit more? the "xfirst" in your input.nc is "-180" and that in your "mygrid" is "0". If you keet the "xfirst" as "-180" but only change the xinc to standard Gaussian xinc=1.875, then apply setgrid, - it should be okay I guess

Cheers,
J

RE: cdo setgrid - Added by Daniel Goll almost 11 years ago

I want to shift the latitudes so that the map starts from 0 and not from -180.

Daniel

RE: cdo setgrid - Added by Jaison-Thomas Ambadan almost 11 years ago

okay then "cdo -setgrid,n48 input.nc output.nc" should do the job I guess. Have a look at the xfirst of:

cdo sinfo -setgrid,n48 input.nc

Cheers,
J

RE: cdo setgrid - Added by Daniel Goll almost 11 years ago

Hey Jason,

I think I have to tell the whole story.

What I want to do is convert the file input.nc so that I can apply the land-sea mask of the MPI-ESM, which starts from 0 and goes to 360.
The Latitudes of the input.nc start from -180 and go to 180.

Irrespectively how I adjust the grid (xfirst=0 or xfirst=-180) of the input.nc, a "cdo ifthen" fails to overlay the maps correctly. I have no idea what goes wrong. When I do "cdo sinfo" on the output after I did a "cdo setgrid" the info says the map was adjusted, but actually it isn't if I open the file in ncview or do a "cdo ifthen".

I've attached the sea-land mask.

slm.nc (148 KB) slm.nc sea-land mask file

RE: cdo setgrid - Added by Jaison-Thomas Ambadan almost 11 years ago

Daniel,

Okay, I see the problem. It seems, for some reason, setgrid doesn't work - I'm running out of ideas :) - may be Uwe/Ralf can help you ...

However, you could use remap operator as a workaround for the time being. Try for example:

cdo -b F64 -remapnn,n48 input.nc ouput.nc

Now the output and the sea-land mask looks same in ncview

Cheers,
J

RE: cdo setgrid - Added by Daniel Goll almost 11 years ago

Thanks, Jaison,

I did that earlier but I would like to avoid remapping if possible

Daniel

    (1-8/8)