<div dir="ltr"><div>Hi,<br><br></div><div>Thanks for your reply. Sorry for the misrepresentation. <br></div><div>I printed below the error output.  <br></div><div>While the loop starting for the second time I get this error. I am sure that the representation to calculate average of all the jan months are right.<br><br></div><div>I tried to create two domensional array which is commented in the code to write output. But that is not a problem.  <br></div><div>why particularly error in this specific line for the second time loop is what i don&#39;t understand. There is no dimension error for the first time. But for the second one. <br>​<div class="gmail_chip gmail_drive_chip" style="width:396px;height:18px;max-height:18px;background-color:rgb(245,245,245);padding:5px;color:rgb(34,34,34);font-family:arial;font-style:normal;font-weight:bold;font-size:13px;border:1px solid rgb(221,221,221);line-height:1"><a href="https://drive.google.com/file/d/0B5aDji6ggKPARHlEUW9Ta0tMZG8/view?usp=drive_web" target="_blank" style="display:inline-block;max-width:366px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-decoration:none;padding:1px 0;border:none"><img style="vertical-align: bottom; border: none;" src="https://ssl.gstatic.com/docs/doclist/images/icon_10_generic_list.png"> <span dir="ltr" style="color:rgb(17,85,204);text-decoration:none;vertical-align:bottom">minnesota50.csv</span></a><img src="//ssl.gstatic.com/ui/v1/icons/common/x_8px.png" style="opacity: 0.55; cursor: pointer; float: right; position: relative; top: -1px; display: none;"></div>​<br><br><br></div><div>Thank you, <br></div><div><br>fatal:Dimension sizes of left hand side and right hand side of assignment do not match<br>fatal:[&quot;Execute.c&quot;:8575]:Execute: Error occurred at or near line 51 in file reaadworkcsv.ncl<br><br><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Nov 4, 2015 at 12:30 PM, Alan Brammer <span dir="ltr">&lt;<a href="mailto:abrammer@albany.edu" target="_blank">abrammer@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">Had this folder open so I’ll give you a quick reply.<br>
<br>
There’s a lot of code here and no explanation of why you need help?<br>
Although it sometimes resembles it I believe this list isn’t really intended as a place to just quickly outsource your scripting desires.<br>
<br>
What have you tried?<br>
What specific issue did you run into?<br>
How is anyone on here supposed to know your data layout?<br>
Have you looked at the numerous climatology examples and previous ncl-talk questions?<br>
Where did the answers to the above questions fall short and thus what specifically is the problem?<br>
<br>
Good luck. As always direct replies to the list.  Hopefully a more specific question lends it self to a more specific answer.<br>
<br>
<br>
Alan.<br>
<div><div class="h5"><br>
<br>
&gt; On 4 Nov 2015, at 13:23, Adv &lt;<a href="mailto:advita6@gmail.com">advita6@gmail.com</a>&gt; wrote:<br>
&gt;<br>
&gt; Hi NCL user,<br>
&gt;<br>
&gt; I would like to write final average corresponding to each station, monthly average of 42 years to a two dimensionl array.<br>
&gt; Could someone help me to accomplish this?<br>
&gt;<br>
&gt; Thank you,<br>
&gt; Adv<br>
&gt;<br>
&gt; begin<br>
&gt; ;  diri   = &quot;./&quot;<br>
&gt;   fkey   = &quot;minnesota&quot;<br>
&gt; strs=asciiread(&quot;minnesota50.csv&quot; , -1, &quot;string&quot;)<br>
&gt; n1=(/&quot;197301&quot;,&quot;197401&quot;,&quot;197501&quot;,&quot;197601&quot;,&quot;197701&quot;,&quot;197801&quot;             \<br>
&gt; ,&quot;197901&quot;,&quot;198001&quot;,&quot;198101&quot;,&quot;198201&quot;,&quot;198301&quot;,&quot;198401&quot;                \<br>
&gt; ,&quot;198501&quot;,&quot;198601&quot;,&quot;198701&quot;,&quot;198801&quot;,&quot;198901&quot;,&quot;199001&quot;               \<br>
&gt; ,&quot;199101&quot;,&quot;199201&quot;,&quot;199301&quot;,&quot;199401&quot;,&quot;199501&quot;,&quot;199601&quot;                \<br>
&gt; ,&quot;199701&quot;,&quot;199801&quot;,&quot;199901&quot;,&quot;200001&quot;,&quot;200101&quot;,&quot;200201&quot;,&quot;200301&quot;       \<br>
&gt; ,&quot;200401&quot;,&quot;200501&quot;,&quot;200601&quot;,&quot;200701&quot;,&quot;200801&quot;,&quot;200901&quot;                \<br>
&gt; ,&quot;201001&quot;,&quot;201101&quot;,&quot;201201&quot;,&quot;201301&quot;,&quot;201401&quot;/)<br>
&gt; print(n1)<br>
&gt; ns1 = dimsizes(n1)<br>
&gt; print(ns1)<br>
&gt; do j =0, dimsizes(n1)-1<br>
&gt;<br>
&gt; ;  yyyymm = 197301<br>
&gt;   yyyymm = n1(j)<br>
&gt;   fldstr = &quot;PRCP&quot;                                         ; case sensitive<br>
&gt;   con    = 1.00<br>
&gt; print(yyyymm)<br>
&gt; ;return<br>
&gt; ;***********************************************<br>
&gt; ; match all data lines with specified YYYYYY<br>
&gt; ;***********************************************<br>
&gt;<br>
&gt; ;  seldata = str_match_ic_regex(strs, tostring(yyyymm))    ; 6.3.0<br>
&gt;   seldata = str_match_ic_regex(strs, tostring(yyyymm))    ; 6.3.0<br>
&gt; ;  print(seldata)<br>
&gt;   print(&quot;=====&quot;)<br>
&gt; n=(/&quot;THIEF&quot;,&quot;PARK&quot;/)<br>
&gt; print(n)<br>
&gt; ns = dimsizes(n)<br>
&gt; print(ns)<br>
&gt; tim = new((/ns1,ns/),&quot;float&quot;)<br>
&gt; printVarSummary(tim)<br>
&gt; ;tavg = new((/ns1,ns/),&quot;float&quot;)<br>
&gt; tavg = new(ns,float)<br>
&gt; print(tavg)<br>
&gt; do i =0, dimsizes(n)-1<br>
&gt; strkey = n(i)<br>
&gt; print(strkey)<br>
&gt; ;strkey= &quot;THIEF&quot;<br>
&gt; ;print(strkey)<br>
&gt; ;return<br>
&gt; ; find all lines (rows) which contain the key string<br>
&gt;<br>
&gt;   seldata1 = str_match_ic_regex(seldata, strkey)     ; 6.3.0  onward<br>
&gt; print(seldata1)<br>
&gt; print(dimsizes(seldata1))<br>
&gt; ;***********************************************<br>
&gt; ; write selected data to ascii file<br>
&gt; ;***********************************************<br>
&gt;  seldir  = &quot;./&quot;<br>
&gt;   selfil  = fkey+&quot;.&quot;+yyyymm+&quot;.csv&quot;<br>
&gt;   system(&quot;/bin/rm -f &quot;+seldir+selfil)<br>
&gt;   asciiwrite(seldir+selfil, seldata1)   ; all data for selected yyyymm<br>
&gt; ;***********************************************<br>
&gt; ; Which field matches<br>
&gt; ;***********************************************<br>
&gt; FIELDS = (/&quot;STATION&quot;,&quot;STATION_NAME&quot;,&quot;ELEVATION&quot;,&quot;LATITUDE&quot;,&quot;LONGITUDE&quot;    \<br>
&gt;           ,&quot;DATE&quot;,&quot;MDPR&quot;,&quot;MDSF&quot;,&quot;DAPR&quot;,&quot;DASF&quot;,&quot;PRCP&quot;,&quot;SNWD&quot;,&quot;SNOW&quot;        \<br>
&gt;           ,&quot;TMAX&quot;,&quot;TMIN&quot;,&quot;TOBS&quot;                                           /)<br>
&gt;<br>
&gt;<br>
&gt;   nfield = ind(FIELDS.eq.fldstr) + 1      ; field to be extracted<br>
&gt;   print(&quot;fldstr=&quot;+fldstr+&quot; corresponds to field number &quot;+nfield)<br>
&gt;   print(&quot;=====&quot;)<br>
&gt; ;***********************************************<br>
&gt; ; extract the values<br>
&gt; ;***********************************************<br>
&gt;<br>
&gt;   sdat   = str_get_field(seldata1 , 2, &quot;,&quot;)<br>
&gt; ;*********Monthly average********************************<br>
&gt;  data   = tofloat( str_get_field(seldata1 , nfield, &quot;,&quot;) )*con<br>
&gt;   data@_FillValue = -9999*con<br>
&gt;   print(sdat+&quot; : &quot;+data)<br>
&gt;   print(&quot;=====&quot;)<br>
&gt; ;print(data)<br>
&gt; ;return<br>
&gt; tavg(i)=avg(data)<br>
&gt; end do<br>
&gt; print(tavg)<br>
&gt; ;tim(j,i)=tavg<br>
&gt; end do<br>
&gt;<br>
&gt;<br>
&gt;<br>
</div></div>&gt; _______________________________________________<br>
&gt; ncl-talk mailing list<br>
&gt; <a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a><br>
&gt; List instructions, subscriber options, unsubscribe:<br>
&gt; <a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
<br>
</blockquote></div><br></div>