<div dir="ltr"><div class="gmail_default" style="font-family:verdana,sans-serif">Jiali,</div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif">There are two ways to do it:</div><div class="gmail_default" style="font-family:verdana,sans-serif">1. The traditional way</div><div class="gmail_default" style><br><p class="MsoNormal" style="font-family:arial,sans-serif;font-size:12.8000001907349px">county = (/"Delaware","Sioux","Lincoln"/)<u></u><u></u></p><p class="MsoNormal" style="font-family:arial,sans-serif;font-size:12.8000001907349px"><u></u> <u></u></p><p class="MsoNormal" style="font-family:arial,sans-serif;font-size:12.8000001907349px">do k = 0, 2<u></u><u></u></p><p class="MsoNormal" style="font-family:arial,sans-serif;font-size:12.8000001907349px"> f1 = addfile("CDL_2010_"+county(k)+".nc","r")<u></u><u></u></p><p class="MsoNormal" style="font-family:arial,sans-serif;font-size:12.8000001907349px"> u1 = f1->Band1(:,:)<u></u><u></u></p><p class="MsoNormal" style="font-family:arial,sans-serif;font-size:12.8000001907349px"><br></p><p class="MsoNormal" style="font-family:arial,sans-serif;font-size:12.8000001907349px"> ;do some work with u1</p><p class="MsoNormal" style="font-family:arial,sans-serif;font-size:12.8000001907349px"><br></p><p class="MsoNormal" style="font-family:arial,sans-serif;font-size:12.8000001907349px"> delete(u1)</p><p class="MsoNormal" style="font-family:arial,sans-serif;font-size:12.8000001907349px">end do<u></u><u></u></p><p class="MsoNormal" style="font-family:arial,sans-serif;font-size:12.8000001907349px"><br></p><p class="MsoNormal" style="font-family:arial,sans-serif;font-size:12.8000001907349px"><br></p><p class="MsoNormal" style="font-family:arial,sans-serif;font-size:12.8000001907349px">2. the easy way</p><br><p class="MsoNormal" style="font-family:arial,sans-serif;font-size:12.8000001907349px">county = (/"Delaware","Sioux","Lincoln"/)<u></u><u></u></p><p class="MsoNormal" style="font-family:arial,sans-serif;font-size:12.8000001907349px"><u></u> <u></u></p><p class="MsoNormal" style="font-family:arial,sans-serif;font-size:12.8000001907349px">do k = 0, 2<u></u><u></u></p><p class="MsoNormal" style="font-family:arial,sans-serif;font-size:12.8000001907349px"> f1 := addfile("CDL_2010_"+county(k)+".nc","r")<u></u><u></u></p><p class="MsoNormal" style="font-family:arial,sans-serif;font-size:12.8000001907349px"> u1 := f1->Band1(:,:)<u></u><u></u></p><p class="MsoNormal" style="font-family:arial,sans-serif;font-size:12.8000001907349px">end do<u></u><u></u></p><p class="MsoNormal" style="font-family:arial,sans-serif;font-size:12.8000001907349px"><br></p><p class="MsoNormal" style="font-family:arial,sans-serif;font-size:12.8000001907349px"><br></p><p class="MsoNormal" style="font-family:arial,sans-serif;font-size:12.8000001907349px">Where the second way uses ":=", which we call it re-assign.</p><p class="MsoNormal" style="font-family:arial,sans-serif;font-size:12.8000001907349px">It works as, if u1 exists at this time, delete it first, if not, do nothing, and then create a new u1.</p><p class="MsoNormal" style="font-family:arial,sans-serif;font-size:12.8000001907349px"><br></p><p class="MsoNormal" style="font-family:arial,sans-serif;font-size:12.8000001907349px">You may want to read:</p><p class="MsoNormal" style><a href="http://www.ncl.ucar.edu/Document/Language/varb_assign.shtml">http://www.ncl.ucar.edu/Document/Language/varb_assign.shtml</a><br></p><p class="MsoNormal" style="font-family:arial,sans-serif;font-size:12.8000001907349px"><br></p><p class="MsoNormal" style="font-family:arial,sans-serif;font-size:12.8000001907349px">Regards,</p><p class="MsoNormal" style="font-family:arial,sans-serif;font-size:12.8000001907349px"><br></p><p class="MsoNormal" style="font-family:arial,sans-serif;font-size:12.8000001907349px">Wei</p></div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature"><div dir="ltr"><font face="tahoma, sans-serif">================================================</font><div><font face="tahoma, sans-serif">1850 Table Mesa Dr.</font></div><div><font face="tahoma, sans-serif">Boulder, CO 80307</font></div><div><font face="tahoma, sans-serif">Phone: 303-497-8924</font></div></div></div></div>
<br><div class="gmail_quote">On Fri, Mar 20, 2015 at 9:21 AM, Wang, Jiali <span dir="ltr"><<a href="mailto:jialiwang@anl.gov" target="_blank">jialiwang@anl.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div lang="EN-US" link="blue" vlink="purple">
<div>
<p class="MsoNormal">Dear NCL users,<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">I am trying to read in files which have different dimension sizes, and get fatal error: Dimension sizes of left hand side and right hand side of assignment do not match.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Here is my ncl script:<u></u><u></u></p>
<p class="MsoNormal">==============<u></u><u></u></p>
<p class="MsoNormal">county = (/"Delaware","Sioux","Lincoln"/)<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">do k = 0, 2<u></u><u></u></p>
<p class="MsoNormal"> f1 = addfile("CDL_2010_"+county(k)+".nc","r")<u></u><u></u></p>
<p class="MsoNormal"> u1 = f1->Band1(:,:)<u></u><u></u></p>
<p class="MsoNormal">end do<u></u><u></u></p>
<p class="MsoNormal">===============<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Since the dimension sizes of the three data sets are totally different, the script works only for k=0,0 or k=1,1 or k=2,2. Is there a way to address this problem? Something like, make it forgets the dimension of last loop (say, k=0) and
starts the next loop (say, k=1)? I have much more than three data sets needed to be read in.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Thanks!<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Jiali <u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Times New Roman","serif"">Jiali Wang, Ph. D<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Times New Roman","serif"">Environmental Science Division<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Times New Roman","serif"">Argonne National Laboratory<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Times New Roman","serif"">Tel: <a href="tel:630-252-2848" value="+16302522848" target="_blank">630-252-2848</a><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Times New Roman","serif""><a href="http://www.evs.anl.gov/about-evs/staff/detail/index.cfm?/Wang/Jiali" target="_blank">http://www.evs.anl.gov/about-evs/staff/detail/index.cfm?/Wang/Jiali</a><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Times New Roman","serif""><u></u> <u></u></span></p>
<p class="MsoNormal"><u></u> <u></u></p>
</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>