<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Hi Hannah,<br>
You can attach a variety of attribute arrays to one data object,
in effect creating dynamic variables:<br>
<br>
DATA = True<br>
<br>
do i = 0, imax-1<br>
<get time data><br>
<read in new data or whatever, store it as "newdata"><br>
array_name = <time>.imax<br>
DATA@$array_name$ = newdata<br>
end do<br>
<br>
So all your dynamic arrays would live on the DATA object and could
be retrieved or destroyed later. They would not all have to have the
same dimensions, types, and can be named whatever you want.
Advantages are that this is a handy quick way to read in lots of
data with different dimensions, and NCL currently doesn't have a way
to dynamically create and work with variables without knowing their
names in advance. Disadvantages of this method are that you can't
attach additional attributes to the attribute arrays, so things like
_FillValue might have to be added explicitly later on. Another
disadvantage is that processing could get exponentially slower for
certain operations if the total number of attached elements becomes
too large (maybe a million, or a hundred million?). And finally, to
store all the dynamic variables as a netCDF file, you'd need to
basically unpack the attribute arrays into real variables, add the
dimensions, _FillValues, etc. It's possible using NCL to write it's
own NCL code dynamically, but it's not pretty. Things would get a
lot easier if NCL had an "eval" statement. <br>
<br>
Jonathan <br>
<br>
<br>
<br>
<br>
<br>
<br>
On 02/09/2011 10:01 AM, Nissan, Hannah wrote:
<blockquote
cite="mid:EAE082B4A9EC204688BE8C2C965B96C408263B96BE@ICEXM1.ic.ac.uk"
type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
<meta name="Generator" content="Microsoft Word 12 (filtered
medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
<div class="WordSection1">
<p class="MsoNormal"><span lang="EN-GB">Hello,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">I am looking for a way
to dynamically name an array in NCL. I am running a loop
through time and creating an array which I need to name
according to the time period or loop. Can anyone help?<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">Thanks very much,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">Hannah<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
<a class="moz-txt-link-freetext" href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a>
</pre>
</blockquote>
<br>
<br>
<pre class="moz-signature" cols="72">--
------------------------------------------------------
Jonathan Vigh        
Postdoctoral Fellow, Advanced Study Program
National Center for Atmospheric Research
Mesoscale & Microscale Meteorology Division
Foothills Lab 3 - Rm. 3081
Office: 303-497-8205
Cell: 720-347-9337
------------------------------------------------------
</pre>
</body>
</html>