Project

General

Profile

Request - sellonlatbox for one grid cell just as selindexbox

Added by Matthias Cuntz almost 14 years ago

Dear esteemed CDO developers,

I wondered why selindexbox can select a single grid cell but sellonlatbox can not?

If I want to extract values at measurement stations, for example, I have to go via selindexbox and have to find the indeces for a given lat/lon in a painful shell process (the shell is not made for this).
Even if I want to extract a rectangle around the point, I first extract the single point to check that I am doing right (e.g. with ncview or similar), so I almost always have to go via selindexbox.

I thought that this is a common procedure that one compares model with observational time series.

Thanks a lot
Matthias


Replies (2)

RE: Request - sellonlatbox for one grid cell just as selindexbox - Added by Uwe Schulzweida almost 14 years ago

Hi Matthias,

It's possible to select a single grid cell with sellonlatbox but this isn't a user friedly procedure because you need to know the exact coordinates of that grid cell. This grid cell have to be inside a lon/lat box. Here is an example to select a grid cell at lon=20.5/lat=42.5:

cdo sellonlatbox,20.49,20.51,42.49,42.51 ifile ofile

To make it short, sellonlatbox was not implemented to select only a single grid cell.
I would recommend to use remapnn to select a single grid cell. This operator finds the nearest grid cells. The parameter for this operator is a description of the target grid. Use the special description lon=<lon>/lat=<lat> to define a target grid with only one grid point. Here is the same example to select a grid cell at lon=20.5/lat=42.5 with remapnn:
cdo remapnn,lon=20.5/lat=42.5 ifile ofile

Best regards,
Uwe

RE: Request - sellonlatbox for one grid cell just as selindexbox - Added by Matthias Cuntz almost 14 years ago

Dear Uwe,

ah, I understand now that there must be the mid-point of the grid cell between the lon1 and lon2 for sellonlatbox. This is indeed very fiddly.

remapnn works great. And together with the special grid description, it is real expert knowledge.

Thanks a lot
Matthias

    (1-2/2)