<div dir="ltr"><div>A strength of NCL is that, the variable data structure adheres to the classic netCDF variable data structure. ie: NCL variables 'look like' netCDF variables. This includes following the variable rules established by netCDF. One netCDF variable 'rule' is that a variable attribute can not have an attribute. In short, there <b>can not</b> be an <b>'attribute cascade'</b> [ie: attributes having attributes that have attributes .... etc)<br></div><div><br></div><div><b>By default</b>, when the NCL <a href="http://www.ncl.ucar.edu/Document/Functions/Built-in/new.shtml"><b>new</b></a>  statement is used as follows: <br><br>      xxx = <a href="http://www.ncl.ucar.edu/Document/Functions/Built-in/new.shtml"><b>new</b></a>((/nest,ndays/),"string")   <i>; no _FillValue specified </i><br><br></div><div>it will <b>automatically create </b>a _FillValue appropriate to the variable type.<br></div><div>To avoid this, as documented, you can specify <b>"No_FillValue" </b>and no attribute will be created.<br></div><div> <br></div><div><div><br>ncl 0> DATE = 0<br>ncl 1> nest = 2<br>ncl 2> ndays =3<br>ncl 3> DATE<b><span style="color:rgb(0,0,255)">@</span>date</b> = new((/nest,ndays/),"string"<b>,"No_FillValue"</b>)  <br><br>This <b>works </b>because the attribute '<b>date</b>' will <b>not itself have any attribute</b>. ie: no attribute cascade.<br>-----<br></div><div>netCDF does <b>*NOT* </b>support multi-dimensional attributes<br><br></div><div><b>NCL allows the creation of multi-dimensional attributes within a script.</b><br>Again .. no attributes can be associated with an attribute.<br><br>However, NCL does <b>NOT support <span style="color:rgb(0,0,255)"><i>directly </i></span>accessing the multi-dimensional attribute</b>. <br>The script must explicitly extract the attribute and make it a distinct  variable..<br><br>ncl 4> <i>date_att</i> = DATE@date             ; extract the multidimensional attribute to a variable<br>ncl 5> printVarSummary(date_att)       ; two-dimensions<br><br>Variable: <i>date_att</i><br>Type: string<br>Total Size: 48 bytes<br>            6 values<br>Number of Dimensions: 2<br>Dimensions and sizes:    <b>[2] x [3]</b><br>Coordinates: <br><br></div><div>ncl 6> qqq = date_att(1,2)                   ; access an element of the variable<br><br>ncl 7> QQQ = DATE@date(1,2)          ; NCL does <b>not </b>support direct access to an element <br></div><div>                                                             ; within a multidimensional attribute<br><br></div><div><span style="color:rgb(255,0,0)"><b>fatal:</b></span>Attributes only have one dimension, 2 subscripts used<br><span style="color:rgb(255,0,0)"><b>fatal:</b></span>["Execute.c":8638]:Execute: Error occurred at or near line 7<br><br>=============<br><br></div><div>A bit more:<br><br></div><div>As noted: Attributes can not  have other attributes associated with them.<br></div><div>Also, attributes can not have named dimensions or coordinate variables.<br><br>=============<br><br></div><div>Hope this helps!<br></div><div>Cheers<br></div><div>D<br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Aug 19, 2018 at 11:19 AM, Francesco Trotta <span dir="ltr"><<a href="mailto:francesco.trotta4@unibo.it" target="_blank">francesco.trotta4@unibo.it</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">




<div dir="ltr" style="font-size:12pt;color:#000000;background-color:#ffffff;font-family:Calibri,Arial,Helvetica,sans-serif">
<p><font size="2" face="Calibri,Arial,Helvetica,sans-serif"><span style="font-size:16px;background-color:white;font-weight:normal;text-transform:none">Dear
<span name="searchHitInReadingPane" id="m_-58508786388880159730.7344792469635416" class="m_-5850878638888015973highlight">ncl</span>-support</span></font>,</p>
<p>    I'm using attributes to define 2D array but I get this error:<br>
</p>
<p><br>
</p>
<p>fatal:Attributes only have one dimension, 2 subscripts used<br>
fatal:["Execute.c":8640]:<wbr>Execute: Error occurred at or near line 416 in file ./procPREPRO_surf.ncl</p>
<p><br>
</p>
<p>Usually I define 1d array with attribute and it is all right but with 2d array the program stop.<br>
</p>
<p>Here some lines of the code where the program stop:<br>
</p>
<p><br>
</p>
<p>   DATE@date        = new((/nnest,ndays_max+15/),<wbr>string,"")<br>
   DATE@year        = new((/nnest,ndays_max+15/),<wbr>string,"")<br>
   DATE@mounth   = new((/nnest,ndays_max+15/),<wbr>string,"")<br>
   DATE@day          = new((/nnest,ndays_max+15/),<wbr>string,"")<br>
  <br>
   do inest=0,nnest-1<br>
<br>
      ;compute date yyyymmdd of the simulation<br>
      iday  = 0<br>
      DATE@date(inest,iday) = runMan_date000(inest)</p>
<p>      .......</p>
<p><br>
</p>
<p><br>
</p>
<p>   Can I define 2d array via attribute in ncl?</p>
<p>   If not, is there a way to define a data structure with heterogeneous multiple arrays 2d, 1d or scalar?</p>
<p><br>
</p>
<p>   Thanks</p><span class="HOEnZb"><font color="#888888">
<p>Francesco<br>
</p>
</font></span></div>

<br>______________________________<wbr>_________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/<wbr>mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>