Re: coordinate subscripting question

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Fri Apr 30 2010 - 09:59:50 MDT

Hi Erik,

There is no averaging occuring when you use coordinate subscripting. You will get
actual values in your array, if a coordinate match is found.

NCL tries to find the closest coordinate values *within* the range of the coordinate subscript(s)
you give it, and then it returns the data values at those locations.

If you specify a coord range whose begin and end values are completely outside
the range of your actual coord values, you will get an error that looks like this:

  fatal:NclOneDValGetClosestIndex: finish coordinate index out of range, can't continue
  fatal:Could not obtain coordinate indexes, unable to perform subscript

If you use a single coordinate value that is not within the range, you will also get an error.

If your coordinate values are, say, (/1,2,3,4,5,6/), and you use a coordinate subscript range
of {2.5:5.5}, then this will correspond to the range represented by the coordinate
values (/3,4,5/), because 3 > 2.5, and 5 < 5.5.

The best way to learn this stuff is to just play around with a dummy array yourself. I've
created a start NCL script for you. Try running it and see if you understand the output
you're getting. Add your own coordinate subscripting to see what happens.

Run this script with:

   ncl -n coords.ncl

so you don't get the annoying "(0)" at the beginning of every line.

--Mary

On Apr 30, 2010, at 8:11 AM, Erik Noble wrote:

> Hi.
> Coordinate subscripting is a NCL method that I use every day. But I am am trying to understand how it actually "works."
> I have read the description (below), but could some of the NCL developers please help me know more?
> For instance, if I use coordinate subscripting to extract a randomly selected named lat,lon point from 2.5 degree Reanalysis 2 data, how does the function work? Is any averaging occurring?
> Thank you ahead of time.
> Sincerely,
> Erik Noble
>
> http://www.ncl.ucar.edu/Document/Manuals/Ref_Manual/NclVariables.shtml#CoordinateSubscripts
> "Coordinate subscripts
> Coordinate subscripts use the coordinate variables associated with a variable to determine which indexes are used in the selection. When specifying a coordinate subscript, braces '{' and '}' indicate the start and end values of the coordinate variable that will be used to select the indexes. Essentially, the start and end values are "looked" up in the coordinate variable, and the indexes are used to make the subselection. The following are examples of coordinate subscripts. Note that coordinate and standard subscripting can be mixed in the same variable subscript. Also, stride is still specified as an integer stride. If the coordinate values used in the subscript do not exactly match values in the coordinate variable, all coordinate values that fall within the coordinate subscript range are selected. If the values do match, then they are selected in an inclusive fashion.
> temperature(0,{20:60},{-95:-120})
> temperature(0,{20},{-95})
> temperature(0,{:20:2},{:-95:2})
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Apr 30 10:00:40 2010

This archive was generated by hypermail 2.1.8 : Mon May 03 2010 - 14:51:25 MDT