[gradsusr] Using a calculation against all previous hours in current hour.

Christopher Gilroy chris.gilroy at gmail.com
Tue Oct 20 09:42:53 EDT 2015


Ok, so I know I can 'easily' do this via a massive if block but I'm trying
to avoid that, and I have been. I have a calculation that will return a
unique value depending on which t it's running on.

So when I get to t=10 I need to run a calculation on data contained in t=1,
t=2, t=3, etc. t=20 would need to run the calculation t=1, t=2, t=3, etc up
to t=20. The actual value of of each t would be the same for the entire run
if that helps to understand though.

So take this horrible example:

'define t2m = tmp2m-273.15'
'd t2m+allpreviousforecasthourt2ms'

Now, the other key is that I don't download all files and then run in one
big loop. I download each file one-by-one and process one-by-one, in
real-time, as they are released.

A real snippet of how I'm currently achieving this would look like:

if (t=2)
'set t 2'
'define t2m06 = tmp2m-273.15'

'define t2mtotal= t2m06'
'd t2mtotal'
endif

if (t=3)
'set t 2'
'define t2m06 = tmp2m-273.15'

'set t 3'
'define t2m12 = tmp2m-273.15'

'define t2mtotal= t2m06+t2m12'
'd t2mtotal'
endif

if (t=4)
'set t 2'
'define t2m06 = tmp2m-273.15'

'set t 3'
'define t2m12 = tmp2m-273.15'

'set t 4'
'define t2m18 = tmp2m-273.15'

'define t2mtotal= t2m06+t2m12+t2m18'
'd t2mtotal'
endif



So, whether t2m06 is ran during hour 06, 12, 18, 240, etc t2m06 is going to
be the exact same value. As you can see, the if blocks get exponentially
bigger each t and that's what concerns me in terms of grads memory limits
or if there's simply a better/faster approach.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20151020/0f809e7f/attachment.html 


More information about the gradsusr mailing list