Re: data types and functions

From: Dave Allured <dave.allured_at_nyahnyahspammersnyahnyah>
Date: Mon, 13 Apr 2009 17:31:02 -0600

Dan,

This method is called "String references" in NCL. Currently, string
references are in the language for only some specific purposes:

* File variables with unknown names
* Attributes with unknown names
* Coordinate variables with unknown names

http://www.ncl.ucar.edu/Document/Manuals/Ref_Manual/NclVariables.shtml#StringRef
http://www.ncl.ucar.edu/Document/Manuals/Ref_Manual/NclVariables.shtml#FileStringRef

In contrast, memory variables are handled with explicit names only.
  All methods of creating an NCL memory variable use an explicit
name. The name must already be typed into the script at least once.
  Therefore it is not "unknown", so it must be referenced with its
explicit name.

If you keep your variables in a supported file such as Netcdf, then
you should be able to loop over the names in the way that you
envision. Would it be feasible to simply keep the data as file
variables only? Then you could read them into generically named
memory variables when needed for data processing.

Now it is conceivable to extend the NCL language to allow string
references for memory variables. I recall a discussion that touched
on this, a few weeks ago on this list. There was nothing proposed
for the near future.

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/psd1/

Dan Barrie wrote:
> Dear NCL users,
>
> I am trying to loop through different variables by calling them by name
> using an array with their various names predefined. To simplify my
> question, I provide the following example:
>
> If I have defined a variable named "winds", I can easily print out the
> values it contains using the command print(winds).
>
> However, if I have defined a variable named winds, and another variable
> named winds_name = "winds", I cannot print out the values contained in
> winds by typing print(
> winds_name). Essentially, I need NCL to not care about the difference
> between winds and winds_name. Is this possible? I tried using the
> coercion functions, but that doesn't seem to be where the issue lies.
> Thanks in advance for the help.
>
> -Dan
> _______________________________________________
> 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 Apr 13 2009 - 17:31:02 MDT

This archive was generated by hypermail 2.2.0 : Thu Apr 16 2009 - 10:05:49 MDT