Missing values are not dealt with correctly in "timselsum"
Added by Jia Wang 5 months ago
I have 4 times 6-hourly precipitation for a day, and I want to calculate the daily precipitation total.
The 6-hourly precipitation files are:
ST4.2015120206.06h.grb2
ST4.2015120212.06h.grb2
ST4.2015120218.06h.grb2
ST4.2015120300.06h.grb2
I first put them into a single file:
grib_copy ST4.2015120206.06h.grb2 ST4.2015120212.06h.grb2 ST4.2015120218.06h.grb2 ST4.2015120300.06h.grb2 1.grb
Then I add 6-hourly precipitation to get daily precipitation:
cdo --timestat_date last timselsum,4 1.grb 2.grb
Using "grib_ls -p missingValuesPresent,numberOfDataPoints,numberOfMissingValues", I know that each 6-hourly precipitation file has missing values:
ST4.2015120206.06h.grb2: # of missing = 270159
ST4.2015120212.06h.grb2 : # of missing = 270159
ST4.2015120218.06h.grb2 : # of missing = 270159
ST4.2015120300.06h.grb2: # of missing = 270229
But when I check the number of missing values for the daily precipitation 2.grb, it has less missing values compared to each individual 6-hour file:
2.grb: # of missing = 270129
The only explanation is that, as long as a grid has at least 1 valid value out of 4 times, "timselsum" will treat this grid as NOT missing.
How to avoid this?
ST4.2015120300.06h.grb2 (1.23 MB) ST4.2015120300.06h.grb2 | |||
ST4.2015120212.06h.grb2 (1.23 MB) ST4.2015120212.06h.grb2 | |||
ST4.2015120218.06h.grb2 (1.23 MB) ST4.2015120218.06h.grb2 | |||
ST4.2015120206.06h.grb2 (1.23 MB) ST4.2015120206.06h.grb2 | |||
1.grb (4.92 MB) 1.grb | |||
2.grb (1.23 MB) 2.grb |
Replies (2)
RE: Missing values are not dealt with correctly in "timselsum" - Added by Uwe Schulzweida 5 months ago
Only the avg function in CDO handles missing values as you need (https://code.mpimet.mpg.de/projects/cdo/embedded/index.html#x1-510001.9.1).
Here is a workaround to calculate the sum from avg:
cdo --timestat_date last mulc,4 -timselavg,4 1.grb 3.grb 3.grb: # of missing = 270259
RE: Missing values are not dealt with correctly in "timselsum" - Added by Jia Wang 5 months ago
Thanks for the amazing workaround.