Calculate 12 hour rainfall totals

Post any questions, ideas, or topics related to Jython and Python scripting.
User avatar
Sim
Posts: 9
Joined: Thu Jun 09, 2011 2:17 am

Calculate 12 hour rainfall totals

Post by Sim »

I have grib files with accumulated precipitation in 3 hour time steps from 0-240hr. What is the best way to calculate and display the past 12 hour precipitation totals. Is it best to do this through a script or from a formula. How would I do that?


Thank-you
User avatar
Rick
Posts: 404
Joined: Fri Jan 16, 2009 8:20 pm

Re: Calculate 12 hour rainfall totals

Post by Rick »

Hello,

You could create your own formula as discussed in the Users' manual:
http://www.ssec.wisc.edu/mcidas/doc/mcv_guide/1.01/

but you might find it easier to use one of the standard formulas: Under formulas, select Grids -> Time Steps -> Sum over time steps.

You could also do it with a jython function.

Rick
User avatar
Sim
Posts: 9
Joined: Thu Jun 09, 2011 2:17 am

Re: Calculate 12 hour rainfall totals

Post by Sim »

Thank you, Rick.

The standard formulas to calculate the time step difference is D(T)=D(T)-D(T-1). If the data is in 3-hourly intervals, what is the best way to calculate the difference of the data in every 6 or 12 hours?
User avatar
bobc
Posts: 995
Joined: Mon Nov 15, 2010 5:57 pm

Re: Calculate 12 hour rainfall totals

Post by bobc »

Hello -

You can actually go in and edit this 'Time Step Difference' formula to accommodate your needs. Right click on the 'Time step difference (D(T)=D(T)-D(T-1)) formula in the Field Selector tab of the Data Explorer, and select 'Edit Formula'. This opens the Formula Editor window.

In the Formula field, change the (field,-1) to (field,-4). The '-1' indicates that it takes the time difference using a time step 1 previous from the current. If you change this value to '-4', then it will use the 4th time back (4 times*3 hour difference=12 hours). Also, change the (T-1) to (T-4) in the Description of the formula. This will create a new formula in the Grids->Time Steps field for your modified formula.

Use this new formula to create your display and you should get your desired result. Please let us know if you have any further questions.

Thanks -
Bob Carp
McIDAS User Services
User avatar
Sim
Posts: 9
Joined: Thu Jun 09, 2011 2:17 am

Re: Calculate 12 hour rainfall totals

Post by Sim »

Dear Bob,

Thank you very much for your prompt reply.

My grib file is in 3-hourly intervals from T+0 to T+144 hrs and then in 6-hourly intervals from T+150 to T+240 hrs. How can I plot the 6-hourly rainfall from T+6 to T+240hr? As I want to show a continuous animation from T+6 to T+240hr, it may not be feasible to separate the grib file into two, one is the 3-hourly interval data and the other is 6-hourly interval data. May I have your advice please?

Thanks.

Regards,
Sim
User avatar
bobc
Posts: 995
Joined: Mon Nov 15, 2010 5:57 pm

Re: Calculate 12 hour rainfall totals

Post by bobc »

Hello -

I spoke with a few people around here, and we feel that the way to do this is with Jython programming. We also believe that this would be a great example to share with everyone. One of our programmers is going to spend some time working on this, and we will show you how to do this.

Our programmer would like to have your entire GRIB file that he can work with. Can you please post the file to our anonymous ftp location?

ftp ftp.ssec.wisc.edu
user: anonymous
password: e-mail address
cd pub
cd incoming
bin
put (your file name)

Please let us know when you have uploaded the file along with the file name.

Thanks -
Bob Carp
User avatar
Sim
Posts: 9
Joined: Thu Jun 09, 2011 2:17 am

Re: Calculate 12 hour rainfall totals

Post by Sim »

Dear Bob,

Thank you very much for your kind assistance.
I have set two grib files (H2D.grb and H3D.grb) to your ftp location for testing.

Thanks.

Regards,
Sim
User avatar
bobc
Posts: 995
Joined: Mon Nov 15, 2010 5:57 pm

Re: Calculate 12 hour rainfall totals

Post by bobc »

Hello -

Thank you for posting your grib files. Our programmer has them and he will be looking at them next week.

Thanks -
Bob Carp
User avatar
tomw
Posts: 296
Joined: Tue Dec 23, 2008 3:40 pm

Re: Calculate 12 hour rainfall totals

Post by tomw »

Sim:

While I am working on this, I must ask:

1. At first you wanted 12 hour totals, but in later messages you said 6 hour. I wonder which you want?
2. If it is 6 hourly, then when the transition between 3- and 6- hour totals takes place:
2012-02-20 06:00:00Z
2012-02-20 09:00:00Z
2012-02-20 12:00:00Z <=========
2012-02-20 18:00:00Z
what is the value in the 12Z hour? Is it a 3- or 6- hour total?

3. I notice that at the beginning, there is one 6-hour time step (from the "model start time" to the first forecast time) --
Are the values in the first "forecast time" the 3-hour total or a 6-hour total?
2012-02-14 12:00:00Z
2012-02-14 18:00:00Z <==========
2012-02-14 21:00:00Z
2012-02-15 00:00:00Z

Please let me know.

tom
User avatar
Sim
Posts: 9
Joined: Thu Jun 09, 2011 2:17 am

Re: Calculate 12 hour rainfall totals

Post by Sim »

Dear Tom,

Thank you very much for your kind assistance.

The field “Total_precipiation@surfuce” is as follow:

1. T+0: analysis field, zero rainfall
2. T+3hr, accumulated rainfall from T+0 up to T+3hr
3. T+6hr, accumulated rainfall from T+0 up to T+6hr
4. T+9hr, accumulated rainfall from T+0 up to T+9hr
5. T+12hr, accumulated rainfall from T+0 up to T+12hr <-- 6-hr total can be calculated from D(T+12hr)-D(T-6hr), two time steps difference
6. T+15hr, accumulated rainfall from T+0 up to T+15hr <-- 12-hr total can be calculated from D(T+15hr)-D(T+3hr), four time steps difference

49. T+144hr, accumulated rainfall from T+0 up to T+144hr
50. T+150hr, accumulated rainfall from T+0 up to T+150hr <-- 6-hr total can be calculated from D(T+150hr)-D(T+144hr), one time step difference only, not two.
51. T+156hr, accumulated rainfall from T+0 up to T+156hr <-- 12-hr total can be calculated from D(T+156hr)-D(T+150hr), two time steps difference, not four.

65. T+240hr, accumulated rainfall from T+0 up to T+240hr

As the time step from T+0 to T+144hr is in 3-hrly intervals and from T+150hr to T+240hr is in 6-hrly intervals, how can I calculate the 6-hr totals from T+6hr, T+9hr,… to T+240hr continuously, or the 12-hr totals from T+12hr, T+15hr,… to T+240hr?

Thanks.

Regards,
Sim
Post Reply