Edit values for a particular variable in a NETCDF file

105 views Asked by At

I downloaded 30 year rainfall data (1976-2005) in NETCDF format from Climate Data Store. When I plotted a time series of the data, I could see that for July 2005 values are abnormally higher than for same period in previous years. That is probably an error in the data that needs correction. I am unable to find a way to change the values for the period and replace it with average rainfall values for July period. I tried doing it using cdo but could not find a way out. How can I do that using cdo, R or any other tool?

1

There are 1 answers

2
ClimateUnboxed On

Well I could answer this directly, but I'm going to risk the wrath of the "this doesn't answer the question" down-voter police by suggesting that this is perhaps not the best way to go. Firstly, it is misleading to insert data that is just a climatology (you would need to flag it in the meta data at the very least) and secondly, if you intend to use this for any applications they will likely give incorrect results if you pass smooth climate averages rather than a typical on-off rain series as most applications (crop production, vector borne health impacts, hydro-electricity production etc etc) are strongly nonlinear functions of rainfall, which is a non-smooth variable.

Thus the usual thing to do would be to flag this as missing. If you know your bad range starts from e.g. X upwards, then set a range to missing like this

cdo setrtomiss,X,1e32 in.nc out.nc