How to extract select levels with non "level" labeled level dimension name?
Added by ep gupal over 1 year ago
I am trying to extract 4d variable with select levels. But the name of the level variable is not labeled as "label". As you can see from the ncdump header, the level variable is named "model_level_number".
@====================================================
netcdf um.5km.pfull.glb.qd.20200223030000-20200224000000 {
dimensions:
time = UNLIMITED ; // (8 currently)
lon = 1440 ;
lat = 721 ;
model_level_number = 55 ;
variables:
double time(time) ;
time:standard_name = "time" ;
time:units = "hours since 1970-01-01 00:00:00" ;
time:calendar = "gregorian" ;
time:axis = "T" ;
double leadtime(time) ;
leadtime:standard_name = "forecast_period" ;
leadtime:long_name = "Time elapsed since the start of the forecast" ;
leadtime:units = "hours" ;
float lon(lon) ;
lon:standard_name = "longitude" ;
lon:long_name = "longitude" ;
lon:units = "degree_east" ;
lon:axis = "X" ;
float lat(lat) ;
lat:standard_name = "latitude" ;
lat:long_name = "latitude" ;
lat:units = "degree_north" ;
lat:axis = "Y" ;
int model_level_number(model_level_number) ;
model_level_number:standard_name = "model_level_number" ;
model_level_number:units = "1" ;
model_level_number:positive = "up" ;
model_level_number:axis = "Z" ;
float pfull(time, model_level_number, lat, lon) ;
pfull:standard_name = "air_pressure" ;
pfull:long_name = "PRESSURE AT RHO LEVELS AFTER TIMESTEP" ;
pfull:units = "Pa" ;
pfull:origin = "air_pressure" ;
// global attributes:
==============================================================@
As far as I know, the command "sellevel" does the job as long as the z-axis variable is named "level". So, for my case, what should I do?
Thanks.
Replies (4)
RE: How to extract select levels with non "level" labeled level dimension name? - Added by Karin Meier-Fleischer over 1 year ago
Hi,
you can use other names than level, height, or depth.
Assume model_level_number = 1,2,3 then you can select the model_level_number 3 with
cdo -sellevel,3 um.5km.pfull.glb.qd.20200223030000-20200224000000.nc outfile.nc
RE: How to extract select levels with non "level" labeled level dimension name? - Added by ep gupal over 1 year ago
Thank you fro your reply.
Does this also work with a file that has somewhat weird dimension order? The netcdf file above has the dimension order of (time, height, latitude, longitude), but would the method that you described above work for, say, (time, latitude, height, longitude)? Thanks.
RE: How to extract select levels with non "level" labeled level dimension name? - Added by Karin Meier-Fleischer over 1 year ago
I guess the answer to your question is no. The dimension order should be like (time, level, lat, lon). You can re-order the dimensions with NCO.
RE: How to extract select levels with non "level" labeled level dimension name? - Added by ep gupal over 1 year ago
Ahh. Okay. Thanks.