Project

General

Profile

Operator to fill in missing values using interpolation

Added by Andreas Hilboll almost 11 years ago

Hi,

sorry if such an operator exists and I was just too blind to find it ...

Given a dataset which contains missing values, it would be nice to have an operator which fills in using these missing data points using some interpolation of the surrounding points.

Is there anything like this in CDO? If not, is it planned to implement such a feature? Or maybe you know of an alternative way to achieve this?

Cheers, Andreas.


Replies (4)

RE: Operator to fill in missing values using interpolation - Added by Uwe Schulzweida almost 11 years ago

Hi Andreas,

Try the undocumented CDO operator fillmiss. This operator fills missing values by a bilinear interpolation of the four surrounding points. The status of this operator is experimental and it works only on rectilinear grids.

Cheers,
Uwe

RE: Operator to fill in missing values using interpolation - Added by Andreas Hilboll almost 11 years ago

Uwe,

thanks a lot for this! For my use case, it works like a charm. Wow.

I should note, however, that extrapolation towards the poles doesn't seem to work properly. This is my grid:

gridtype  = lonlat
gridsize  = 29040
xname     = lon
xlongname = longitude
xunits    = degrees_east
yname     = lat
ylongname = latitude
yunits    = degrees_north
xsize     = 240
ysize     = 121
xfirst    = 0
xinc      = 1.5
yfirst    = -90
yinc      = 1.5

All my values at 90N and 90S are nan. When using the fillmiss operator, the values from 88.5° are simply copied to 90°, leading to 240 different values for the pole, which at least physically doesn't make sense.

In my use case, it doesn't matter, but I just wanted to point you to this issue.

Cheers, Andreas.

RE: Operator to fill in missing values using interpolation - Added by Miles Sowden over 1 year ago

Just a comment, (as this is probably best fixed with setmisstonn),
the north issue is as a result of the boundary (north) being wrong. It may be best to set all boundaries to zero prior to using fillmiss.

RE: Operator to fill in missing values using interpolation - Added by Brendan DeTracey over 1 year ago

Another comment. Rectilinear lat-lon grids that include 90N/S (as a center point of a grid cell) are a very bad practice, although they are still commonly used.

    (1-4/4)