Project

General

Profile

CDO nearest neighbour grid issue :(

Added by andrea hurtado about 10 years ago

Hello!

I am new to CDO, so maybe this issue has been solved before but I have not found the answer so far, hope you can help me with this issue! :) many thanks in advance.
I have two NC files one for soil parameters with a structure as follows:

1> ./qrparm.soil_HWSD_class3_van_genuchtenNew.nc (default)
name title I J K L M N
FIELD342 1:67209 ... ... ... ... ...
FIELD336 1:67209 ... ... ... ... ...
FIELD335 1:67209 ... ... ... ... ...
FIELD333 1:67209 ... ... ... ... ...
FIELD332 1:67209 ... ... ... ... ...
LONGITUDE1 1:67209 ... ... ... ... ...
LATITUDE1 1:67209 ... ... ... ... ...

And I need to obtain a new file base on LONGITUDE and LATITUDE from this other file:

1> ./WFD-land-lat-long-z.nc (default)
name title I J K L M N
LONGITUDE2
1:67420 ... ... ... ... ...
LATITUDE2 1:67420 ... ... ... ... ...
LAND 1:67420 ... ... ... ... ...
(invalid coordinate axis)
GRID_LON 1:67420 ... ... ... ... ...
GRID_LAT 1:67420 ... ... ... ... ...
Z 1:67420 ... ... ... ... ...

The issue is that the missing points are scatered all over the file and shift the other values to a new "position" within the sencond file, please do not ask me to erase the extra points from the second file because as this one there are many other files like this one for other variables and months which I think would be difficult to modify, so it is easy for me to modify the shorter file (as is only one) by introducing the "missing" points but providing that each pair of coordinates agrees with is value and the extra points acquire one with the nearest neighbour approach

LATITUDE2  LONGITUDE2 LATITUDE1 LONGITUDE1
I / 1: 71.25 -179.8 71.25 -179.8
I / 2: 70.75 -179.8 71.25 -179.8
I / 3: 68.75 -179.8 68.75 -179.8
I / 4: 68.25 -179.8 68.25 -179.8
I / 5: 67.75 -179.8 67.75 -179.8
I / 6: 67.25 -179.8 67.25 -179.8
I / 7: 66.75 -179.8 66.75 -179.8
I / 8: 66.25 -179.8 66.25 -179.8
I / 9: 65.75 -179.8 65.75 -179.8
I / 10: 65.25 -179.8 65.25 -179.8
I / 11: -16.25 -179.8 71.25 -179.8
I / 12: 71.75 -179.2 71.25 -179.8
I / 13: 71.25 -179.2 71.25 -179.2
I / 14: 70.75 -179.2 71.25 -179.8
I / 15: 68.75 -179.2 68.75 -179.2
I / 16: 68.25 -179.2 68.25 -179.2
I / 17: 67.75 -179.2 67.75 -179.2
I / 18: 67.25 -179.2 67.25 -179.2
I / 19: 66.75 -179.2 66.75 -179.2
I / 20: 66.25 -179.2 66.25 -179.2

the pairs in bold are the ones missing from the first file, how can I get a new file with values for "FIELDSXXX" but with grid structure of the the second file? again providing coordinate pairs and values correspond and extra points get a value for each FIELDXXX using the nearest neighbour approach, hope it all makes sense, I will be really gratuful if you can help me with this, I look forward to hearing from you soon.

All the Best

Andrea Hurtado