[ncl-talk] Subsetting problem across files when using addfiles and ListSetType("cat")

Martin, Elinor R. elinor.martin at ou.edu
Mon Aug 29 13:44:40 MDT 2016


I have a large set of files (time,level,lat,lon and 6 hourly) that span multiple years, but they are not divided nicely into months/years. I only want to read in one month at a time (and only 00Z), which in some cases, spans only one file, but in other cases spans two.

My code works perfectly for the months that come from only one file, but I get a “Segmentation fault (core dumped)” when the month spans two files. See brief code example below (happy to send more and actual files if needed).

example files:
temp_195001010600-195007010000.nc
temp_195007010600-195107010000.nc

example code snipet:

…….
all_files = systemfunc ("ls “+in_path+"temp_195*.nc")
f            = addfiles (all_files, "r")

ListSetType(f,"cat")
time            =       f[:]->time

utc_date = cd_calendar(time, 0)
yr = tointeger(utc_date(:,0))
mm = tointeger(utc_date(:,1))
hour =     tointeger(utc_date(:,3))

index = ind(yr.eq.1950 .and. mm.eq.7  .and. hour.eq.00)

ListSetType(f,"cat")
ta      =       f[:]->ta(index,:,:,:)
…………

As I mentioned, this works great if mm.eq.1, mm.eq.2 etc., but not when mm.eq.7. When reading in ta(index,:,:,:) I get the segmentation fault.


Thank you!

Elinor





*******************************************
Dr. Elinor Martin
Assistant Professor
School of Meteorology
University of Oklahoma
120 David L. Boren Blvd. Suite 5900
Norman, OK 73072-7307

Office: NWC 5642
Email: elinor.martin at ou.edu<mailto:elinor.martin at ou.edu>
Phone: 405 325 7392
Web: http://weather.ou.edu/~ermartin
*******************************************







-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160829/61ad71cf/attachment.html 


More information about the ncl-talk mailing list