<div dir="ltr"><div>You should put in print statements. to examine your data.</div><div><br></div><div>============================<br></div><div>f = addfile("MJO.....nc","r") ; <=== *MY* file on ftp and attached</div> ; this spans 19800101 to 20181231<br>ymd = cd_calendar(f->time,-2)<br>mjo_idx = f->MJO_INDEX<br>pc1 = f->PC1<br>pc2 = f->PC2<br>;; print(ymd+" "+ mjo_idx+" "+pc1+" "+pc2)<br><br>n_4951 = <b>num</b>(mjo_idx.gt.0.49 .and. mjo_idx.lt.0.51)<br>n_50 = <b>num</b>(mjo_idx.eq.0.50)<br>print("n_4951="+n_4951)<br><div>print("n_50="+n_50)</div><div><br></div><div>---</div><div>re: "Then, i got this printVarSummary error message after the <b>6th</b> iteration."</div><div><br></div><div><b> n_4951=5 <=== hence, there can not be a 6th iteration<br> n_50=0 <=== the are no values exactly 0.50<br></b></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Jan 6, 2020 at 9:34 AM Rick Brownrigg via ncl-talk <<a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>I can't run this script because there are three other files required. However, you've narrowed things to the 6th iteration. What I would do is put in addition print statements to look at the values/shapes of nt, x(lat|:,lon|:,time|nt), u(lat|:,lon|:,time|nt), v(lat|:,lon|:,time|nt) . Looing at what changes between the 5th and 6th iteration should provide some insight as to why the x/u/vAvg arrays degenerate into 1D arrays.</div><div><br></div><div>Rick</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Jan 5, 2020 at 11:10 PM reza tisa <<a href="mailto:rezatisa1@gmail.com" target="_blank">rezatisa1@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Thank you for your response Mr.Brownrigg<b>,</b></div><div>I am glad if anyone could help me fix this.</div><div><br></div><div><div>I also put my file and script:</div><div>MJO_PC_INDEX.nc (i got this by running mjoclivar_14.ncl)<br></div><div><a href="https://drive.google.com/open?id=1pr6wTdRXE0AWaPbh-Q8wWHca8NZLTLQw" target="_blank">https://drive.google.com/open?id=1pr6wTdRXE0AWaPbh-Q8wWHca8NZLTLQw</a></div><div><br></div><div>My script (based on mjoclivar_16)<br></div><div><a href="https://drive.google.com/open?id=1LLNGIASi-nmXxm204OEF2LT-iDsx5dhE" target="_blank">https://drive.google.com/open?id=1LLNGIASi-nmXxm204OEF2LT-iDsx5dhE</a></div></div><div><br></div><div><b></b></div><div>If i put the <b>mjo_indx range is 0,5</b> <b>or more (in this case 1.0-1.5) </b>the script is fine:</div><div><b>.............. </b><div> if (nSeason.eq.1) then<br> nt = ind((<b>mjo_indx.gt.1.0 .and. mjo_indx.lt.1.5</b>) .and. \<br> (imon.ge.5 .and. imon.le.10).and. \<br> ang.ge.angBnd(0,n) .and. ang.lt.angBnd(1,n))<br> else<br> nt = ind((<b>mjo_indx.gt.1.0 .and. mjo_indx.lt.1.5</b>) .and. \<br> (imon.ge.11 .or. imon.le. 4).and. \<br> ang.ge.angBnd(0,n) .and. ang.lt.angBnd(1,n))<br> end if</div><div>................</div><div><br></div><div><br></div><div>But if i put the<b> mjo_indx range under 0,5 </b>(because i want to plot at the exact 0,5 amplitude) like this<br></div><div><b>(mjo_indx.gt.0.49 .and. mjo_indx.lt.0.51) </b>or<b> (mjo_indx.eq.0.5) </b>it goes to error at the 6th iteration plot<br><b></b></div><div><div> ................ </div><div>if (nSeason.eq.1) then</div><div></div><div>mjo_indx = decimalPlaces(mjo_indx ,1,True) ;<i> i put this for rounding data to get the exact 0.5 exact amplitude</i></div><div> nt = ind(<b>(mjo_indx.gt.0.49 .and. mjo_indx.lt.0.51)</b> .and. \<br> (imon.ge.5 .and. imon.le.10).and. \<br> ang.ge.angBnd(0,n) .and. ang.lt.angBnd(1,n))<br> else<br> nt = ind(<b>(mjo_indx.gt.0.49 .and. mjo_indx.lt.0.51) </b>.and. \<br> (imon.ge.11 .or. imon.le. 4).and. \<br> ang.ge.angBnd(0,n) .and. ang.lt.angBnd(1,n))<br> end if</div><div>..................</div></div><div><br></div><div><br></div></div><div><b>This is my printVarSummary(this message comes 5 times): <br></b></div><div><b><br></b></div><div><b></b></div><div><b>Variable: xAvg</b></div>Type: float<br>Total Size: 9792 bytes<br> 2448 values<br>Number of Dimensions: 2<br>Dimensions and sizes: <b>[lat | 17] x [lon | 144]</b><br>Coordinates: <br> lat: [-20..20]<br> lon: [ 0..357.5]<br>Number Of Attributes: 5<br> _FillValue : 32766<br> long_name : Anomalies: Daily OLR<br> units : W/m^2<br> wgt_runave_op_ncl : wgt_runave_n<br> average_op_ncl : dim_avg over dimension(s): time<br><br><b>Variable: uAvg</b><br>Type: float<br>Total Size: 9860 bytes<br> 2465 values<br>Number of Dimensions: 2<br>Dimensions and sizes: <b>[lat | 17] x [lon | 145]</b><br>Coordinates: <br> lat: [ -20.. 20]<br> lon: [ 0.. 360]<br>Number Of Attributes: 4<br> _FillValue : -9.99e+08<br> long_name : Anomalies from Daily Climatology<br> wgt_runave_op_ncl : wgt_runave_n<br> average_op_ncl : dim_avg over dimension(s): time<br><br><b>Variable: vAvg</b><br>Type: float<br>Total Size: 9860 bytes<br> 2465 values<br>Number of Dimensions: 2<br>Dimensions and sizes: <b>[lat | 17] x [lon | 145]</b><br>Coordinates: <br> lat: [ -20.. 20]<br> lon: [ 0.. 360]<br>Number Of Attributes: 4<br> _FillValue : -9.99e+08<br> long_name : Anomalies from Daily Climatology<br> wgt_runave_op_ncl : wgt_runave_n<br><div> average_op_ncl : dim_avg over dimension(s): time</div><div><br></div><div><div><div><b>Then, i got this printVarSummary error message after the 6th iteration.</b><br></div></div></div><div><b>uAvg,xAvg, and vAvg</b> become only <b>1 dimension</b> and then the process stopped.<br></div><div><div>(this message should have 8 message (iteration), but when comes the 6th iteration the printVar Summary become like this, and the it stopped):</div><div><br></div></div><div><b>Variable: xAvg</b><br>Type: float<br>Total Size: 68 bytes<br> 17 values<br>Number of Dimensions: 1<br>Dimensions and sizes: <b>[lat | 17]</b><br>Coordinates: <br> lat: [-20..20]<br>Number Of Attributes: 6<br> _FillValue : 32766<br> time : 1903728<br> long_name : Anomalies: Daily OLR<br> units : W/m^2<br> wgt_runave_op_ncl : wgt_runave_n<br> average_op_ncl : dim_avg over dimension(s): lon<br><br><b>Variable: uAvg</b><br>Type: float<br>Total Size: 68 bytes<br> 17 values<br>Number of Dimensions: 1<br>Dimensions and sizes: <b>[lat | 17]</b><br>Coordinates: <br> lat: [ -20.. 20]<br>Number Of Attributes: 5<br> _FillValue : -9.99e+08<br> time : 1144800<br> long_name : Anomalies from Daily Climatology<br> wgt_runave_op_ncl : wgt_runave_n<br> average_op_ncl : dim_avg over dimension(s): lon<br><br><b>Variable: vAvg</b><br>Type: float<br>Total Size: 68 bytes<br> 17 values<br>Number of Dimensions: 1<br>Dimensions and sizes: <b>[lat | 17]</b><br>Coordinates: <br> lat: [ -20.. 20]<br>Number Of Attributes: 5<br> _FillValue : -9.99e+08<br> time : 1144800<br> long_name : Anomalies from Daily Climatology<br> wgt_runave_op_ncl : wgt_runave_n<br> average_op_ncl : dim_avg over dimension(s): lon<br>fatal:Number of dimensions in parameter (1) of (gsn_csm_vector_scalar_map) is (1), (2) dimensions were expected <br>fatal:["Execute.c":8635]:Execute: Error occurred at or near line 248<br></div><div><br></div><div><i>Best Regards, <br></i></div><div><i>Reza</i><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Pada tanggal Min, 5 Jan 2020 pukul 22.28 Rick Brownrigg <<a href="mailto:brownrig@ucar.edu" target="_blank">brownrig@ucar.edu</a>> menulis:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div>In the two code excerpts you provided, you left out perhaps the most critical piece (from the original script, shown highlighted):</div><br><pre> if (nSeason.eq.1) then
nt = ind(mjo_indx.gt.1.0 .and. \
(imon.ge.5 .and. imon.le.10).and. \
ang.ge.angBnd(0,n) .and. ang.lt.angBnd(1,n))
else
nt = ind(mjo_indx.gt.1.0 .and. \
(imon.ge.11 .or. imon.le. 4).and. \
ang.ge.angBnd(0,n) .and. ang.lt.angBnd(1,n))
end if
if (.not.all(ismissing(nt))) then
<b> xAvg = dim_avg_Wrap( x(lat|:,lon|:,time|nt) )
uAvg = dim_avg_Wrap( u(lat|:,lon|:,time|nt) )
vAvg = dim_avg_Wrap( v(lat|:,lon|:,time|nt) )
</b> nDays(na) = dimsizes(nt)
res@tmXBLabelsOn = False ; do not draw lon labels
res@tmXBOn = False ; lon tickmarks
if (n.eq.(nPhase-1)) then ;
res@tmXBLabelsOn = True ; draw lon labels
res@tmXBOn = True ; tickmarks
end if
plot(na) = gsn_csm_vector_scalar_map(wks,uAvg,vAvg,xAvg,res)
end if</pre></div><div><br></div><div><font size="2"><font face="arial,sans-serif">The error message is self-explanatory -- the docs for gsn_csm_vector_scalar_map() state that uAvg/vAvg/xAvg must be two dimensional. I would suggest putting in print statements right after the highlighted lines to see what are the values/dimensionalities of any/all of the variables x/u/v/xAvg/uAvg/vAvg/nt. Did the script work for your data prior to making changes to how nt is calculated? If so, then pretty clearly the issue is with what nt looks like. If not, perhaps there are other modifications need to conform the script to your data (or vice-versa).</font></font></div><div><font size="2"><font face="arial,sans-serif"><br></font></font></div><div><font size="2"><font face="arial,sans-serif">Hope that helps...</font></font></div><div><font size="2"><font face="arial,sans-serif">Rick</font></font></div><div><font size="2"><font face="arial,sans-serif"></font></font><br></div><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Jan 4, 2020 at 7:13 PM reza tisa via ncl-talk <<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Hello NCL User, <br></div><div>I am trying to plot mjoclivar_16 (<a href="https://www.ncl.ucar.edu/Applications/Scripts/mjoclivar_16.ncl" target="_blank">https://www.ncl.ucar.edu/Applications/Scripts/mjoclivar_16.ncl</a>) with amplitude equal to 0.5. <br></div><div><b>I change from this :</b><br></div><div>....</div><div> if (nSeason.eq.1) then<br> nt = ind((mjo_indx.gt.1.0 .and. \<br> (imon.ge.5 .and. imon.le.10).and. \<br> ang.ge.angBnd(0,n) .and. ang.lt.angBnd(1,n))<br> else<br> nt = ind(mjo_indx.gt.1.0 .and. \<br> (imon.ge.11 .or. imon.le. 4).and. \<br> ang.ge.angBnd(0,n) .and. ang.lt.angBnd(1,n))<br> end if</div><div>........</div><div><br></div><div><b>To this :</b><br></div><div>.....</div><div>line 228 (on myscript)<br></div><div> if (nSeason.eq.1) then<br> nt = ind((mjo_indx.gt.0.49 .and. mjo_indx.lt.0.51) .and. \<br> (imon.ge.5 .and. imon.le.10).and. \<br> ang.ge.angBnd(0,n) .and. ang.lt.angBnd(1,n))<br> else<br> nt = ind((mjo_indx.gt.0.49 .and. mjo_indx.lt.0.51) .and. \<br> (imon.ge.11 .or. imon.le. 4).and. \<br> ang.ge.angBnd(0,n) .and. ang.lt.angBnd(1,n))<br> end if</div><div>.......<br></div><div><br></div><div><b>Then, i got this error<br></b></div><div><br></div><div>fatal:Number of dimensions in parameter (1) of (gsn_csm_vector_scalar_map) is (1), (2) dimensions were expected </div><div>fatal:["Execute.c":8635]:Execute: Error occurred at or near line 245</div><div>......</div><div>ncl 240> if (n.eq.(nPhase-1)) then ; <br>ncl 241> res@tmXBLabelsOn = True ; draw lon labels<br>ncl 242> res@tmXBOn = True ; tickmarks<br>ncl 243> end if<br>ncl 244> printVarSummary(na)<br><b>ncl 245> plot(na) = gsn_csm_vector_scalar_map(wks,uAvg,vAvg,xAvg,res)</b><br>ncl 246> end if<br>ncl 247> delete(nt) ; will change next iteration<br>ncl 248> end do</div><div>.......<br></div><div><br></div><b>This is my printVarSummary:</b><br><b>Variable: mjo_indx</b><br>Type: float<br>Total Size: 3744 bytes<br> 936 values<br>Number of Dimensions: 1<br>Dimensions and sizes: [time | 936]<br>Coordinates: <br> time: [1890960..1913400]<br>Number Of Attributes: 3<br> info : (PC1^2 + PC2^2)<br> long_name : MJO PC INDEX<br> _FillValue : 32766<br><br><b>Variable: na</b><br>Type: integer<br>Total Size: 4 bytes<br> 1 values<br>Number of Dimensions: 1<br>Dimensions and sizes: [1]<br><div>Coordinates: <br></div><div><br></div><div>Any solution for this?<br></div></div>
_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu" target="_blank">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></blockquote></div></div>
</blockquote></div>
</blockquote></div>
_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu" target="_blank">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></blockquote></div>