Any limit to the number of files opened ?

Davide Sotil Bertanzetti davide at CEAM.ES
Tue Sep 12 08:48:20 EDT 2006


Ok so I can't help you... or maybe yes.

I don't know if this could be usefull to you, and I haven't thought about it
very much, but, if I were in your case, these are the 2 options that I think
I would investigate in order try to solve this new problem:

1-GRADS script. Make a GRADS script, or modify yours, with a loop wich opens
2 file at a time (one for the u-wind and one for the v-wind) extracting the
required info for all times and summing it in a sum-variable. As you are
making geographical means, maybe this could be done using the "sum"
function. Then close the files, starting a new loop wich open 2 new files,
and so on, until files are over and the sum-variable has all the required
values for the mean.

2-Templates. Make a script wich reads the "TDEF" value from all the
descriptors files in order to sum them. Then, the same script could
automatically make the new 2 descriptors file, one for the u-wind and one
for the v-wind.

If you are using Windows, option 2 could not be as usefull and easy as they
could be in a unix/linux environment.

Maybe option 1 is a possibility for you, modifying your current script. Maybe.


Davide Sotil Bertanzetti.




On Tue, 12 Sep 2006 12:17:44 +0100, See Hai Ooi <axl419 at YAHOO.COM> wrote:

>Dear Davide Sotil Bertanzetti,
>
>     Thank you.
>
>     As you are aware, 2004, for example, is a leap
>year but 2001 is not.  If I need to open files from
>year 2001(1460 time-steps) to 2004(1464 time-steps),
>the few pertinent lines of the modified single data
>descriptor file have to be written as
>
>     DSET uwnd.%y4.nc
>     OPTIONS template
>     TDEF 5844 linear 00z1jan2001 6hr
>
>     In other words, I need to know the number of leap
>years within the required period, say, from 1986 to
>2005 in order to have the right TDEF.  Also, I need to
>have another single data descriptor file for
>v-component wind.  Can I avoid doing all these by just
>using the script that I had written in order to attain
>my objective ?  If yes, how should I overcome the
>error encountered ?  Hope to hear from you soon.
>
>     Best regards.
>
>OOI See-hai
>
>
>
>
>--- Davide Sotil Bertanzetti <davide at CEAM.ES> wrote:
>
>> Hello Ooi See Hai. I don't know if there is a limit
>> on the total number of
>> opened files, maybe yes, but I think there is an
>> alternative way to do what
>> you are purposing:
>>
>> You can use a single data descriptor file to
>> aggregate multiple data files
>> and handle them as if they were one individual file.
>> You can find the
>> proceadure in the GRADS User's Guide->Anlaysis
>> Topics->Using Templates to
>> Aggregate Data Files.
>>
>> Davide Sotil Bertanzetti
>>
>>
>> On Tue, 12 Sep 2006 09:14:16 +0100, See Hai Ooi
>> <axl419 at YAHOO.COM> wrote:
>>
>> >Dear all,
>> >
>> >     My intention is to open a total of 40 files
>> >consisting of u- and v- component winds at 850 hPa
>> >level from 1986 to 2005 in order to obtain 20-year
>> >climatological pentad mean wind as shown in my
>> script
>> >attached.  However, on reaching file number 33, the
>> >following error messages appeared :-
>> >
>> >   add_connect: too many connects, cannot add
>> another
>> >   g:\cdc\uvw\uwnd.2002.nc does not exist or is not
>> a
>> >netCDF file.
>> >   Couldn't ingest SDF metadata
>> >   .
>> >   .
>> >   .
>> >   SET DFILE error: file 33 not open
>> >   Data Request Error: File number out of range
>> >       Variable = uwnd.33
>> >   .
>> >   .
>> >   .
>> >  For your information, I use window version of
>> GrADS
>> >V1.8SL9.  I have no problem in obtaining 10-year
>> data
>> >(1996-2005).
>> >
>> >   Can someone show me how to overcome the error ?
>> >
>> >   Thank you.
>> >
>> >Sincerely,
>> >
>> >Ooi See Hai
>> >
>> >Send instant messages to your online friends
>> http://uk.messenger.yahoo.com
>> >* To obtain climatological pentad mean 850 hPa
>> winds
>> >* by Ooi See Hai on 12 September 2006
>> >*
>> > 'reinit'
>> >*
>> >  'set gxout fwrite'
>> >  'set fwrite c:\onset\data\o_pentad.dat'
>> >*
>> >*
>> >    'sdfopen g:\cdc\uvw\uwnd.1986.nc'
>> >    'sdfopen g:\cdc\uvw\vwnd.1986.nc'
>> >*
>> >* Note: Initialization can only be done after
>> opening files
>> >*
>> >   i=1
>> >   while (i <= 73)
>> >     'up'i'=0'
>> >     'vp'i'=0'
>> >     i=i+1
>> >   endwhile
>> >*
>> >   ny=1986
>> >   m=1
>> >*
>> >   while (m <= 40)
>> >*
>> >    'set lev 850'
>> >*
>> >    i=1
>> >    ti=1
>> >    tf=17
>> >*
>> >* The extra day in leap year is not taken into
>> account
>> >*
>> >    while (i <= 73)
>> >*
>> >      'up'i'=up'i'+ave(uwnd.'m',t='ti',t='tf',4)'
>> >      'vp'i'=vp'i'+ave(vwnd.'m+1',t='ti',t='tf',4)'
>> >      i=i+1
>> >      ti=ti+20
>> >      tf=tf+20
>> >    endwhile
>> >*
>> >*
>> >    ny=ny+1
>> >    m=m+2
>> >*
>> >    if (m <= 40)
>> >     'sdfopen g:\cdc\uvw\uwnd.'ny'.nc'
>> >     'sdfopen g:\cdc\uvw\vwnd.'ny'.nc'
>> >     'set dfile 'm
>> >    endif
>> >*
>> >   endwhile
>> >*
>> >   i=1
>> >   while (i <= 73)
>> >     'set t 'i
>> >     'upm'i'=up'i'/'m-2
>> >     'vpm'i'=vp'i'/'m-2
>> >     'd ave(upm'i',lon=97,lon=108)'
>> >     'd ave(vpm'i',lon=97,lon=108)'
>> >     i=i+1
>> >   endwhile
>> >*
>> >  'disable fwrite'
>> >*
>> >*
>> >
>> >
>>
>
>
>Send instant messages to your online friends http://uk.messenger.yahoo.com



More information about the gradsusr mailing list