[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
Mon Jan 6 09:33:57 MST 2020
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.
Rick
On Sun, Jan 5, 2020 at 11:10 PM reza tisa <rezatisa1 at gmail.com> wrote:
> Thank you for your response Mr.Brownrigg*,*
> I am glad if anyone could help me fix this.
>
> I also put my file and script:
> MJO_PC_INDEX.nc (i got this by running mjoclivar_14.ncl)
> https://drive.google.com/open?id=1pr6wTdRXE0AWaPbh-Q8wWHca8NZLTLQw
>
> My script (based on mjoclivar_16)
> https://drive.google.com/open?id=1LLNGIASi-nmXxm204OEF2LT-iDsx5dhE
>
> If i put the *mjo_indx range is 0,5* *or more (in this case 1.0-1.5) *the
> script is fine:
> *.............. *
> if (nSeason.eq.1) then
> nt = ind((*mjo_indx.gt.1.0 .and. mjo_indx.lt.1.5*) .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. mjo_indx.lt.1.5*) .and. \
> (imon.ge.11 .or. imon.le. 4).and. \
> ang.ge.angBnd(0,n) .and. ang.lt.angBnd(1,n))
> end if
> ................
>
>
> But if i put the* mjo_indx range under 0,5 *(because i want to plot at
> the exact 0,5 amplitude) like this
> *(mjo_indx.gt.0.49 .and. mjo_indx.lt.0.51) *or* (mjo_indx.eq.0.5) *it
> goes to error at the 6th iteration plot
> ................
> if (nSeason.eq.1) then
> mjo_indx = decimalPlaces(mjo_indx ,1,True) ;* i put this for rounding
> data to get the exact 0.5 exact amplitude*
> 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
> ..................
>
>
>
> *This is my printVarSummary(this message comes 5 times): *
>
> *Variable: xAvg*
> Type: float
> Total Size: 9792 bytes
> 2448 values
> Number of Dimensions: 2
> Dimensions and sizes: *[lat | 17] x [lon | 144]*
> Coordinates:
> lat: [-20..20]
> lon: [ 0..357.5]
> Number Of Attributes: 5
> _FillValue : 32766
> long_name : Anomalies: Daily OLR
> units : W/m^2
> wgt_runave_op_ncl : wgt_runave_n
> average_op_ncl : dim_avg over dimension(s): time
>
> *Variable: uAvg*
> Type: float
> Total Size: 9860 bytes
> 2465 values
> Number of Dimensions: 2
> Dimensions and sizes: *[lat | 17] x [lon | 145]*
> Coordinates:
> lat: [ -20.. 20]
> lon: [ 0.. 360]
> Number Of Attributes: 4
> _FillValue : -9.99e+08
> long_name : Anomalies from Daily Climatology
> wgt_runave_op_ncl : wgt_runave_n
> average_op_ncl : dim_avg over dimension(s): time
>
> *Variable: vAvg*
> Type: float
> Total Size: 9860 bytes
> 2465 values
> Number of Dimensions: 2
> Dimensions and sizes: *[lat | 17] x [lon | 145]*
> Coordinates:
> lat: [ -20.. 20]
> lon: [ 0.. 360]
> Number Of Attributes: 4
> _FillValue : -9.99e+08
> long_name : Anomalies from Daily Climatology
> wgt_runave_op_ncl : wgt_runave_n
> average_op_ncl : dim_avg over dimension(s): time
>
> *Then, i got this printVarSummary error message after the 6th iteration.*
> *uAvg,xAvg, and vAvg* become only *1 dimension* and then the process
> stopped.
> (this message should have 8 message (iteration), but when comes the 6th
> iteration the printVar Summary become like this, and the it stopped):
>
> *Variable: xAvg*
> Type: float
> Total Size: 68 bytes
> 17 values
> Number of Dimensions: 1
> Dimensions and sizes: *[lat | 17]*
> Coordinates:
> lat: [-20..20]
> Number Of Attributes: 6
> _FillValue : 32766
> time : 1903728
> long_name : Anomalies: Daily OLR
> units : W/m^2
> wgt_runave_op_ncl : wgt_runave_n
> average_op_ncl : dim_avg over dimension(s): lon
>
> *Variable: uAvg*
> Type: float
> Total Size: 68 bytes
> 17 values
> Number of Dimensions: 1
> Dimensions and sizes: *[lat | 17]*
> Coordinates:
> lat: [ -20.. 20]
> Number Of Attributes: 5
> _FillValue : -9.99e+08
> time : 1144800
> long_name : Anomalies from Daily Climatology
> wgt_runave_op_ncl : wgt_runave_n
> average_op_ncl : dim_avg over dimension(s): lon
>
> *Variable: vAvg*
> Type: float
> Total Size: 68 bytes
> 17 values
> Number of Dimensions: 1
> Dimensions and sizes: *[lat | 17]*
> Coordinates:
> lat: [ -20.. 20]
> Number Of Attributes: 5
> _FillValue : -9.99e+08
> time : 1144800
> long_name : Anomalies from Daily Climatology
> wgt_runave_op_ncl : wgt_runave_n
> average_op_ncl : dim_avg over dimension(s): lon
> 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 248
>
>
> *Best Regards, *
> *Reza*
>
> Pada tanggal Min, 5 Jan 2020 pukul 22.28 Rick Brownrigg <brownrig at ucar.edu>
> menulis:
>
>> 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/20200106/d0b81e83/attachment.html>
More information about the ncl-talk
mailing list