Project

General

Profile

Multiple parallel interpolations for disparate single grid points

Added by Richard Harvey 12 months ago

Hello,

I posted a question similar to this one over a year ago but could not do a follow-up.

I need to interpolate data over a given domain, not for a continuous subregion, but for hundreds of single, disparate geographical points scattered throughout the domain, whose coordinates I know in advance. I currently do this in Python with the cdo.remapxxx operator inside a parallel loop, but I was wondering if there was a more elegant way, i.e., to exploit cdo's inherent parallelism and do this in one fell swoop, i.e., use a single cdo statement.

Right now the pseudo-code I use is:

Start parallel loop:
For each set of coordinates lon1/lat1:
time_series[lon1, lat1] = cdo.remapbil(lon=" + lon1 + "/" + "lat=" + lat1, input=file)

The equivalent command line would be for say lon1=-73, lat1=40:

cdo -remapbil,lon=-73/lat=40 input_file output_file

I would like to be able to submit the entire list of coordinates as input parameters to a single remapbil call instead of just the lone lon=xx/lat=xx.

Is there a clever way to do this with cdo ?

I've attached a test file of HRRR temperature data over NErn US subregion, spanning a complete forecast period.

Sincere thanks in advance.

Richard H


Replies (2)

RE: Multiple parallel interpolations for disparate single grid points - Added by Uwe Schulzweida 12 months ago

Hello Richard,

you can create a CDO grid desciption file for an unstructured grid and put all your grid points there. Here is an example with 3 points:

cat > mypoints << EOF
gridtype  = unstructured
gridsize  = 3
xvals     = -73 -73 -73
yvals     =  40  45  50
EOF

cdo -remapbil,mypoints input_file output_file
The interpolated values are the same as:
cdo -remapbil,lon=-73/lat=40 input_file output_file1
cdo -remapbil,lon=-73/lat=45 input_file output_file2
cdo -remapbil,lon=-73/lat=50 input_file output_file3
Cheers,
Uwe

RE: Multiple parallel interpolations for disparate single grid points - Added by Richard Harvey 12 months ago

Thank you very much Uwe, I think this will do what I want. Much appreciated!

Richard

    (1-2/2)