Re: Error: Dimensions sizes of left hand and right hand

From: Maria Gehne <mgehne_at_nyahnyahspammersnyahnyah>
Date: Fri Aug 30 2013 - 09:39:41 MDT

Hi Marilia,

look at line 75 in the code you sent, the lon variable you read in still
has all the longitude values and is probably length 144.

When you try to plot this against ceof which only has longitude values
in the region you specified you get an error. By the way, it was a
little difficult to figure out which line in your code gave the error
message. Including the line numbers from the error message would be helpful.

If you change line 75 to

lon = f->lon ({lonW:lonE})

it may work.

Hope this helps,
Maria

On 08/30/2013 06:20 AM, marilia.gregorio@cptec.inpe.br wrote:
> the dimensions of my input files are
>
> Variable: olr
> Type: float
> Total Size: 506804544 bytes
> 126701136 values
> Number of Dimensions: 3
> Dimensions and sizes: [time | 12053] x [lat | 73] x [lon | 144]
> Coordinates:
> time: [1569072..1858320]
> lat: [90..-90]
> lon: [ 0..357.5]
> Number Of Attributes: 3
> _FillValue : 32766
> long_name : Anomalies: Daily OLR
> units : W/m^2
>
> Variable: u200
> Type: float
> Total Size: 506804544 bytes
> 126701136 values
> Number of Dimensions: 3
> Dimensions and sizes: [time | 12053] x [lat | 73] x [lon | 144]
> Coordinates:
> time: [17338824..17628072]
> lat: [90..-90]
> lon: [ 0..357.5]
> Number Of Attributes: 3
> _FillValue : 32766
> long_name : Anomalies: mean Daily U-wind
> units : m/s
>
> Variable: u850
> Type: float
> Total Size: 506804544 bytes
> 126701136 values
> Number of Dimensions: 3
> Dimensions and sizes: [time | 12053] x [lat | 73] x [lon | 144]
> Coordinates:
> time: [17338824..17628072]
> lat: [90..-90]
> lon: [ 0..357.5]
> Number Of Attributes: 3
> _FillValue : 32766
> long_name : Anomalies: mean Daily U-wind
> units : m/s
>
>
> Marilia
>
> Quoting Guilherme Martins <jgmsantos@gmail.com>:
>
>> The dimensions size dont match
>>
>> See the lines you put here
>>
>> Dimensions and sizes
>>
>> Guilherme
>>
>> Enviado via iPhone
>>
>> Em 29/08/2013, ās 09:18 PM, marilia.gregorio@cptec.inpe.br escreveu:
>>
>>> Denis...
>>>
>>> I did what you told me and used the data anomaly created by
>>> mjoclivar_2.ncl ant the error ends.
>>> Now I have another problem:
>>>
>>> Copyright (C) 1995-2013 - All Rights Reserved
>>> University Corporation for Atmospheric Research
>>> NCAR Command Language Version 6.1.2
>>> The use of this software is governed by a License Agreement.
>>> See http://www.ncl.ucar.edu/ for more details.
>>> warning:Dimension (0) has not been defined
>>> warning:Dimension (1) has not been defined
>>> (0) ==============
>>>
>>> Variable: eof_cdata
>>> Type: float
>>> Total Size: 1056 bytes
>>> 264 values
>>> Number of Dimensions: 2
>>> Dimensions and sizes: [evn | 2] x [132]
>>> Coordinates:
>>> evn: [1..2]
>>> Number Of Attributes: 5
>>> eval : ( 43.60873, 21.51046 )
>>> pcvar : ( 33.03692, 16.2958 )
>>> matrix : covariance
>>> method : no transpose
>>> _FillValue : 32766
>>> (0)
>>> (0) min=-0.187536 max=0.160615
>>> (0) ==============
>>>
>>> Variable: eof_ts_cdata
>>> Type: float
>>> Total Size: 14608 bytes
>>> 3652 values
>>> Number of Dimensions: 2
>>> Dimensions and sizes: [evn | 2] x [1826]
>>> Coordinates:
>>> evn: [1..2]
>>> Number Of Attributes: 3
>>> ts_mean : ( 8.970104e-09, 8.01905e-10 )
>>> matrix : covariance
>>> _FillValue : 32766
>>> (0)
>>> (0) min=-20.1279 max=21.0541
>>> warning:Dimension (0) has not been defined
>>> warning:Dimension (0) has not been defined
>>> warning:Dimension (0) has not been defined
>>> (0) ==============
>>> (0) neof=0 r_olr_u850=0.630 r_olr_u200=0.354 r_u850_u200=0.647
>>> (0) neof=1 r_olr_u850=0.510 r_olr_u200=0.239 r_u850_u200=0.242
>>> (0) ==============
>>> (0) nGood=1626 nStrong=985 nOther=641
>>> (0) gsn_csm_xy: Fatal: X and Y must have the same dimensions
>>> sizes, or one must be one-dimensional and both have the same
>>> rightmost dimension.
>>> (0) gsn_csm_xy: Fatal: X and Y must have the same dimensions
>>> sizes, or one must be one-dimensional and both have the same
>>> rightmost dimension.
>>>
>>>
>>> What it could be?
>>> I'm sending my script in attachement
>>>
>>> Thanks
>>>
>>> Marilia
>>>
>>>
>>> Quoting Dennis Shea <shea@ucar.edu>:
>>>
>>>> Also .... This has nothing to do with the error message
>>>> you received but mjoclivar_14.ncl is expecting anomalies
>>>> not total winds.
>>>>
>>>> Note the input datasets for the mjoclicar_14 example:
>>>> filolr = "olr.day.anomalies.1980-2005.nc"
>>>> filu200 = "uwnd.day.200.anomalies.1980-2005.nc"
>>>> filu850 = "uwnd.day.850.anomalies.1980-2005.nc"
>>>>
>>>> The anomalies were derived via mjoclicar_2.ncl.
>>>> Note the comments in the text: "The MJO reference suggests
>>>> using daily anomalies for the diagnostics. The following
>>>> illustrates the process of creating anomalies."
>>>>
>>>> The full wind and olr fields may work but I want to make you
>>>> aware of the background for the example.
>>>>
>>>> ===
>>>>
>>>>
>>>>
>>>> On 8/27/13 12:28 PM, Mary Haley wrote:
>>>>> The error is indicating that you have a variable that already
>>>>> exists, maybe "work" or "U850", and are trying to write a new
>>>>> array into that variable that is not the same size.
>>>>>
>>>>> For example, if you try to do this:
>>>>>
>>>>> x = (/1,2,3/)
>>>>> x = (/1,2/)
>>>>>
>>>>> You will get the error:
>>>>>
>>>>> fatal:Dimension sizes of left hand side and right hand side of
>>>>> assignment do not match
>>>>> fatal:["Execute.c":8504]:Execute: Error occurred at or near line 1
>>>>>
>>>>> Note that "line 1" actually refers to the second line, because
>>>>> NCL line numbering starts at line 0.
>>>>>
>>>>> I don't know whether "work" is the issue or "U850", but you can
>>>>> try three different things:
>>>>>
>>>>> 1) Use a different variable name
>>>>>
>>>>> work2 = f->uwnd(iStrt:iLast,{plev850},{latS:latN},:)
>>>>>
>>>>> 2) Delete the variable before you reassign it
>>>>>
>>>>> delete(work)
>>>>> work = f->uwnd(iStrt:iLast,{plev850},{latS:latN},:)
>>>>>
>>>>> 3) Use ":=" if you have NCL version 6.1.2
>>>>>
>>>>> work := f->uwnd(iStrt:iLast,{plev850},{latS:latN},:)
>>>>>
>>>>>
>>>>> I used "work" as the example but it may be "U850" that's the
>>>>> problem, so apply the same reasoning.
>>>>>
>>>>> --Mary
>>>>>
>>>>>
>>>>> On Aug 27, 2013, at 10:49 AM, marilia.gregorio@cptec.inpe.br wrote:
>>>>>
>>>>>> When I use the mjoclivar_14.ncl script the following message appears:
>>>>>>
>>>>>> fatal:Dimension sizes of left hand side and right hand side of
>>>>>> assignment do not match
>>>>>> fatal:["Execute.c":8128]:Execute: Error occurred at or near line 69 in
>>>>>> file mjoclivar_14.ncl
>>>>>>
>>>>>> the line 69 is:
>>>>>>
>>>>>> work = f->uwnd(iStrt:iLast,{plev850},{latS:latN},:)
>>>>>> U850 = dim_avg_Wrap(work(time|:,lon|:,lat|:))
>>>>>>
>>>>>> printVarSummary(uwnd)
>>>>>> Variable: uwnd
>>>>>> Type: float
>>>>>> Total Size: 789712560 bytes
>>>>>> 197428140 values
>>>>>> Number of Dimensions: 4
>>>>>> Dimensions and sizes: [time | 12053] x [level | 1] x [lat |
>>>>>> 91] x [lon | 180]
>>>>>> Coordinates:
>>>>>> time: [1569072..1858320]
>>>>>> level: [850..850]
>>>>>> lat: [90..-90]
>>>>>> lon: [ 0..358]
>>>>>> Number Of Attributes: 16
>>>>>> standard_name : eastward_wind
>>>>>> long_name : Daily U-wind on Pressure Levels
>>>>>> units : m/s
>>>>>> _FillValue_original : -32767
>>>>>> _FillValue : -32767
>>>>>> cell_methods : time: mean (of each 6-hourly interval) mean (of 4
>>>>>> 6-hourly means)
>>>>>> unpacked_valid_range : ( -280, 350 )
>>>>>> actual_range : ( -107.25, 138.925 )
>>>>>> precision : 2
>>>>>> GRIB_id : 131
>>>>>> GRIB_name : UGRD
>>>>>> var_desc : u-wind
>>>>>> dataset : NOAA-CIRES 20th Century Reanalysis version 2 Daily Averages
>>>>>> level_desc : Pressure Levels
>>>>>> statistic : Ensemble Mean
>>>>>> parent_stat : Individual Obs
>>>>>>
>>>>>>
>>>>>> Someone can help me?
>>>>>> thanks
>>>>>>
>>>>>> marilia
>>>>>>
>>>>>> _______________________________________________
>>>>>> ncl-talk mailing list
>>>>>> List instructions, subscriber options, unsubscribe:
>>>>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>>> _______________________________________________
>>>>> ncl-talk mailing list
>>>>> List instructions, subscriber options, unsubscribe:
>>>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>
>>>
>>> <mjoclivar_14.ncl>
>>> _______________________________________________
>>> ncl-talk mailing list
>>> List instructions, subscriber options, unsubscribe:
>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

-- 
Maria Gehne
Postdoctoral Fellow
NCAR/CGD/CAS
P.O. Box 3000
Boulder, CO 80307
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Aug 30 09:39:46 2013

This archive was generated by hypermail 2.1.8 : Fri Aug 30 2013 - 14:04:57 MDT