# Re: Finding indices of nearest grid points...

```Hi Gary,

The task that you're describing would be pretty laborious with existing Ferret
functions and transforms. We have discussed for some time the need for an external
function

REGRID_CURV_XY(var,xnative,ynative,xout,yout,method)

* (xnative,ynative) would be the curvilinear coordinates native to "var"
* (xout,yout) is the desired (curvilinear) coordinates of the output.
* The result would inherit the X and Y axes from xout and yout.
* "method" would be a parameter controlling whether regridding is by linear
interpolation, by averaging, by spline interpolation, ...

The external function machinery for doing this calculation is routine -- the effort
would all be in the curvilinear regridding algorithm(s). (Maybe Numerical Recipes

Anyone care to take on this job? (One user in France told me recently that he
already has a similar external function.)

- steve

======================================

Gary Strand wrote:

> I've been whacking away at this for a few days, and I'm mostly stumped.
>
> I've got two "curvilinear" grids and a mask specified on one of them. I'd like
> to create the same (ok, really close) masked area on the other grid. I've
> played with stepping through the lon/lat coordinates of the masked area on
> the 1st grid and finding the closest point on the 2nd (via subtraction and
> @LOC:0) but that doesn't quite work. I've also tried using @CIA and @CIB,
> but those aren't quite satisfactory either. To illustrate, here's a little
> gif of the two grids, the red points being the 2nd grid, the blue points be-
> ing the masked area of the first grid I want to replicate.
>
> Any ideers? Thanks!
>
> --
> Gary Strand                Climate Change Research Section, NCAR (303) 497-1336
> strandwg@ucar.edu                          http://www.cgd.ucar.edu/ccr/strandwg
>
>   ------------------------------------------------------------------------
>                          Name: med002.ncgm.gif
>    med002.ncgm.gif       Type: GIF Image (image/gif)
>                      Encoding: base64
>                   Description: med002.ncgm.gif
>
>   ------------------------------------------------------------------------
> --
> Gary Strand                 Climate Change Research Section, NCAR, 303-497-1336
> strandwg@ucar.edu                          http://www.cgd.ucar.edu/ccr/strandwg

--

|  NOAA/PMEL               |  ph. (206) 526-6080
Steve Hankin    |  7600 Sand Point Way NE  |  FAX (206) 526-6744
|  Seattle, WA 98115-0070  |  hankin@pmel.noaa.gov

```