[ncl-talk] Number of dimensions in parameter (1) of (gsn_csm_vector_scalar_map) is (1), (2) dimensions were expected
Rick Brownrigg
brownrig at ucar.edu
Sun Jan 5 08:19:24 MST 2020
In the two code excerpts you provided, you left out perhaps the most
critical piece (from the original script, shown highlighted):
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* 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) )
* nDays(na) = dimsizes(nt)
res at tmXBLabelsOn = False ; do not draw lon labels
res at tmXBOn = False ; lon tickmarks
if (n.eq.(nPhase-1)) then ;
res at tmXBLabelsOn = True ; draw lon labels
res at tmXBOn = True ; tickmarks
end if
plot(na) = gsn_csm_vector_scalar_map(wks,uAvg,vAvg,xAvg,res)
end if
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).
Hope that helps...
Rick
On Sat, Jan 4, 2020 at 7:13 PM reza tisa via ncl-talk <ncl-talk at ucar.edu>
wrote:
> Hello NCL User,
> I am trying to plot mjoclivar_16 (
> https://www.ncl.ucar.edu/Applications/Scripts/mjoclivar_16.ncl) with
> amplitude equal to 0.5.
> *I change from this :*
> ....
> 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
> ........
>
> *To this :*
> .....
> line 228 (on myscript)
> if (nSeason.eq.1) then
> nt = ind((mjo_indx.gt.0.49 .and. mjo_indx.lt.0.51) .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.0.49 .and. mjo_indx.lt.0.51) .and. \
> (imon.ge.11 .or. imon.le. 4).and. \
> ang.ge.angBnd(0,n) .and. ang.lt.angBnd(1,n))
> end if
> .......
>
>
> *Then, i got this error*
>
> fatal:Number of dimensions in parameter (1) of (gsn_csm_vector_scalar_map)
> is (1), (2) dimensions were expected
> fatal:["Execute.c":8635]:Execute: Error occurred at or near line 245
> ......
> ncl 240> if (n.eq.(nPhase-1)) then ;
> ncl 241> res at tmXBLabelsOn = True ; draw lon labels
> ncl 242> res at tmXBOn = True ; tickmarks
> ncl 243> end if
> ncl 244> printVarSummary(na)
> *ncl 245> plot(na) =
> gsn_csm_vector_scalar_map(wks,uAvg,vAvg,xAvg,res)*
> ncl 246> end if
> ncl 247> delete(nt) ; will change next iteration
> ncl 248> end do
> .......
>
> *This is my printVarSummary:*
> *Variable: mjo_indx*
> Type: float
> Total Size: 3744 bytes
> 936 values
> Number of Dimensions: 1
> Dimensions and sizes: [time | 936]
> Coordinates:
> time: [1890960..1913400]
> Number Of Attributes: 3
> info : (PC1^2 + PC2^2)
> long_name : MJO PC INDEX
> _FillValue : 32766
>
> *Variable: na*
> Type: integer
> Total Size: 4 bytes
> 1 values
> Number of Dimensions: 1
> Dimensions and sizes: [1]
> Coordinates:
>
> Any solution for this?
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20200105/a06c1c97/attachment.html>
More information about the ncl-talk
mailing list