topography following coordinate
Added by Johannes Röhrs about 13 years ago
Does anyone know if it's possible to use CDO for a vertical interpolation of 3d data to stretched topography following coordinates?
I found an example to describe z levels:
https://code.zmaw.de/embedded/cdo/1.4.7/cdo.html#x1-210001.4
However, the topography following coordinate transformation depends on x and y, and I didn't see how I could specify this to the cdo's. I could either supply the transfrom equation and a topography file or alternatively a 3d mapping array.
Did anyone before me use CDO to work with ROMS data or any other terrain-following model?
Replies (3)
RE: topography following coordinate - Added by Ralf Mueller about 13 years ago
Hi Johannes!
At first, I have to get clear, what kind of data you're handling with: You have variable (let's call it) "height" witch depends on x,y and z. And the values should describe the z-coordinate values at location x,y at level z. Did I get it right?
RE: topography following coordinate - Added by Johannes Röhrs about 12 years ago
Hi again!
More than one year after I opened this thread, I noticed that since last summer, cdo (version 1.5.1) has a function available for arbitrary vertical interpolations:
cdo intlevel3d,icoordinate ifile1 ifile2 ofile
Now I tried to use intlevel3d to vertically interpolate a 3d field with vertical coordinates (z) in 'depth below sea level' to a topography following vertical coordinate (s) that depends on x and y: s=s(z,y,x). Unfortunately, cdo crashed with a 'segmentation fault'.
I tried:
> cdo intlevel3d,"input_z_grid.nc" my_variable.nc target_s_grid.nc output.nc Segmentation fault
my input file looks like the following. my_variable.nc contains the field that is supposed to be interpolated from z,y,x to s,y,x:
cdo sinfo my_variable.nc File format: netCDF -1 : Institut Source Param Time Typ Grid Size Num Levels Num 1 : unknown unknown -1 con F32 554106 1 35 1 Horizontal grids : 1 : curvilinear > size : dim = 554106 nx = 1106 ny = 501 lon_rho : min = 2.28063246 max = 20.5218613 degree_east lat_rho : min = 61.8464315 max = 70.7475513 degree_north available : xvals yvals Vertical grids : 1 : generic level : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 cdo sinfo: Processed 1 variable. ( 0.05s )
the input grid:
cdo sinfo input_z_grid.nc File format: netCDF -1 : Institut Source Param Time Typ Grid Size Num Levels Num 1 : unknown unknown -1 con F32 554106 1 4 1 Horizontal grids : 1 : curvilinear > size : dim = 554106 nx = 1106 ny = 501 lon_rho : min = 2.28063246 max = 20.5218613 degree_east lat_rho : min = 61.8464315 max = 70.7475513 degree_north available : xvals yvals Vertical grids : 1 : depth_below_sea m : 0 10 50 5000
the target grid:
cdo sinfo target_s_grid.nc File format: netCDF -1 : Institut Source Param Time Typ Grid Size Num Levels Num 1 : unknown unknown -1 con F32 554106 1 35 1 Horizontal grids : 1 : curvilinear > size : dim = 554106 nx = 1106 ny = 501 lon_rho : min = 2.28063246 max = 20.5218613 degree_east lat_rho : min = 61.8464315 max = 70.7475513 degree_north available : xvals yvals Vertical grids : 1 : generic level : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 cdo sinfo: Processed 1 variable. ( 0.04s )
This thread is related to Scott's, who is working on the same problem (to vertically interpolate data for the topography following ocean model ROMS):
https://code.zmaw.de/boards/1/topics/913#message-972
Can anyone help out here? I am not sure if I am using the interpolation function the right way, and it's difficult to find out since I don't get any output. I tried to run the example on a different computer, as well as with a different cdo version, but it does not seem to be related to my installation of cdo.
RE: topography following coordinate - Added by Scott Rowe about 12 years ago
Hi Johannes,
After running into the same problem and inspecting the code I came to the conclusion that the intlevel3d function does not handle curvilinear grids. You must use a lonlat horizontal grid type. To do this, I had to modify my lon_rho and lat_rho variables so that they were one dimensional only. CDO then interprets the grid as being lonlat and the segmentation fault is avoided.