Problem with CDO monmean
Added by Ping Yang over 12 years ago
Dear CDO users,
I got a problem when I was convert daily data to monthly data.
The daily day was an NetCDF file which I interpolated from NCEP/NCAR, the header information is like this:
netcdf air.2m.gauss.2000.interpolated {
dimensions:
time = 366 ;
LAT = 306 ;
LON = 384 ;
variables:
float air(time, LAT, LON) ;
air:lonFlip = "longitude coordinate variable has been reordered via lonFlip" ;
air:missing_value = 32766.f ;
air:valid_range = 150.f, 400.f ;
air:_FillValue_original = 32766s ;
air:parent_stat = "Individual Obs" ;
air:statistic = "Mean" ;
air:level_desc = "2 m" ;
air:dataset = "NCEP Reanalysis Daily Averages" ;
air:var_desc = "Air temperature" ;
air:GRIB_name = "TMP" ;
air:GRIB_id = 11s ;
air:least_significant_digit = 1s ;
air:precision = 2s ;
air:missing_value_original = 32766s ;
air:units = "degC_Celsius" ;
air:actual_range = 178.5f, 316.07f ;
air:unpacked_valid_range = 150.f, 400.f ;
air:long_name = "mean Daily Air temperature at 2 m" ;
air:_FillValue = 32766.f ;
double time(time) ;
time:axis = "T" ;
time:standard_name = "time" ;
time:avg_period = "0000-00-01 00:00:00" ;
time:delta_t = "0000-00-01 00:00:00" ;
time:actual_range = 17522904., 17531664. ;
time:long_name = "Time" ;
time:units = "hours since 1-1-1 00:00:0.0" ;
float LAT ;
LAT:units = "degrees_north" ;
float LON ;
LON:units = "degrees_east" ;
When I was interpolating(regriding), I used a short2flt() in NCL to do some computation on the float value.
How I ever, when I used cdo monmean file1.nc file2.nc, I found the value in file2.nc are unvalid value(I attach my file in this message).
Is there some requirement for using the CDO to complete this conversion? I think my NetCDF should be normal. Has anyone ever encounter this problem.
I will be appreciated if some hints or suggestions for my case.
Looking forward to hearing from you.
Ping
air2000.nc (5.38 MB) air2000.nc | resulting monmean file |
Replies (4)
RE: Problem with CDO monmean - Added by Jaison-Thomas Ambadan over 12 years ago
Hi,
Can you please upload a sample of your original data? In the mean time you may try setting the missing value before the "monmean", i,e, for example:
cdo -monmean -setmissval,32766 ifile.nc ofile.nc
Cheers,
J.
RE: Problem with CDO monmean - Added by Ping Yang over 12 years ago
Hi Jaison,
I used the cdo -monmean -setmissval,32766 ifile.nc ofile.nc but the problem still exists.
My file is bigger than this size limit here, but I am providing a link here for the dropbox: https://www.dropbox.com/s/8kuet6lzm2l0ec8/air.2m.gauss.2000.interpolated.nc
Would you please have a look?
Looking forward to hearing from you.
Ping
RE: Problem with CDO monmean - Added by Jaison-Thomas Ambadan over 12 years ago
Hi,
As far as I understood, the problem is that the your input NetCDF file meta/header info is inconsistent/wrong. This is clear if you simply do: "cdo info air.2m.gauss.2000.interpolated.nc" and you can see that all values are NaNs! although there is NO NaNs in your data. This is because in the NetCDF meta info (ncdump -h air.2m.gauss.2000.interpolated.nc), :
air:valid_range = 150.f, 400.f ;
air:units = "degC_Celsius" ;
air:actual_range = 178.5f, 316.07f ;
air:unpacked_valid_range = 150.f, 400.f ;
These settings are values are inconsistent (e.g. 150-400 degC_Celsius?) with actual data which are well below these ranges. This you can see by simply dumping all data.
now, the "easy" way to fix this issue is: [on linux/unix]
1. ncdump air.2m.gauss.2000.interpolated.nc > air_temp.dat
2. open the "air_temp.dat" file and simply DELETE ONLY the following meta/header info
air:valid_range = 150.f, 400.f ;
air:actual_range = 178.5f, 316.07f ;
air:unpacked_valid_range = 150.f, 400.f ;
and SAVE the file afterwords
3. ncgen -o air_temp.nc air_temp.dat
That's it! Now you are good to go...
check: cdo -info -monmean air_temp.nc
Hope this helps!
Cheers,
Jaison.
PS: In principle you could use the "-setvrange" CDO operator but for some reason it does not seems to work, and I don't know why - may be the CDO gurus, Uwe/Ralf can help you with that
RE: Problem with CDO monmean - Added by Uwe Schulzweida over 12 years ago
The attribute valid_range defines all values outside this range to missing data.
You can delete this attribute also with the NCO operator ncatted:
ncatted -a valid_range,air,d,c,"" air.2m.gauss.2000.interpolated.nc
The setvrange operator can't be used because the data is set to missing value during the read process.