Thanks Dave. Easy when you know how :-)
Is it worth considering ammending the documentation on this? The entry
Argumentsformat_or_file Either a string specifying a file format, or a reference to a file
opened with addfile or addfiles.
certainly gave me the impression that the file reference approach should be a viable alternative with addfiles().
Thanks,
Ramon
________________________________
From: David Brown <dbrown_at_ucar.edu>
To: Ramon Docto <mondocto2_at_yahoo.com>
Cc: "ncl-talk_at_ucar.edu" <ncl-talk_at_ucar.edu>
Sent: Tuesday, 11 June 2013 4:46 AM
Subject: Re: too many open files
Hi Ramon,
You need to call setfileoption before you open the file. In this case the first argument to setfileoption needs to be the type of the file you are going to open ("nc").
So:
setfileoption("nc","SuppressClose", False)
then f = addfiles(….
-dave
On Jun 7, 2013, at 11:30 PM, Ramon Docto <mondocto2_at_yahoo.com> wrote:
Hello list,
>
>
>
>I am trying to construct an object in memory from (~2000) files using addfiles().
>
>
>
>I have read the documentation about avoiding excess open filehandles by using the "SuppressClose" fileoption but have not found an example explicitly showing usage.
>
>
>
>The code snippet below still fails with "too many open files" errors:
>
>
>
>fls = systemfunc ("ls " + ipath + iname + "*.nc")
>f = addfiles (fls, "r")
>
>
>
>ListSetType (f, "cat") ;; concatenate (default)
>setfileoption(f, "SuppressClose", False) ;; avoid excess open files
>
>
>tmax = f[:]->tmaxscr(3:239:4,{lats(0):lats(1)},{lons(0):lons(1)})
> tmin =
f[:]->tminscr(3:239:4,{lats(0):lats(1)},{lons(0):lons(1)})
>
>
>
>Can anyone advise on this?
>
>
>Thanks,
>Ramon
>_______________________________________________
>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 Tue Jun 11 03:50:35 2013
This archive was generated by hypermail 2.1.8 : Tue Jun 11 2013 - 12:03:58 MDT