<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">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>