# Re: Conforming arrays having different time dimensions

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Thu May 23 2013 - 20:44:23 MDT

Well ... you can use print statements to determine the problem
It is not possible for anyone to determine the issue
with the information provided.

You should use 'printVarSummary(...)' often
Also, you should include the version of NCL you are using.

The attached is one possible approach.
You must calculate the 'dudx' quantity. See sample code
whch suggests two approached to calculate dudx

On 5/23/13 7:35 AM, Abhik Santra wrote:
> Hello Dennis,
>
> Thank you very much for your support.
> But, unfortunately the code didn't work.
> It shows some error:
>
> fatal:Subscript out of range, error in subscript #0
> fatal:An error occurred reading unknown
> fatal:["Execute.c":8128]:Execute: Error occurred at or near line 29 in file test.ncl
>
>
> I am attaching the code here.
> Please check it and let me know where I have made mistake.
>
>
> Regards,
> Abhik
>
>
> ----- Original Message -----
> From: "Dennis Shea" <shea@ucar.edu>
> To: "Abhik Santra" <abhiksantra@tropmet.res.in>
> Cc: "ncl-talk" <ncl-talk@ucar.edu>
> Sent: Wednesday, May 22, 2013 11:24:18 PM
> Subject: Re: Conforming arrays having different time dimensions
>
> Oops ...
>
> p(nt) = Uc(tc,:,:))*dudx(nt,:,:)
>
> should be
>
> p(nt,:,:) = Uc(tc,:,:))*dudx(nt,:,:)
>
> On 5/22/13 11:50 AM, Dennis Shea wrote:
>> Since 7305%366 is not 0 (=351)
>>
>> it seems to me that the task would have to be done in a loop,
>>
>> Below 'ct' is climate time (eg: day of year).
>> You would have to determine how 'tc' matches up with the dates
>> (days) of dudx (u). The following is a generic approach:
>>
>> ntim = 7305
>>
>> p = u
>> p = 0.0 ; initialize to 0.0
>>
>> do nt=0,ntim-1
>> tc = ind(Uc&day(tc).eq.u&time(nt)) ; this you must determine
>> p(nt) = Uc(tc,:,:))*dudx(nt,:,:)
>> end do
>>
>>
>> On 5/21/13 5:16 AM, Abhik Santra wrote:
>>> Dear NCL-users,
>>>
>>> I want to calculate the term Uc.(du/dx)
>>> where Uc: daily climatological mean having dimension (366 x nlat x mlon)
>>> u: daily anomalies dimensioned (ntim|7305 x nlat x mlon) ; 20 years daily data.
>>>
>>> Since the arrays (du/dx) and Uc have different time dimensions, how can I multiply the (du/dx) term by Uc?
>>> What is the right way to conform these two arrays?
>>>
>>> Thanks in advance.
>>>
>>> Best Wishes,
>>> Abhik
>>>
>>> ___________________________________________
>>>
>>> Abhik Santra
>>> CSIR Research Fellow,
>>> Indian Institute of Tropical Meteorology,
>>> Pune - 411008.
>>> India
>>> ___________________________________________
>>> _______________________________________________
>>> 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 Thu May 23 20:44:27 2013

This archive was generated by hypermail 2.1.8 : Thu May 30 2013 - 11:38:10 MDT