Re: using environment variables in NCL script: arrays

From: Dave Allured - NOAA Affiliate <dave.allured_at_nyahnyahspammersnyahnyah>
Date: Wed May 22 2013 - 17:03:48 MDT

Cathy,

In Perl, create a single long string containing numbers separated by
spaces, e.g. "100 200 300". Assign this long string value to the
environment variable. Other delimiters are possible, if space is not
available for some reason.

Then in NCL:
levels = toint (str_split (getenv ("levels", " ")))

--Dave

On Wed, May 22, 2013 at 10:42 AM, Cathy Smith (NOAA Affiliate)
<cathy.smith@noaa.gov> wrote:
> NCL users
> I call NCL scripts using Perl so I can change input parameters for the
> script. For example, in Perl
>
> $ENV{'psname'}=$name;
>
> and in NCL
>
> psname=(getenv("psname"))
>
> I'd like to pass an array to NCL. How would I read this in NCL?
>
> Perl would have something like
>
> $ENV{'levels'}=@level_array;
>
> and the array size could vary (though I can guarantee it to have at least 1 value). I have done this in the past by sending a netCDF file filled with the array values but would prefer to avoid the extra file.
>
> Thanks for any suggestions!
>
> Cathy Smith
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed May 22 17:04:04 2013

This archive was generated by hypermail 2.1.8 : Thu May 30 2013 - 11:38:10 MDT