selvar and sellevel
Added by Jesper Baasch-Larsen almost 14 years ago
Dear CDO users and developers
We are using CDO for operational preprocessing of atmospheric forcing (GRIB) for our ocean model (or rather we are beginning to). To do this we need to extract various variables. The forcing includes for example 2m temperature and wind at different levels. Is it for example possible to extract the wind at 10m to a new file using selvar while also extracting the 2m temperature? Or will we have to split up the original GRIB file and save the wind in a separate file, extract the proper level using sellevel and merge it with a grib file containing the other fields?
Performance is really important for us. So we don't want to produce to many files in the process if we can avoid it.
Best regards,
Jesper Baasch-Larsen
PhD in Physical Oceanography
Danish Maritime Safety Administration
Replies (1)
RE: selvar and sellevel - Added by Ralf Mueller almost 14 years ago
Hi!
I'm not sure, I get you intended workflow correctly.
Do you want to have selcode and sellevel on a single line on different variables? I'm guessing a bit ...
Let's say in.nc
contains many variables, but you're only interestes in var 100 at level 2 and in var 120:
cdo -merge -sellevel,2 -selcode,100 in.nc -selcode,120 in.nc out.nc
I ran this as an example:
[ram@thingol:~/data/examples]cdo sinfo -selcode,154,90 multiVar.nc [9:57:51|11-05-24] cdo sinfo: Started child process "selcode,154,90 multiVar.nc (pipe1.1)". File format: netCDF -1 : Institut Source Param Time Typ Grid Size Num Levels Num 1 : MPIMET ECHAM5.2 154.128 var F32 2048 1 19 2 2 : MPIMET ECHAM5.2 90.128 var F32 2048 1 1 1 Horizontal grids : 1 : gaussian > size : dim = 2048 nlon = 64 nlat = 32 lon : first = 0 last = 354.375 inc = 5.625 degrees_east circular lat : first = 85.7605896 last = -85.7605896 degrees_north Vertical grids : 2 : hybrid level : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 1 : surface : 0 Time axis : 60 steps RefTime = 1978-01-01 12:00:00 Units = days Calendar = STANDARD YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss 1978-01-02 00:00:00 1978-01-02 12:00:00 1978-01-03 00:00:00 1978-01-03 12:00:00 1978-01-04 00:00:00 1978-01-04 12:00:00 1978-01-05 00:00:00 1978-01-05 12:00:00 1978-01-06 00:00:00 1978-01-06 12:00:00 1978-01-07 00:00:00 1978-01-07 12:00:00 1978-01-08 00:00:00 1978-01-08 12:00:00 1978-01-09 00:00:00 1978-01-09 12:00:00 1978-01-10 00:00:00 1978-01-10 12:00:00 1978-01-11 00:00:00 1978-01-11 12:00:00 1978-01-12 00:00:00 1978-01-12 12:00:00 1978-01-13 00:00:00 1978-01-13 12:00:00 1978-01-14 00:00:00 1978-01-14 12:00:00 1978-01-15 00:00:00 1978-01-15 12:00:00 1978-01-16 00:00:00 1978-01-16 12:00:00 1978-01-17 00:00:00 1978-01-17 12:00:00 1978-01-18 00:00:00 1978-01-18 12:00:00 1978-01-19 00:00:00 1978-01-19 12:00:00 1978-01-20 00:00:00 1978-01-20 12:00:00 1978-01-21 00:00:00 1978-01-21 12:00:00 1978-01-22 00:00:00 1978-01-22 12:00:00 1978-01-23 00:00:00 1978-01-23 12:00:00 1978-01-24 00:00:00 1978-01-24 12:00:00 1978-01-25 00:00:00 1978-01-25 12:00:00 1978-01-26 00:00:00 1978-01-26 12:00:00 1978-01-27 00:00:00 1978-01-27 12:00:00 1978-01-28 00:00:00 1978-01-28 12:00:00 1978-01-29 00:00:00 1978-01-29 12:00:00 1978-01-30 00:00:00 1978-01-30 12:00:00 1978-01-31 00:00:00 1978-01-31 12:00:00 cdo(2) selcode: Processed 2457600 values from 121 variables over 60 timesteps. ( 0.03s ) cdo sinfo: Processed 2 variables over 60 timesteps. ( 0.03s )
Variables 154 and 90 have different grids. To select them while selecting a certain level of var 154:
cdo -merge -sellevel,1 -selcode,154 multiVar.nc -selcode,90 multiVar.nc out.nc
and check again with
[ram@thingol:~/data/examples]cdo sinfo out.nc [10:01:57|11-05-24] File format: netCDF -1 : Institut Source Param Time Typ Grid Size Num Levels Num 1 : MPIMET ECHAM5.2 154.128 var F32 2048 1 1 1 2 : MPIMET ECHAM5.2 90.128 var F32 2048 1 1 2 Horizontal grids : 1 : gaussian > size : dim = 2048 nlon = 64 nlat = 32 lon : first = 0 last = 354.375 inc = 5.625 degrees_east circular lat : first = 85.7605896 last = -85.7605896 degrees_north Vertical grids : 1 : hybrid level : 1 2 : surface : 0 Time axis : 60 steps RefTime = 1978-01-01 12:00:00 Units = days Calendar = STANDARD YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss 1978-01-02 00:00:00 1978-01-02 12:00:00 1978-01-03 00:00:00 1978-01-03 12:00:00 1978-01-04 00:00:00 1978-01-04 12:00:00 1978-01-05 00:00:00 1978-01-05 12:00:00 1978-01-06 00:00:00 1978-01-06 12:00:00 1978-01-07 00:00:00 1978-01-07 12:00:00 1978-01-08 00:00:00 1978-01-08 12:00:00 1978-01-09 00:00:00 1978-01-09 12:00:00 1978-01-10 00:00:00 1978-01-10 12:00:00 1978-01-11 00:00:00 1978-01-11 12:00:00 1978-01-12 00:00:00 1978-01-12 12:00:00 1978-01-13 00:00:00 1978-01-13 12:00:00 1978-01-14 00:00:00 1978-01-14 12:00:00 1978-01-15 00:00:00 1978-01-15 12:00:00 1978-01-16 00:00:00 1978-01-16 12:00:00 1978-01-17 00:00:00 1978-01-17 12:00:00 1978-01-18 00:00:00 1978-01-18 12:00:00 1978-01-19 00:00:00 1978-01-19 12:00:00 1978-01-20 00:00:00 1978-01-20 12:00:00 1978-01-21 00:00:00 1978-01-21 12:00:00 1978-01-22 00:00:00 1978-01-22 12:00:00 1978-01-23 00:00:00 1978-01-23 12:00:00 1978-01-24 00:00:00 1978-01-24 12:00:00 1978-01-25 00:00:00 1978-01-25 12:00:00 1978-01-26 00:00:00 1978-01-26 12:00:00 1978-01-27 00:00:00 1978-01-27 12:00:00 1978-01-28 00:00:00 1978-01-28 12:00:00 1978-01-29 00:00:00 1978-01-29 12:00:00 1978-01-30 00:00:00 1978-01-30 12:00:00 1978-01-31 00:00:00 1978-01-31 12:00:00 cdo sinfo: Processed 2 variables over 60 timesteps. ( 0.00s )
hth
ralf