Project

General

Profile

change values within range of lat lon data

Added by Yousef Albuhaisi over 4 years ago

Hi,

I have data of (lats=170, lons=401) for Scandinavia resion, the actual lat lon is 2,42 and 55,72 respectively, and I want to manipulate specific lat and lon and assign a new value to it. For more explanation,

my data is :
  1. lat lon value
    63 25 56.1328
    63 25.1 56.1328
    63 25.2 56.1328
    63 25.3 56.1328
    63 25.4 56.1328
    63 25.5 56.1328
    63.1 25 55.9404
    63.1 25.1 55.9404
    63.1 25.2 55.9404
    63.1 25.3 55.9404
    63.1 25.4 55.9404
    63.1 25.5 55.9404
    63.2 25 55.7479
    63.2 25.1 55.7479
    63.2 25.2 55.7479
    63.2 25.3 55.7479
    63.2 25.4 55.7479
    63.2 25.5 55.7479
    63.3 25 55.5552
    63.3 25.1 55.5552
    63.3 25.2 55.5552
    63.3 25.3 55.5552
    63.3 25.4 55.5552
    63.3 25.5 55.5552
    63.4 25 55.3623
    63.4 25.1 55.3623
    63.4 25.2 55.3623
    63.4 25.3 55.3623
    63.4 25.4 55.3623
    63.4 25.5 55.3623
    63.5 25 55.1693
    63.5 25.1 55.1693
    63.5 25.2 55.1693
    63.5 25.3 55.1693
    63.5 25.4 55.1693
    63.5 25.5 55.1693

and I want it to be like this:

lat lon value
63 25 100
63 25.1 0
63 25.2 0
63 25.3 0
63 25.4 0
63 25.5 0
63.1 25 100
63.1 25.1 0
63.1 25.2 0
63.1 25.3 0
63.1 25.4 0
63.1 25.5 0
63.2 25 100
63.2 25.1 0
63.2 25.2 0
63.2 25.3 0
63.2 25.4 0
63.2 25.5 0
63.3 25 100
63.3 25.1 0
63.3 25.2 0
63.3 25.3 0
63.3 25.4 0
63.3 25.5 0
63.4 25 100
63.4 25.1 0
63.4 25.2 0
63.4 25.3 0
63.4 25.4 0
63.4 25.5 0
63.5 25 100
63.5 25.1 0
63.5 25.2 0
63.5 25.3 0
63.5 25.4 0
63.5 25.5 0

Thanks in Advance

Yousef


Replies (2)

RE: change values within range of lat lon data - Added by Ralf Mueller over 4 years ago

hi!
I am not sure if

  1. you want to change the value of a coordinate lon and lat or
  2. you want to change the value at a certain coordinate

The first case is not possible with CDO, the second sould be doable with the expr operator. Something like

cdo -expr,'var=((clon(var)==63.2 && clat(var)==25) ? 100 : var)' in.nc out.nc

hth
ralf

RE: change values within range of lat lon data - Added by Yousef Albuhaisi over 4 years ago

HI,

Thank you!

Yes, I want to change the value at a certain coordinate or values in a range of coordinates say from (lat,20,32 lon, 30,42).

How can I do that in one step instead?

Regards.

    (1-2/2)