Re: Error calculating the daily data from 3 hourly files

From: Dave Allured <dave.allured_at_nyahnyahspammersnyahnyah>
Date: Sun, 23 Mar 2008 14:26:15 -0600

Erik,

You already have ntim in your script. Just reduce ntim to the
largest available multiple of 8, using the integer modulus operator.

Then limit the rest of your computations to the time range of 0 to
ntim-1, using the reduced value for ntim. Make sure you include
this one:

rDay = r(0:ntim-1:8,:,:) ; 'trick' to allocate ...

Dave Allured
CU/CIRES Climate Diagnostics Center (CDC)
http://cires.colorado.edu/science/centers/cdc/
NOAA/ESRL/PSD, Climate Analysis Branch (CAB)
http://www.cdc.noaa.gov/

Erik Noble wrote:
> Thank you. This worked.
> Yet, how could I change this code if I eventually have data where I
> don't know the number for my time dimension?
> -Erik
>
> On Sun, Mar 23, 2008 at 4:18 AM, Debasish Pai Mazumder
> <debasish_at_gi.alaska.edu> wrote:
>> Dear Erik,
>>
>> I had a look at your script. I think you got these error massages because
>> time dimension of your variable r is not divisible by 8. Actually time
>> dimension of r is 61 days and 3hours. If you first calculate daily data from
>> 3-hourly data for 61 days by reducing time dimension from 489 to 488 and
>> then calculate the data for 62nd day, you might solve your problem.
>>
>> Good luck
>>
>> Debasish
>>
>>
>>
>> -----Original Message-----
>> From: ncl-talk-bounces_at_ucar.edu [mailto:ncl-talk-bounces_at_ucar.edu] On Behalf
>> Of Erik Noble
>> Sent: Saturday, March 22, 2008 6:45 PM
>> To: ncl-talk_at_ucar.edu
>> Subject: Error calculating the daily data from 3 hourly files
>>
>> Hi all,
>> I have a problem with my script. When I run ncl it
>> gives the error below. I followed this example from the ncl archive
>> http://www.ncl.ucar.edu/Support/talk_archives/2006/0135.html
>> when trying to create daily data from 3-hourly data, yet I need help getting
>> past this error.
>>
>> I have attached my ncl script
>> and the error is below. What shall I do to solve it?
>> -Erik
>>
>> Erik_at_noble:/Volumes/Data_and_Models/ncl_scripts:ncl TRMM_Bar_Chart.ncl
>> Copyright (C) 1995-2007 - All Rights Reserved
>> University Corporation for Atmospheric Research
>> NCAR Command Language Version 5.0.0
>> The use of this software is governed by a License Agreement.
>> See http://www.ncl.ucar.edu/ for more details.
>>
>>
>> Variable: r
>> Type: float
>> Total Size: 120489600 bytes
>> 30122400 values
>> Number of Dimensions: 3
>> Dimensions and sizes: [time | 489] x [latitude | 220] x [longitude | 280]
>> Coordinates:
>> latitude: [-19.875..34.875]
>> longitude: [-34.875..34.875]
>> Number Of Attributes: 1
>> hdf_name : precipitation
>> fatal:Assignment type mismatch, right hand side can't be coerced to type of
>> left hand side
>> fatal:Execute: Error occurred at or near line 26 in file TRMM_Bar_Chart.ncl
>>
>> Erik_at_noble:/Volumes/Data_and_Models/ncl_scripts:ncl TRMM_Bar_Chart.ncl
>> Copyright (C) 1995-2007 - All Rights Reserved
>> University Corporation for Atmospheric Research
>> NCAR Command Language Version 5.0.0
>> The use of this software is governed by a License Agreement.
>> See http://www.ncl.ucar.edu/ for more details.
>>
>>
>> Variable: r
>> Type: float
>> Total Size: 120489600 bytes
>> 30122400 values
>> Number of Dimensions: 3
>> Dimensions and sizes: [time | 489] x [latitude | 220] x [longitude | 280]
>> Coordinates:
>> latitude: [-19.875..34.875]
>> longitude: [-34.875..34.875]
>> Number Of Attributes: 1
>> hdf_name : precipitation
>> fatal:Subscript out of range, error in subscript #2
>> fatal:An error occurred reading r
>> fatal:Execute: Error occurred at or near line 29 in file TRMM_Bar_Chart.ncl
>>
>> Erik_at_noble:/Volumes/Data_and_Models/ncl_scripts:
>>
>>
>>
>>
>>
>>
>>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk_at_ucar.edu
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Sun Mar 23 2008 - 14:26:15 MDT

This archive was generated by hypermail 2.2.0 : Sun Mar 23 2008 - 15:01:37 MDT