juggling with datafiles

Chris Hayes c.hayes at WEERONLINE.NL
Thu Jan 7 08:37:56 EST 2010


Dear group,

 

I loop through 48 subsequent files and create maps from them.

 

Several of the weatherdata are cumulative, adding all precipitation from the
runtime to the hour of the prediction.

I would like to show maps of precipitation in the time period. E.g. of time
#23 by subtracting val.#22 from val.#23. 

I need 2 files to be open at the same time to accomplish that. 

 

I am looking for a memory efficient way to open and close files, in a loop
for all files. 

This setup came to mind:

 

Open 1

Open 2

Display 2-1

Close 1

Open 3

Display 3-2

Close 2

Open 4

Display 4-3

 

But I am only allowed to close the most recently opened file.

 

If I stop closing files I will end up having loads of files open: 

Open 1

Open 2

Display val.2- val.1

Open 3

Display val.3- val.2

Open 4

Display val.4- val.3

(repeat until #48)

Close 1-48

 

when I'm at the 23rd timestep I have file #1,#2 .. #23 open. 

I'm afraid the server will crash having so many files open.

 

I just need #22 and #23 for that display moment.

 

Or I have to close all files and re-open the last as # 1: file #22 becomes
file 1 and file #23 becomes file 2: 

Open #22  (1)

Open #23  (2)

Display val.2- val.1

Close #23 (2)

Close #22 (1)

 

Open #23

Open #24

Display val.2- val.1

Close #24

Close #23

 

But closing a file (#23 in this case) to immediately open it again seems
inefficient.

 

Is there a smart way to handle this?

 

I was pondering:

Open #1

Open #2

Display val.2- val.1

Open #3 AS and REPLACING 1

Display val.1- val.2  (effectively: #3-#2)

Open #4 AS and REPLACING 2

Display val.2- val.1   (effectively: #4-#3)

 

Is that possible?

 

FYI: I'm using a php script to send commands to opengrads, so I'm quite
flexible with the available loops. 

 

Thanks,

 

Chris

 

 

 

 

 

 

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20100107/b646dfdf/attachment.html 


More information about the gradsusr mailing list