Re: Documentation on String References

From: David Brown <dbrown_at_nyahnyahspammersnyahnyah>
Date: Mon Mar 01 2010 - 16:14:16 MST

Hi Bruce,

Actually, there is an error in this documentation. Thanks for calling
attention to it. The function 'iscoord' takes two arguments, so the
code fragment should begin with:

if (iscoord(temperature,dimnames(0)) then

  At this point, once you know that dimnames(0) is a coordinate then
it must also be a dimension, so the following statements would yield
the same results
  assuming that dimnames(0) is actually the left-most dimension of the
temperature variable. However, this is not explicitly stated so it
cannot be guaranteed.

     coord0 = temperature&$temperature!0$
     ; or
     coord0 = temperature&$dimnames(0)$

Therefore the second statement would be more reliable. We will revise
this section of the reference manual.
  -dave

On Mar 1, 2010, at 2:09 PM, Lunde, Bruce N CIV NAVOCEANO, NP1 wrote:

> Hello,
>
> In following page on "String references"
>
> http://www.ncl.ucar.edu/Document/Manuals/Ref_Manual/NclVariables.shtml#StringRef
>
> should the last example concerning "dimnames()"
> make use of "dimnames()" in the line
>
> coord0 = temperature&$temperature!0$
>
> such as in
>
> coord0 = temperature&$dimnames(0)$
>
> or are you trying to show something else ?
>
> Thanks, Bruce
>
>
>
> String references
> Sometimes it is impossible to know the names of the attributes and
> coordinates before writing a script, or these names may vary from
> variable to variable. To solve this problem, string variables can be
> used to reference attributes and coordinates by enclosing the
> variable reference within dollar signs '$'. The following are
> examples of this:
> dimnames = (/"frtime","lat","lon"/)
> attnames = (/"_FillValue", "long_name"/)
>
> ;
> ; access to attribute
> ;
> att0 = temperature@$attnames(0)$
>
> ;
> ; Example of referencing a coordinate variable
> ; without knowing the dimension name
> ;
> if(iscoord(dimnames(0))
> coord0 = temperature&$temperature!0$
> end if
>
> _______________________________________________
> 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 Mon Mar 1 16:14:21 2010

This archive was generated by hypermail 2.1.8 : Thu Mar 04 2010 - 15:07:06 MST