<div dir="ltr"><div class="gmail_default" style="font-family:verdana,sans-serif">To piggyback on Phillipe&#39;s email. I just coincidentally came across this problem myself, worse though I get seg faults. </div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif">Easy work around but seg faults are never good. </div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif">e.g.</div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div class="gmail_default"><font face="verdana, sans-serif">res = True</font></div><div class="gmail_default"><font face="verdana, sans-serif"><div>res@test := new( (/10,10/) , float)<br></div><div>; print(res@test(0,3)) ;;; we can&#39;t do this, so is it actually a 1d array? </div><div>print(res@test(3))  ;; Seg fault. <br></div><div><br></div><div><br></div><div>~alan</div><div><br></div><div><br></div></font></div></div><div class="gmail_extra"><br><div class="gmail_quote">On 13 May 2015 at 17:01, Philippe Papin <span dir="ltr">&lt;<a href="mailto:ppapin@albany.edu" target="_blank">ppapin@albany.edu</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi David,<div><br></div><div>Thanks for the detailed reply and suggestions. I can easily assign the attribute values to a local variable! Also good to know that 2d arrays are allowed in attributes even if the are not fully supported!</div><div><br></div><div>Have a great day!</div><span class="HOEnZb"><font color="#888888"><div>-Philippe</div></font></span></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Wed, May 13, 2015 at 2:17 PM, David Brown <span dir="ltr">&lt;<a href="mailto:dbrown@ucar.edu" target="_blank">dbrown@ucar.edu</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Phillipe,<br>
That&#39;s a good question. Actually the error message, as you discovered,<br>
is a bit misleading. NCL was originally designed to only allow 1D<br>
attributes in keeping with the NetCDF data model. Later, however, when<br>
we needed the ability to transmit 2D coordinate information to the<br>
graphics routines (mainly), we loosened the restriction to allow NCL<br>
variables to have multi-d attributes as a convenience. However, as you<br>
have found, we did not implement full support for this feature. Partly<br>
this is because you cannot write such an attribute to any of the<br>
output file formats we support -- so it can never be truly integrated<br>
into the data model.<br>
Practically speaking, if you wanted to have a routine that handles<br>
subscripting of 2D attributes, I&#39;m guessing you could do it by<br>
assigning the attribute value to a local variable, subscripting the<br>
variable, and using the &#39;reassign&#39; syntax to give the attribute its<br>
new subscripted value.<br>
We will try to make the error message a little more informative.<br>
Eventually maybe we can make subscripting work in this situation.<br>
 -dave<br>
<div><div><br>
On Wed, May 13, 2015 at 10:56 AM, Philippe Papin &lt;<a href="mailto:ppapin@albany.edu" target="_blank">ppapin@albany.edu</a>&gt; wrote:<br>
&gt; Hi NCL-talk,<br>
&gt;<br>
&gt; I came across a strange conundrum today when testing some code. I use<br>
&gt; attributes in my code to send 1d variables through attributes into<br>
&gt; subroutines without explicitly defining it in the new subroutine. This<br>
&gt; practice is limited to 1d arrays since attributes in theory can only be 1d.<br>
&gt; However, if this is the case, why can you &quot;create&quot; a 2d attribute array and<br>
&gt; then print this attribute array without error?<br>
&gt;<br>
&gt; Here is a code snippet of an example of what I am talking about. I&#39;m using<br>
&gt; NCL version 6.2.1<br>
&gt;<br>
&gt; opt = True<br>
&gt; array2d = (/ (/1,2,3/) , (/4,5,6/) /)<br>
&gt; opt@array2d = array2d<br>
&gt; print(opt@array2d) ;;; output below seem to print out array correctly in 2d<br>
&gt;<br>
&gt; (0,0) 1<br>
&gt;<br>
&gt; (0,1) 2<br>
&gt;<br>
&gt; (0,2) 3<br>
&gt;<br>
&gt; (1,0) 4<br>
&gt;<br>
&gt; (1,1) 5<br>
&gt;<br>
&gt; (1,2) 6<br>
&gt;<br>
&gt; However if you try to actually subscript the data, you get an error message<br>
&gt; that attributes only have one dimension.<br>
&gt;<br>
&gt; subarray2d = opt@array2d(0,1)<br>
&gt;<br>
&gt; fatal:Attributes only have one dimension, 2 subscripts used<br>
&gt;<br>
&gt; fatal:[&quot;Execute.c&quot;:8576]:Execute: Error occurred at or near line 6<br>
&gt;<br>
&gt; This is a bit counterintuitive to me. Perhaps the 2d attribute array I<br>
&gt; created is really 1d, but just gives the appearance of a 2d array when<br>
&gt; printed. Sorry if this is a trivial question, but hopefully that means it<br>
&gt; won&#39;t take much to figure out what is going on here.<br>
&gt;<br>
&gt; Thanks for any additional information!<br>
&gt;<br>
&gt; -Philippe<br>
&gt;<br>
&gt;<br>
&gt; --<br>
&gt; -------------------------------------<br>
&gt; Philippe P. Papin<br>
&gt; Dept. of Atmospheric and Environmental Sciences<br>
&gt; University at Albany, SUNY<br>
&gt; 1400 Washington Ave, Albany, NY 12222<br>
&gt; <a href="http://www.atmos.albany.edu/student/ppapin/" target="_blank">http://www.atmos.albany.edu/student/ppapin/</a><br>
&gt;<br>
</div></div>&gt; _______________________________________________<br>
&gt; ncl-talk mailing list<br>
&gt; List instructions, subscriber options, unsubscribe:<br>
&gt; <a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
&gt;<br>
_______________________________________________<br>
ncl-talk mailing list<br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div><div>-------------------------------------</div><div>Philippe P. Papin<br><div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px">Dept. of Atmospheric and Environmental Sciences</div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px">University at Albany, SUNY</div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px">1400 Washington Ave, Albany, NY 12222</div></div></div><div><font color="#222222" face="arial, sans-serif"><a href="http://www.atmos.albany.edu/student/ppapin/" target="_blank">http://www.atmos.albany.edu/student/ppapin/</a></font></div></div>
</div>
</div></div><br>_______________________________________________<br>
ncl-talk mailing list<br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>