[ncl-talk] Error subscript mjoclivar_14 : Dimension sizes of left hand side and right hand side of assignment do not match

Dave Allured - NOAA Affiliate dave.allured at noaa.gov
Mon Dec 30 02:43:34 MST 2019


Those array summaries are helpful, thanks.  It looks like the original
program assumed that all three input files are on exactly the same grid.
However, you can see that your U and V files have one extra longitude,
compared to OLR.  This caused the dimension error.

You will need all three variables on the same grid because they are
involved in common calculations, later in the program.  Fortunately in this
case, it is unusually easy to make U and V on (0...360) align to OLR on
(0...357.5), because all the longitudes are exactly the same, except for
the extra OLR longitude at 360.  Simply remove the extra longitude by
subsetting at the right places in the program.

Here is one way to do it (untested).  Use the reassignment operator *(:=)*
to avoid conflicts with the preceding use of "work", then add a new line to
subset the array to a conforming grid alignment.  Repeat this for V as
well as U.

ncl 75>    work    = read_rename(f,"OLR_anom",iStrt,iLast,latS,latN) ;
(time,lat,lon)
ncl 76>    OLR     = dim_avg_n_Wrap(work, 1)                         ;
(time,lon)
ncl 77>
dncl 78>    f       = addfile (diri+filu850 , "r")
ncl 79>   * work    := read_rename(f,"U_anom",iStrt,iLast,latS,latN) ;
(time,lat,lon)*
++++++   *work    := work(:,:,{0:357.5})*
ncl 80>    U850    = dim_avg_n_Wrap(work, 1)          ; (time,lon)


On Mon, Dec 30, 2019 at 12:16 AM reza tisa <rezatisa1 at gmail.com> wrote:

> This is what i got, but sorry i still dont get what should i do
> Script mjoclivar_14:
> https://drive.google.com/open?id=1UdrtSvNioUmbkL3xuwF_QZbRrkNlEfCr
>
> printVarSummary (work)
> printVarSummary (read_rename(f,"U_anom",iStrt,iLast,latS,latN))
>
> Variable: work
> Type: float
> Total Size: 10939968 bytes
>             2734992 values
> Number of Dimensions: 3
> Dimensions and sizes: [time | 1461] x [lat | 13] x [lon | 144]
> Coordinates:
>             time: [1884648..1919688]
>             lat: [-15..15]
>             lon: [ 0..357.5]
> Number Of Attributes: 3
>   units : W/m^2
>   long_name : Anomalies: Daily OLR
>   _FillValue : 32766
>
> Variable: unnamed (return)
> Type: float
> Total Size: 11015940 bytes
>             2753985 values
> Number of Dimensions: 3
> Dimensions and sizes: [time | 1461] x [lat | 13] x [lon | 145]
> Coordinates:
>             time: [   0..2102400]
>             lat: [ -15..  15]
>             lon: [   0.. 360]
> Number Of Attributes: 2
>   long_name : Anomalies from Daily Climatology
>   _FillValue : -9.99e+08
> fatal:Dimension sizes of left hand side and right hand side of assignment
> do not match
> fatal:["Execute.c":8635]:Execute: Error occurred at or near line 82
>
>
> ncl 74>
> ncl 75>    work    = read_rename(f,"OLR_anom",iStrt,iLast,latS,latN)
> ;(time,lat,lon)
> ncl 76>    OLR     = dim_avg_n_Wrap(work, 1)                         ;
> (time,lon)
> ncl 77>
>  ncl 78>    f       = addfile (diri+filu850 , "r")
> ncl 79> printVarSummary (work)
> ncl 80> printVarSummary (read_rename(f,"U_anom",iStrt,iLast,latS,latN))
> ncl 81>
> ncl 82>    work    = read_rename(f,"U_anom",iStrt,iLast,latS,latN) ;
> (time,lat,lon)
> ncl 83>    U850    = dim_avg_n_Wrap(work, 1)          ; (time,lon)
>
>
>
> Pada tanggal Sen, 30 Des 2019 pukul 12.55 Dave Allured - NOAA Affiliate <
> dave.allured at noaa.gov> menulis:
>
>> We need to show you how to debug, instead of just giving you the answer.
>> Whenever you get this ...
>>
>> *"Dimension sizes of left hand side and right hand side of assignment do
>> not match"*
>>
>> ... then you need to show printVarSummary of the left hand and right hand
>> sides, NOT the original data.  Here you would add two statements between
>> lines 78 and 79, because the program breaks on line 79.
>>
>> printVarSummary (work)
>> printVarSummary (read_rename(f,"U_anom",iStrt,iLast,latS,latN))
>>
>> Line 79 will work only if all dimensions are exactly the same size,
>> between left and right.  Now you will need to explain why one or more of
>> the dimension sizes are different here.
>>
>> Note to others:  There is more going on here than just "use the
>> reassignment operator".
>>
>>
>> On Sun, Dec 29, 2019 at 10:20 PM reza tisa via ncl-talk <
>> ncl-talk at ucar.edu> wrote:
>>
>>> Hello NCL User, I really need help for doing mjoclivar_14.
>>> I already success on doing mjoclivar_2 to get data anomalies for *OLR
>>> and zonal wind* (uwnd 200 hPa & uwnd 850 hPa) for 2015-2018.
>>> This is my data :
>>> My mjoclivar_14 script :
>>>
>>> https://drive.google.com/open?id=0B6v1GPWVNcu7eGo0V0J0VTlpNmstYTFFVmJiVGpRTGdXdlBjOLR
>>> anomalies
>>> Original mjoclivar_14 script :
>>> https://www.ncl.ucar.edu/Applications/Scripts/mjoclivar_14.ncl
>>> OLR anomalies :
>>> https://drive.google.com/open?id=1lgzfmmadfmXUWkUT1n8DAsTbvp0oQ-Fc
>>> uwnd 200 anomalies :
>>> https://drive.google.com/open?id=1Eb9a4VD96n8Wg9iDoRg7pOHr60tl9OWw
>>> uwnd 850 anomalies :
>>> https://drive.google.com/open?id=1PKpTYxGT5VAE6F5ydu0j89VHlRN7gC9p
>>>
>>> That anomalies data i use for running mjoclivar_14 . Then i got this
>>> error.
>>>
>>> fatal:Dimension sizes of left hand side and right hand side of
>>> assignment do not match
>>> fatal:["Execute.c":8635]:Execute: Error occurred at or near *line 79*
>>>
>>> ....................
>>> ;***********************************************************
>>> ; Read anomalies
>>> ;***********************************************************
>>> ncl 75>    work    = read_rename(f,"OLR_anom",iStrt,iLast,latS,latN) ;
>>> (time,lat,lon)
>>> ncl 76>    OLR     = dim_avg_n_Wrap(work, 1)                         ;
>>> (time,lon)
>>> ncl 77>
>>> dncl 78>    f       = addfile (diri+filu850 , "r")
>>>
>>> ncl 79>   * work    = read_rename(f,"U_anom",iStrt,iLast,latS,latN) ;
>>> (time,lat,lon)*
>>> ncl 80>    U850    = dim_avg_n_Wrap(work, 1)          ; (time,lon)
>>> .....................
>>>
>>> This is my printVarSummary :
>>> Variable *OLR_anom* :
>>> ncl 5> printVarSummary(T)
>>> Variable: T
>>> Type: float
>>> Total Size: 61432128 bytes
>>>             15358032 values
>>> Number of Dimensions: 3
>>> Dimensions and sizes: [time | 1461] x [lat | 73] x [lon | 144]
>>> Coordinates:
>>>             time: [1884648..1919688]
>>>             lat: [90..-90]
>>>             lon: [ 0..357.5]
>>> Number Of Attributes: 3
>>>   _FillValue : 32766
>>>   long_name : Anomalies: Daily OLR
>>>   units : W/m^2
>>>
>>>
>>> Variable *U_anom *(200 hPa) :
>>> ncl 11> printVarSummary(T2)
>>>
>>> Variable: T2
>>> Type: float
>>> Total Size: 61858740 bytes
>>>             15464685 values
>>> Number of Dimensions: 3
>>> Dimensions and sizes: [time | 1461] x [lat | 73] x [lon | 145]
>>> Coordinates:
>>>             time: [   0..2102400]
>>>             lat: [ -90..  90]
>>>             lon: [   0.. 360]
>>> Number Of Attributes: 2
>>>   _FillValue : -9.99e+08
>>>   long_name : Anomalies from Daily Climatology
>>>
>>> Variable *U_anom* (850 hPa) :
>>> ncl 15> printVarSummary(T3)
>>>
>>> Variable: T3
>>> Type: float
>>> Total Size: 61858740 bytes
>>>             15464685 values
>>> Number of Dimensions: 3
>>> Dimensions and sizes: [time | 1461] x [lat | 73] x [lon | 145]
>>> Coordinates:
>>>             time: [   0..2102400]
>>>             lat: [ -90..  90]
>>>             lon: [   0.. 360]
>>> Number Of Attributes: 2
>>>   _FillValue : -9.99e+08
>>>   long_name : Anomalies from Daily Climatology
>>>
>>> Huge thanks for anybody can make this work, really need help this for my
>>> mini thesis. Thank you
>>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20191230/43458a73/attachment.html>


More information about the ncl-talk mailing list