Re: problem with "closest_val"

From: Dave Allured <dave.allured_at_nyahnyahspammersnyahnyah>
Date: Mon, 08 Sep 2008 12:28:19 -0600

Unexpected results from closest_val has been discussed before.

Either use the short substitute function shown at the bottom of the
function documentation page:

http://www.ncl.ucar.edu/Document/Functions/Contributed/closest_val.shtml

Or else use this, which is the same thing:

   i = minind (abs (xarray - x))

Dave Allured
CU/CIRES Climate Diagnostics Center (CDC)
http://cires.colorado.edu/science/centers/cdc/
NOAA/ESRL/PSD, Climate Analysis Branch (CAB)
http://www.cdc.noaa.gov/

Marco Pastore wrote:
> Hi all.
>
> I tried to use this function in one script, to find index of a model
> grid, corresponding to definite lon,lat cordinates.
> I have an 1-D array (i.e. latitude between 39 and 44, float, with 311
> values).
> If i try to pass to the closest_val function a value greater than the
> max value in the array, the function give me as results the index 311,
> that not exist.
>
> It is correct ?
>
> Thanks, ciao Marco
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Sep 08 2008 - 12:28:19 MDT

This archive was generated by hypermail 2.2.0 : Mon Sep 08 2008 - 14:49:02 MDT