comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Re-gridding Problem
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Re-gridding Problem [message #58498 is a reply to message #58489] Wed, 30 January 2008 08:03 Go to previous messageGo to previous message
Kenneth P. Bowman is currently offline  Kenneth P. Bowman
Messages: 585
Registered: May 2000
Senior Member
In article <MPG.22093dcc1a580def9896aa@news.frii.com>,
David Fanning <news@dfanning.com> wrote:

> Folks,
>
> I've heard the astro guys talk about this from time to time, so I
> thought I would ask.
>
> I have some output from the climate modeling folks. I need this
> data on a regular grid. Unfortunately, the data is *slightly*
> regular. Here is one of my cases (I have several all like this,
> but different).
>
> The data is on a regular 1-deg grid in the longitudinal direction.
> It is on a regular 1 deg grid in the latitudinal direction,
> EXCEPT between -30 and + 30 degrees, where it is on a gradually
> decreasing grid to 1/3 of a degree at the equator.
>
> I would like a grid that is everywhere sampled on a 1 degree grid.
> So, my idea is to superimpose a 1-deg grid over my data and resample.
> It is going to get messy. :-(
>
> My question is this. Does anyone have any code to share that can
> oversample like this?

(I think you mean you want to undersample, correct? That is, you want a
lower resolution grid than the original data.)

This is pretty easy with INTERPOLATE.

Assuming that your data is 2-D (x = longitude and y = latitude), create
the grids that you want to interpolate to

nx = 360
ny = 181

x = FINDGEN(nx)
y = -90.0 + FINDGEN(ny)

Compute the "interpolation coordinates" from the original grid

j = VALUE_LOCATE(y_original, y)
yj = j + (y - y_original[j])/(y_original[j+1] - y_original[j])

Since the input and output grids are the same in the x-direction, you
don't need to do anything with x. Expand x and yi into 2-D arrays

xx = REBIN(x, nx, ny, /SAMPLE)
yy = REBIN(REFORM(yi, 1, ny), nx, ny, /SAMPLE)

Then interpolate

new = INTERPOLATE(original, xx, yy)

Ken
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: automatic placement of legend in 2-D graph
Next Topic: Re: workbench filenames and program names

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 20:02:30 PDT 2025

Total time taken to generate the page: 0.02880 seconds