Re: Interpolation from a regular to an irregular grid? [message #35062] |
Wed, 07 May 2003 09:13 |
JD Smith
Messages: 850 Registered: December 1999
|
Senior Member |
|
|
On Wed, 07 May 2003 02:58:12 -0700, Evan Mason wrote:
> Hi, I am kind of new to IDL, and have just started a new job in physical
> oceanography in Portugal. At present I am familiarising myself with
> IDL, which I will be using extensively.
>
> One of my first tasks is to find a way to input satellite collected wind
> data into an ocean model that is being run here. The wind data are
> regularly spaced, whereas the model requires the data in a series of
> irregularly spaced intervals.
>
> Looking through the messages on this group I see many questions and
> answers about working from irregular to regular grids using Triangulate
> and Trigrid, but I wonder if anyone knows how to do the reverse?
>
The reverse is the easy case -- just interpolate:
wind=exp(dist(10)/sqrt(10))
ocean_x=randomu(sd,30)*10
ocean_y=randomu(sd,30)*10
ocean_wind=interpolate(wind,ocean_x,ocean_y,CUBIC=-0.5)
This skips an important step you'll have to perform: converting your
two coordinate systems to match each other. Note that INTERPOLATE
treats pixels as integer-centered, e.g. the lower-left pixel is
centered at [0.0,0.0]. I've always found this sort of grid rather
unphysical, preferring instead to range from 0->n on the (left,bottom)
to (top,right) edge of the grid, i.e. lower-left pixel centered at
[0.5,0.5]. You'll need to keep this in mind when you convert your
ocean grid coordinates into the logical coordinate system of the wind
data array.
For very large grids, you might care about the finite curvature of the
earth, in which case you'll want to interoplate on a sphere -- see the
beautifully-named SPH_SCAT routine in that case.
Good luck,
JD
|
|
|
Re: Interpolation from a regular to an irregular grid? [message #35063 is a reply to message #35062] |
Wed, 07 May 2003 08:51  |
mvukovic
Messages: 63 Registered: July 1998
|
Member |
|
|
emason@ipimar.pt (Evan Mason) wrote in message news:<121509ef.0305070158.78fa0d8a@posting.google.com>...
> Hi, I am kind of new to IDL, and have just started a new job in
> physical oceanography in Portugal. At present I am familiarising
> myself with IDL, which I will be using extensively.
>
> One of my first tasks is to find a way to input satellite collected
> wind data into an ocean model that is being run here. The wind data
> are regularly spaced, whereas the model requires the data in a series
> of irregularly spaced intervals.
>
> Looking through the messages on this group I see many questions and
> answers about working from irregular to regular grids using
> Triangulate and Trigrid, but I wonder if anyone knows how to do the
> reverse?
>
> Thanks
>
> Evan Mason
Nothing specific comes to mind. But did you consider various
interpolation routines available in IDL?
Mirko
|
|
|
Re: Interpolation from a regular to an irregular grid? [message #35064 is a reply to message #35063] |
Wed, 07 May 2003 07:05  |
btt
Messages: 345 Registered: December 2000
|
Senior Member |
|
|
Evan Mason wrote:
> Hi, I am kind of new to IDL, and have just started a new job in
> physical oceanography in Portugal. At present I am familiarising
> myself with IDL, which I will be using extensively.
>
> One of my first tasks is to find a way to input satellite collected
> wind data into an ocean model that is being run here. The wind data
> are regularly spaced, whereas the model requires the data in a series
> of irregularly spaced intervals.
>
> Looking through the messages on this group I see many questions and
> answers about working from irregular to regular grids using
> Triangulate and Trigrid, but I wonder if anyone knows how to do the
> reverse?
>
Hello,
The XOUT and YOUT keywords to TRIGRID and GRIDDATA (IDL version 5.5 and
higher) gives you control of irregular gridding.
This is from the online help for IDL 5.6
XOUT
Set this keyword to a vector specifying the output grid X values. If
this keyword is supplied, the GS and Limits arguments are ignored. Use
this keyword to specify irregularly spaced rectangular output grids. If
XOUT is specified, YOUT must also be specified. If keyword NX is also
supplied then only the first NX points of XOUT will be used.
Ben
|
|
|