<div dir="ltr"><div>Jeff,</div><div>It seems you are overcomplicating this.</div><div><br></div><div>First, why are you using the const function for your sum? There should be no negative values nor any undefined values in the apcpsfc field. If there are, then there are problems at the level of the data processing upstream of you.</div><div><br></div><div>Second, my understanding of the precip array in GFS output is that it alternates between 3- and 6-hour accumulation. So at 0300, 0900, 1500, 2100, apcpsfc contains 3-hour precipitation, whereas at 0000, 0600, 1200, and 1800 UTC, apcpsfc contains 6-hour precipitation. That means that pairs of adjacent time stamp apcpsfc arrays <u>are not independent</u> of each other; the 6-hour accumulation field completely <u>contains</u> the 3-hour precipitation field. Therefore, if you are looking for run-total precipitation, you only need to sum the apcpsfc arrays every other time stamp up to the time before the valid time (or the valid time itself, if the forecast hour is divisible by 6). The simple function math_fmod(t,6) will give you the ability to decide if you are computing this for forecast hours divisible only by 3.</div><div><br></div><div>In essence, your display command really only needs to be</div><div><br></div><div>* if forecast hour = 0 mod 6<br></div><div>'d sum(apcpsfc,t=1,t-0,2)'</div><div>* else</div><div>'d sum(apcpsfc,t=1,t-1,2) + apcpsfc'</div><div><br></div><div>...or something similar to that.</div><div><br></div><div>Jeff Duda<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Jun 22, 2021 at 8:43 AM Jeff Chabot <<a href="mailto:jsc219@gmail.com">jsc219@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi GrADS Users,<br>
<br>
I am having trouble with computing precip accum using just GFS_0p25<br>
from NCEP.  The source that I am using is the following:<br>
<br>
<a href="http://nomads.ncep.noaa.gov:80/dods/gfs_0p25/gfs20210622/gfs_0p25_00z" rel="noreferrer" target="_blank">http://nomads.ncep.noaa.gov:80/dods/gfs_0p25/gfs20210622/gfs_0p25_00z</a><br>
<br>
To compute precip, I'm using:<br>
'define precip = const((apcpsfc/25.4),0,-u)'<br>
<br>
I set the following variables:<br>
t=1<br>
t0=0<br>
<br>
Then, in the while loop, I am using this equation to subtract 0-6<br>
hours from 0-3 hours (Please note, I only need to do this for GFS):<br>
'define rain = const(precip(t='t') - precip(t='t0'),0,-u)'<br>
<br>
This works well for a 3 hour interval of precip (every three hours up<br>
to 10 days).<br>
<br>
Next, I am trying to apply a sum to it to get total accumulated precip totals:<br>
'define accum = sum(rain,t=1,t='t')'<br>
<br>
For other models like NAM, I use the following since I don't need the<br>
define rain:<br>
'define accum = sum(precip,t=1,t='t')'<br>
<br>
I then do the counter and then end my loop:<br>
<br>
t = t+1<br>
t0 = t0+1<br>
endwhile<br>
<br>
I have tried modifying the define accum equation with no luck.  If I<br>
use precip in the equation, then I get ridiculous precip totals of 24<br>
inches for 1/2 of the country in 10 days.  If I use rain, then I'm not<br>
getting total precipitation, instead I'm getting an interval.<br>
<br>
Any suggestions would be greatly appreciated.  I suspect that I have<br>
an error in my equation. the correct accum equation.<br>
<br>
Sincerely,<br>
<br>
Jeff<br>
_______________________________________________<br>
gradsusr mailing list<br>
<a href="mailto:gradsusr@gradsusr.org" target="_blank">gradsusr@gradsusr.org</a><br>
<a href="http://gradsusr.org/mailman/listinfo/gradsusr" rel="noreferrer" target="_blank">http://gradsusr.org/mailman/listinfo/gradsusr</a><br>
</blockquote></div><br clear="all"><br>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><font size="2"><span>Jeff Duda, Research Scientist</span></font></div><div dir="ltr"><font size="2"><span></span></font>University of Colorado Boulder</div><div dir="ltr"><font size="2"><span></span></font>Cooperative Institute for Research in Environmental Sciences</div><div dir="ltr">NOAA/OAR/ESRL/Global Systems Laboratory<br><font size="2"><span>

<span>Boulder, CO<br></span></span></font>



</div></div></div></div></div></div></div></div></div></div>