Re: Size of dimension relating to file input being picked up as having different sizes on LHS & RHS of function

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Fri Jul 13 2012 - 07:46:37 MDT

Sorry, hit 'Send' too fast

I think you want

    dim_sum_n(cold_uk1(:,{spell(nr)},:,:,:),1)

A *subtle* issue:
essentially, NCL creates a temporary variable inside the function

    temp = cold_uk1(:,{spell(nr)},:,:,:) ;==> (20,9,18,30)

so the averaging is done over the 1-th dimension of the temporary
variable

    dim_sum_n(temp,1)

On 7/13/12 7:40 AM, Dennis Shea wrote:
> The following is a guess ...
>
> xxx = dim_sum_n(cold_uk1(:,{spell(nr)},:,:,:),0)
> printVarSummary(xxx)
>
> will yield something like
>
> Variable: xxx
> > Number of Dimensions: 3
> > Dimensions and sizes: [9] x [18] x [30]
>
> The ncl_join|20 is averaged so it becomes degenerate (size=1)
> so it 'disappears'; the {spell(nr)} is size=1 (ie, degenerate)
> soi it is eliminated.
>
> So, dim0 on the left is 20 and on the right is 9,
> hence, the error message
> ---
>
> Variable: spell_tot_uk
> > Number of Dimensions: 4
> > Dimensions and sizes: [20] x [spell | 60] x [latitude | 18] x
> [longitude | 30]
> ---
> Variable: cold_uk1
> > Number of Dimensions:
> > Dimensions and sizes: [ncl_join | 20] x [run_length | 180] x
> [number | 9] x [latitude | 18] x [longitude | 30]
>
> On 7/13/12 2:51 AM, Cannavina, Dominique wrote:
>> Hi NCL Talk
>>
>> Can I ask for some help with the following error message-
>>
>> When I run the script (attached along with summary of all variables in
>> script) I get the following;
>>
>> fatal:Dimension size mismatch on subscript #0, left-hand and right-hand
>> side dimensions do not match
>>
>> fatal:["Execute.c":7556]:Execute: Error occurred at or near line 207
>>
>> Line 207 is
>>
>> spell_tot_uk(:,nr,:,:) = dim_sum_n(cold_uk1(:,{spell(nr)},:,:,:),0)
>>
>> The two variables it is picking up are given below but I can't see why
>> they are being picked up as being different sizes as dimension #0 has a
>> size of '20' for both. It relates to the number of files that have been
>> inputted.
>>
>> Variable: spell_tot_uk
>>
>> Type: float
>>
>> Total Size: 2592000 bytes
>>
>> 648000 values
>>
>> Number of Dimensions: 4
>>
>> Dimensions and sizes: [20] x [spell | 60] x [latitude | 18] x [longitude
>> | 30]
>>
>> Coordinates:
>>
>> spell: [1..60]
>>
>> latitude: [75..32.5]
>>
>> longitude: [-27.5..45]
>>
>> Number Of Attributes: 2
>>
>> spell : 1
>>
>> _FillValue : 9.96921e+36
>>
>> Variable: cold_uk1
>>
>> Type: integer
>>
>> Total Size: 69984000 bytes
>>
>> 17496000 values
>>
>> Number of Dimensions: 5
>>
>> Dimensions and sizes: [ncl_join | 20] x [run_length | 180] x [number |
>> 9] x [latitude | 18] x [longitude | 30]
>>
>> Coordinates:
>>
>> run_length: [1..180]
>>
>> number: [0..8]
>>
>> latitude: [75..32.5]
>>
>> longitude: [-27.5..45]
>>
>> Number Of Attributes: 2
>>
>> cold_crit_values : 0
>>
>> long_name : unique cold runs
>>
>> Any help much appreciated
>>
>> Kind regards
>>
>> Dominique
>>
>>
>>
>> _______________________________________________
>> 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
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Jul 13 07:46:50 2012

This archive was generated by hypermail 2.1.8 : Wed Jul 18 2012 - 14:33:00 MDT