[ncl-talk] total number of times in files opened with addfiles

Zilore Mumba zmumba at gmail.com
Fri Apr 1 23:04:38 MDT 2022


I have 13 files, i.e. analysis plus 12 hourly files of forecasts.  print
(files_all[0]->Times) and printVarSummary(times) give the following output:
Variable: Times (file variable)
Type: character
Total Size: 19 bytes
            19 values
Number of Dimensions: 2
Dimensions and sizes: [Time | 1] x [DateStrLen | 19]
Coordinates:
(0,0) 2
(0,1) 0
(0,2) 2
(0,3) 2
(0,4) -
(0,5) 0
(0,6) 3
(0,7) -
(0,8) 2
(0,9) 8
(0,10) _
(0,11) 0
(0,12) 0
(0,13) :
(0,14) 0
(0,15) 0
(0,16) :
(0,17) 0
(0,18) 0

Variable: times
Type: character
Total Size: 247 bytes
            247 values
Number of Dimensions: 2
Dimensions and sizes: [Time | 13] x [DateStrLen | 19]
Coordinates:


On Fri, Apr 1, 2022 at 11:53 PM Dave Allured - NOAA Affiliate <
dave.allured at noaa.gov> wrote:

> Please show print (files_all[0]->Times) and printVarSummary(times).
>
>
> On Fri, Apr 1, 2022 at 3:42 PM Zilore Mumba via ncl-talk <
> ncl-talk at mailman.ucar.edu> wrote:
>
>> I have a number of WRF output files, one file per hour, which I open with
>> files_all = addfiles(FILES+".nc","r")
>>
>> I then get the times and the total number with.
>>   times = files_all[:]->Times      ; get all times in the file
>>   ntimes = dimsizes(times)         ; number of times in the file
>>
>> I think I am missing something here because  with print(ntimes) I see two
>> numbers.
>> I want to use ntimes in a loop: do it = 0,ntimes-1,2
>>
>> This gives me the error: fatal:Loop end must be scalar, can't execute
>> loop.
>> How do I get the times from files opened with addfiles. I will appreciate
>> any assistance.
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20220402/d1058baf/attachment.html>


More information about the ncl-talk mailing list