selecting a range of vertical levels
Added by Rob Nicholas about 13 years ago
Is there a way select a range of vertical levels? For date ranges we have seldate, for horizontal regions, we have sellonlatbox, but it seems there's nothing analogous for vertical levels -- sellevels requires a list of the exact levels.
The particular problem I have is that the various CMIP3 models use different sets of levels for ocean depths. I'd like to select a range of depths, say 0-700 m, without needing to know the particular levels for each model ahead of time.
In lieu of an operator for this, can anyone suggest a hack that might accomplish the same thing?
Thanks!
Rob
Replies (3)
RE: selecting a range of vertical levels - Added by Ralf Mueller about 13 years ago
You could still use sellevel. Lets say, you have a variable with 10 levels:
[ram@thingol:~/data/icon]cdo sinfov -selname,T icon_oce.nc [9:36:14|12-01-27] cdo sinfon: Started child process "selname,T icon_oce.nc (pipe1.1)". File format: netCDF2 -1 : Institut Source Name Time Typ Grid Size Num Levels Num 1 : unknown unknown T var F32 20480 1 10 1 Horizontal grids : 1 : unstructured > size : dim = 20480 nvertex = 3 clon : min = -3.14159265 max = 3.14159265 radian clat : min = -1.55288464 max = 1.55289374 radian available : xvals yvals xbounds ybounds Vertical grids : 1 : depth_below_sea m : 25 100 250 500 875 1400 2100 3000 4000 5000 Time axis : 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 2076-04-17 00:00:00 cdo(2) selname: Processed 204800 values from 28 variables over 1 timestep. ( 0.00s ) cdo sinfon: Processed 1 variable over 1 timestep. ( 0.00s )
Then you can use sellevel with an integer range like 25/900
:
cdo -sellevel,25/900 -selname,T icon_oce.nc sellevel.nc
There will some warnings, because of missing levels, but you can ignore this. Thre resulting file looks wuite good:
[ram@thingol:~/data/icon]cdo sinfov sellevel.nc [9:39:05|12-01-27] File format: netCDF2 -1 : Institut Source Name Time Typ Grid Size Num Levels Num 1 : unknown unknown T var F32 20480 1 5 1 Horizontal grids : 1 : unstructured > size : dim = 20480 nvertex = 3 clon : min = -3.14159265 max = 3.14159265 radian clat : min = -1.55288464 max = 1.55289374 radian available : xvals yvals xbounds ybounds Vertical grids : 1 : depth_below_sea m : 25 100 250 500 875 Time axis : 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 2076-04-17 00:00:00 cdo sinfon: Processed 1 variable over 1 timestep. ( 0.00s )
Operator parameters are described here.
RE: selecting a range of vertical levels - Added by Mark Payne almost 4 years ago
This question is rather old (9 years) but it seems to be the only resource I can find on the topic today. The answer proposes the specification of an integer range as follows:
cdo -sellevel,25/900 -selname,T icon_oce.nc sellevel.nc
However, this only works if the levels themselves are also integers. As soon as you get a layer that is e.g. 33.3333, it gets overlooked by this approach (also in the most recent versions of CDO). Is there now any way to specify a range as the OP asked? Or could this be added as a new operator?
Cheers,
Mark
RE: selecting a range of vertical levels - Added by Uwe Schulzweida over 3 years ago
This feature will be available in the next CDO release 2.0.0. The operator select will then have the key levrange to select the level range:
cdo select,levrange,25,900,name=T icon_oce.nc sellevel.ncCheers,
Uwe