To deal with interpolation from hybrid sigma coordinate to pressure levels
Added by Annie Jasmine over 6 years ago
Hi everyone,
I am trying to use CDO version 1.8.2 to convert data from the CSIRO_Mk3.6.0 model in hybrid sigma coordinate to pressure levels, following the instruction from the Cmor Preprocessor website. http://www.meteo.unican.es/wiki/cordexwrf/SoftwareTools/CmorPreprocessor
All steps I did are as below and I am stuck on the step 7 with “The input stream contains variables on different horizontal grids” error. Even I tried applying the suggested solution in the link “https://code.mpimet.mpg.de/boards/1/topics/5842?r=5872#message-5872”, it did not work to me. The Mk3.6.0 data file extracted in 2 timesteps is attached.
Could you please help to solve this? Any suggestion would be greatly appreciated!
step1: cdo invertlev ta_Mk.3.6.0.nc temp1.nc
step2: ncdump -v p0 ta_Mk.3.6.0.nc | grep "p0 ="
p0 = 100000 ;
step3:
@ncatted -O -a bounds,,d,, temp1.nc
cdo outputf,%10.3f,2 -mulc,100000.0 -selname,a_bnds temp1.nc
cdo outputf: Started child process "mulc,100000.0 -selname,a_bnds temp1.nc (pipe1.1)".
cdo(2) mulc: Started child process "selname,a_bnds temp1.nc (pipe2.1)".
0.000 892.000
892.000 3429.000
3429.000 7330.000
7330.000 12108.000
12108.000 17039.000
17039.000 21281.000
21281.000 24079.000
24079.000 24978.000
24978.000 23934.000
23934.000 21297.000
21297.000 17659.000
17659.000 13661.000
13661.000 9825.000
9825.000 6475.000
6475.000 3758.000
3758.000 1732.000
1732.000 450.000
450.000 0.000
cdo(3) selname: Processed 36 values from 7 variables over 33 timesteps ( 0.06s )
cdo(2) mulc: Processed 36 values from 1 variable over 1 timestep ( 0.06s )
cdo outputf: Processed 36 values from 1 variable over 1 timestep ( 0.06s )
cdo outputf,%10.3f,2 -mulc,100000.0 -selname,b_bnds temp1.nc
cdo outputf: Started child process "mulc,100000.0 -selname,b_bnds temp1.nc (pipe1.1)".
cdo(2) mulc: Started child process "selname,b_bnds temp1.nc (pipe2.1)".
0.000 0.000
0.000 0.000
0.000 77.000
77.000 512.000
512.000 1822.000
1822.000 4645.000
4645.000 9528.000
9528.000 16723.000
16723.000 26066.000
26066.000 37002.000
37002.000 48733.000
48733.000 60413.000
60413.000 71313.000
71313.000 80905.000
80905.000 88835.000
88835.000 94839.000
94839.000 98658.000
98658.000100000.000
cdo(3) selname: Processed 36 values from 7 variables over 33 timesteps ( 0.03s )
cdo(2) mulc: Processed 36 values from 1 variable over 1 timestep ( 0.03s )
cdo outputf: Processed 36 values from 1 variable over 1 timestep ( 0.03s )
step 4: create a Z_axis description file “myzaxisinvert.dat”
@zaxistype = hybrid
size = 18
levels = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
vctsize = 38
vct = 0.000 892.000 3429.000 7330.000 12108.000 17039.000 21281.000 24079.000 24978.000
23934.000 21297.000 17659.000 13661.000 9825.000 6475.000 3758.000 1732.000 450.000 0.000
0.000
0.000 0.000 77.000 512.000 1822.000 4645.000 9528.000 16723.000 26066.000 37002.000 48733.000 60413.000
71313.000 80905.000 88835.000 94839.000 98658.000 100000.000
step 5 - Set the z-axis description in the netdcf file: cdo setzaxis,myzaxisinvert.dat temp1.nc temp2.nc
step6: Remove unused variablesncatted -O -a bounds,,d,, temp1.nc
cdo delname,ap_bnds,b_bnds,ps temp2.nc temp3.nc
step7: Interpolate to pressure levelsexport EXTRAPOLATE=1
cdo ml2pl,100000,97500,95000,92500,90000,87500,85000,82500,80000,77500,75000,70000,65000,60000,55000,50000,45000,40000,35000,30000,25000,22500,20000,17500,15000,12500,10000,7000,5000,3000 temp3.nc ta_Plev.nc
cdo ml2pl: Extrapolation of missing values enabled!
Warning (cdf_scan_var_attr) : NetCDF: Variable not found - ilev
cdo ml2pl: This operator requires all variables on the same horizontal grid.
cdo ml2pl: Horizontal grids found:
cdo ml2pl: grid=1 type=generic points=384
cdo ml2pl: grid=2 type=generic points=192
cdo ml2pl: grid=3 type=generic points=2
cdo ml2pl: grid=4 type=gaussian points=18432
cdo ml2pl (Abort): The input stream contains variables on different horizontal grids!
ta_Mk.3.6.0.nc (2.69 MB) ta_Mk.3.6.0.nc |
Replies (2)
RE: To deal with interpolation from hybrid sigma coordinate to pressure levels - Added by Karin Meier-Fleischer over 6 years ago
Hi Annie,
one problem is that your data file contains two variables on different grids. The delname operator doesn't seem to delete all relevant things depending on variable ps but the operator selname do select only the wanted variable ta (see step 7 below).
cdo sinfov ta_Mk.3.6.0.nc File format : NetCDF -1 : Institut Source T Steptype Levels Num Points Num Dtype : Parameter name 1 : unknown CSIRO-Mk3-6-0 v instant 1 1 18432 1 F32 : ps 2 : unknown CSIRO-Mk3-6-0 v instant 18 2 18432 1 F32 : ta Grid coordinates : 1 : gaussian : points=18432 (192x96) np=48 lon : 0 to 358.125 by 1.875 degrees_east circular lat : -88.57217 to 88.57217 degrees_north available : cellbounds Vertical coordinates : 1 : surface : levels=1 2 : hybrid : levels=18 lev : 0.9955 to 0.0045 1 bounds : 1-0.99108 to 0.00892-0 1 available : vct ps: ps Time coordinate : 2 steps RefTime = 1850-01-01 00:00:00 Units = days Calendar = 365_day YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss 2001-11-07 06:00:00 2001-11-07 12:00:00
The second problem is that you explicitly delete the variables ap_bnds,b_bnds which are needed.
Try the following workflow:
#-- step 1 cdo invertlev ta_Mk.3.6.0.nc temp1.nc #-- step 2 ncdump -v p0 ta_Mk.3.6.0.nc | grep "p0 =" #-- step 3 ncatted -O -a bounds,,d,, temp1.nc cdo outputf,%10.3f,2 -mulc,100000.0 -selname,a_bnds temp1.nc cdo outputf,%10.3f,2 -mulc,100000.0 -selname,b_bnds temp1.nc #-- step 4 cat - << EOF > myzaxisinvert.dat zaxistype = hybrid size = 18 levels = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 vctsize = 38 vct = 0.000 892.000 3429.000 7330.000 12108.000 17039.000 21281.000 24079.000 24978.000 23934.000 21297.000 17659.000 13661.000 9825.000 6475.000 3758.000 1732.000 450.000 0.000 0.000 0.000 0.000 77.000 512.000 1822.000 4645.000 9528.000 16723.000 26066.000 37002.000 48733.000 60413.000 71313.000 80905.000 88835.000 94839.000 98658.000 100000.000 EOF #-- step 5 cdo setzaxis,myzaxisinvert.dat temp1.nc temp2.nc #-- step 6 --- #-- step 7 cp temp2.nc temp3.nc export EXTRAPOLATE=1 cdo ml2pl,100000,97500,95000,92500,90000,87500,85000,82500,80000,77500,75000,70000,65000,60000,55000,50000,45000,40000,35000,30000,25000,22500,20000,17500,15000,12500,10000,7000,5000,3000 -selname,ta temp3.nc ta_Plev.nc-Karin
RE: To deal with interpolation from hybrid sigma coordinate to pressure levels - Added by Annie Jasmine over 6 years ago
Dear Karin,
Thank you so much for your suggestion and I also applied for the GFDL-ESM2M data, too. The grib files were digested by WRF through all steps of ungrib.exe, metgrid.exe, real.exe and wrf.exe, but the output seems to be a mess. WRF did not right recognize the three dimension data including ta, ua, va, hus. I tried plotting the original netcdf file (filter_ta.nc), the netcdf file of data converted to pressure levels (ta4.nc) and the final grib file (ta5.nc) by panoply. I found that the step of converting from netcdf to grib by CDO led to changes in the grib file including header information, values of temperature variable, unit of pressure (Pa to hPa), reversed levels (bottom --> top, top --> bottom), calendar (365_day to proleptic_gregorian), reference time,... These changes could have WRF wrong understood the grib file. The detail pictures, links of data files and the commands I used, are in the attachment word file.
Could you please give me any advice to deal with this problem. Many thanks for your help.
Annie
details.docx (923 KB) details.docx |