Project

General

Profile

Delete point/grid from data

Added by Patryk Sapiega over 2 years ago

Hi,

How to remove one point / one grid from the data? So as to get the data without this point.

I tried:

cdo -delete, remapnn, lon = 17.5 / years = 54.5 in.nc out.nc

but it doesn't work.

For example, the sellonlat command will not work because the data to be cut is inside


Replies (4)

RE: Delete point/grid from data - Added by Karin Meier-Fleischer over 2 years ago

Hi Patryk,

I don't know what you exactly want to do with the part lon = 17.5 / years = 54.5.

If you want to overwrite a cell or area with missing value you can use the expr operator and clon / clat functions.

E.g.

cdo -expr,'tsurf=((clon(tsurf)>=0.0)&&(clon(tsurf)<=20.0)&&(clat(tsurf)>=0.0)&&(clat(tsurf)<=20.0)) ? (tsurf/0.0) : tsurf' \
          infile.nc outfile.nc

RE: Delete point/grid from data - Added by Patryk Sapiega over 2 years ago

sorry, it should be lat instead of a year.

basically I mean dropping one point and delivering data without that point.
Will your command work for this?

What do U think about this:

Cdo -delete, gridnum=2,7,0.5 input output, but i dont know how i can check number grids.

In the preview, it shows me that this grid is i = 2, j = 7. The data resolution is 0.5 degrees, but it keeps telling me that I didn't specify the variable or some other error

RE: Delete point/grid from data - Added by Karin Meier-Fleischer over 2 years ago

In my opinion you can't drop a cell from a grid with CDO.

RE: Delete point/grid from data - Added by Patryk Sapiega over 2 years ago

I have a solution! :)

Maybe it will be useful for the next generations hahaha

1. First we check the value of the grid without data, the so-called empty grid. It is not always 0 or N / A.

ncview input.nc and move the cursor over one of the empty grids and then in the currents line: look at the value by the index coordinates, that is: currents: (i = X1, j = X1) -666 (x = X2, y = X2) .
Our lookup value is "-666"

Then a command for the cell coordinates (54.5 N, 17.5 E)
cdo setclonlatbox, -666,17.5,17.5,54.5,54.5 input.nc oputput.nc

and we have a file with a removed / hidden cell (grid).

    (1-4/4)