<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'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:["Execute.c":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"><<a href="mailto:abrammer@albany.edu" target="_blank">abrammer@albany.edu</a>></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>
> On 4 Nov 2015, at 13:23, Adv <<a href="mailto:advita6@gmail.com">advita6@gmail.com</a>> wrote:<br>
><br>
> Hi NCL user,<br>
><br>
> I would like to write final average corresponding to each station, monthly average of 42 years to a two dimensionl array.<br>
> Could someone help me to accomplish this?<br>
><br>
> Thank you,<br>
> Adv<br>
><br>
> begin<br>
> ; diri = "./"<br>
> fkey = "minnesota"<br>
> strs=asciiread("minnesota50.csv" , -1, "string")<br>
> n1=(/"197301","197401","197501","197601","197701","197801" \<br>
> ,"197901","198001","198101","198201","198301","198401" \<br>
> ,"198501","198601","198701","198801","198901","199001" \<br>
> ,"199101","199201","199301","199401","199501","199601" \<br>
> ,"199701","199801","199901","200001","200101","200201","200301" \<br>
> ,"200401","200501","200601","200701","200801","200901" \<br>
> ,"201001","201101","201201","201301","201401"/)<br>
> print(n1)<br>
> ns1 = dimsizes(n1)<br>
> print(ns1)<br>
> do j =0, dimsizes(n1)-1<br>
><br>
> ; yyyymm = 197301<br>
> yyyymm = n1(j)<br>
> fldstr = "PRCP" ; case sensitive<br>
> con = 1.00<br>
> print(yyyymm)<br>
> ;return<br>
> ;***********************************************<br>
> ; match all data lines with specified YYYYYY<br>
> ;***********************************************<br>
><br>
> ; seldata = str_match_ic_regex(strs, tostring(yyyymm)) ; 6.3.0<br>
> seldata = str_match_ic_regex(strs, tostring(yyyymm)) ; 6.3.0<br>
> ; print(seldata)<br>
> print("=====")<br>
> n=(/"THIEF","PARK"/)<br>
> print(n)<br>
> ns = dimsizes(n)<br>
> print(ns)<br>
> tim = new((/ns1,ns/),"float")<br>
> printVarSummary(tim)<br>
> ;tavg = new((/ns1,ns/),"float")<br>
> tavg = new(ns,float)<br>
> print(tavg)<br>
> do i =0, dimsizes(n)-1<br>
> strkey = n(i)<br>
> print(strkey)<br>
> ;strkey= "THIEF"<br>
> ;print(strkey)<br>
> ;return<br>
> ; find all lines (rows) which contain the key string<br>
><br>
> seldata1 = str_match_ic_regex(seldata, strkey) ; 6.3.0 onward<br>
> print(seldata1)<br>
> print(dimsizes(seldata1))<br>
> ;***********************************************<br>
> ; write selected data to ascii file<br>
> ;***********************************************<br>
> seldir = "./"<br>
> selfil = fkey+"."+yyyymm+".csv"<br>
> system("/bin/rm -f "+seldir+selfil)<br>
> asciiwrite(seldir+selfil, seldata1) ; all data for selected yyyymm<br>
> ;***********************************************<br>
> ; Which field matches<br>
> ;***********************************************<br>
> FIELDS = (/"STATION","STATION_NAME","ELEVATION","LATITUDE","LONGITUDE" \<br>
> ,"DATE","MDPR","MDSF","DAPR","DASF","PRCP","SNWD","SNOW" \<br>
> ,"TMAX","TMIN","TOBS" /)<br>
><br>
><br>
> nfield = ind(FIELDS.eq.fldstr) + 1 ; field to be extracted<br>
> print("fldstr="+fldstr+" corresponds to field number "+nfield)<br>
> print("=====")<br>
> ;***********************************************<br>
> ; extract the values<br>
> ;***********************************************<br>
><br>
> sdat = str_get_field(seldata1 , 2, ",")<br>
> ;*********Monthly average********************************<br>
> data = tofloat( str_get_field(seldata1 , nfield, ",") )*con<br>
> data@_FillValue = -9999*con<br>
> print(sdat+" : "+data)<br>
> print("=====")<br>
> ;print(data)<br>
> ;return<br>
> tavg(i)=avg(data)<br>
> end do<br>
> print(tavg)<br>
> ;tim(j,i)=tavg<br>
> end do<br>
><br>
><br>
><br>
</div></div>> _______________________________________________<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/mailman/listinfo/ncl-talk</a><br>
<br>
</blockquote></div><br></div>