<div dir="ltr"><div>Oh yeah, I almost forgot...the default units of apcpsfc are kg/m^2 (equivalent to mm). If you want values in inches, you need to divide the final value by 25.4. That should really shave down your final values.</div><div><br></div><div>Jeff<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jun 23, 2021 at 2:11 PM Bill Reilly <<a href="mailto:bill_reilly@compuserve.com">bill_reilly@compuserve.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">I don't know if this helps, but this is how I display 3hr precipitation:<br>
<br>
if (tstep="006" | tstep="012" | tstep="018" | tstep="024" | tstep="030" <br>
| tstep="036" | tstep="042" | tstep="048" | tstep="054" | tstep="060" | <br>
tstep="066" | tstep="072" | tstep="084" | tstep="096" | tstep="108" | <br>
tstep="120" | tstep="132" | tstep="144" | tstep="156" | tstep="168" | <br>
tstep="180")<br>
    'd (apcp03-apcp03(t-1))*10'<br>
else<br>
    'd const(apcp03,0.001,-u)*10'<br>
endif<br>
<br>
--<br>
<br>
Bill Reilly<br>
<br>
(+34) 686-110-748<br>
<br>
<a href="mailto:bill@passageweather.com" target="_blank">bill@passageweather.com</a><br>
<a href="http://www.passageweather.com" rel="noreferrer" target="_blank">www.passageweather.com</a><br>
<br>
On 06/23/2021 20:49, Jeff Duda wrote:<br>
> Then I'd start checking the apcpsfc arrays in your individual files, <br>
> because that might be the culprit.<br>
><br>
> By the way, your looping syntax is incorrect. In grads, you perform <br>
> modular arithmetic using R = math_fmod(N,D) for remainder R, number N, <br>
> and divisor D. So you would use<br>
> if (R = 0) ...<br>
><br>
> On Tue, Jun 22, 2021 at 3:19 PM Jeff Chabot <<a href="mailto:jsc219@gmail.com" target="_blank">jsc219@gmail.com</a> <br>
> <mailto:<a href="mailto:jsc219@gmail.com" target="_blank">jsc219@gmail.com</a>>> wrote:<br>
><br>
>     Hi Jeff,<br>
><br>
>     Thanks for the quick response.  I removed the const function. I was<br>
>     using that part for my precip type equations, but as you said, I<br>
>     probably don't need it.<br>
><br>
>     As for what you mentioned, I couldn't get it to work.  I am trying to<br>
>     show a running total of precip accum every 3 hours even though it<br>
>     alternates between 3 and 6 hours precip.<br>
><br>
>     So, I came up with the following based on what you wrote:<br>
><br>
>     if (hh = 0 mod 6)<br>
>       'display sum(apcpsfc/25.4,t=1,t-0,2)'<br>
>      else<br>
>       'display sum(apcpsfc/25.4,t=1,t-1,2) + apcpsfc/25.4'<br>
>     endif<br>
><br>
>     Where hh = forecast hour.<br>
><br>
>     Unfortunately, it is still resulting in overestimated values such as<br>
>     8-12 inches of total precip in 32 hours when it should be more like<br>
>     3-5 inches and I don't have precip accum until hour 6 (hour 3 I get no<br>
>     data).<br>
><br>
>     I am missing something, I just don't know what.<br>
><br>
>     Thanks again,<br>
><br>
>     Jeff Chabot<br>
><br>
><br>
>     On Tue, Jun 22, 2021 at 11:19 AM Jeff Duda <<a href="mailto:jeffduda319@gmail.com" target="_blank">jeffduda319@gmail.com</a><br>
>     <mailto:<a href="mailto:jeffduda319@gmail.com" target="_blank">jeffduda319@gmail.com</a>>> wrote:<br>
>     ><br>
>     > Jeff,<br>
>     > It seems you are overcomplicating this.<br>
>     ><br>
>     > First, why are you using the const function for your sum? There<br>
>     should be no negative values nor any undefined values in the<br>
>     apcpsfc field. If there are, then there are problems at the level<br>
>     of the data processing upstream of you.<br>
>     ><br>
>     > Second, my understanding of the precip array in GFS output is<br>
>     that it alternates between 3- and 6-hour accumulation. So at 0300,<br>
>     0900, 1500, 2100, apcpsfc contains 3-hour precipitation, whereas<br>
>     at 0000, 0600, 1200, and 1800 UTC, apcpsfc contains 6-hour<br>
>     precipitation. That means that pairs of adjacent time stamp<br>
>     apcpsfc arrays are not independent of each other; the 6-hour<br>
>     accumulation field completely contains the 3-hour precipitation<br>
>     field. Therefore, if you are looking for run-total precipitation,<br>
>     you only need to sum the apcpsfc arrays every other time stamp up<br>
>     to the time before the valid time (or the valid time itself, if<br>
>     the forecast hour is divisible by 6). The simple function<br>
>     math_fmod(t,6) will give you the ability to decide if you are<br>
>     computing this for forecast hours divisible only by 3.<br>
>     ><br>
>     > In essence, your display command really only needs to be<br>
>     ><br>
>     > * if forecast hour = 0 mod 6<br>
>     > 'd sum(apcpsfc,t=1,t-0,2)'<br>
>     > * else<br>
>     > 'd sum(apcpsfc,t=1,t-1,2) + apcpsfc'<br>
>     ><br>
>     > ...or something similar to that.<br>
>     ><br>
>     > Jeff Duda<br>
>     ><br>
>     > On Tue, Jun 22, 2021 at 8:43 AM Jeff Chabot <<a href="mailto:jsc219@gmail.com" target="_blank">jsc219@gmail.com</a><br>
>     <mailto:<a href="mailto:jsc219@gmail.com" target="_blank">jsc219@gmail.com</a>>> wrote:<br>
>     >><br>
>     >> 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>
>     >><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>
>     <<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<br>
>     hours up<br>
>     >> to 10 days).<br>
>     >><br>
>     >> Next, I am trying to apply a sum to it to get total accumulated<br>
>     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<br>
>     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. <br>
>     If I<br>
>     >> use precip in the equation, then I get ridiculous precip totals<br>
>     of 24<br>
>     >> inches for 1/2 of the country in 10 days.  If I use rain, then<br>
>     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<br>
>     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> <mailto:<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>
>     <<a href="http://gradsusr.org/mailman/listinfo/gradsusr" rel="noreferrer" target="_blank">http://gradsusr.org/mailman/listinfo/gradsusr</a>><br>
>     ><br>
>     ><br>
>     ><br>
>     > --<br>
>     > Jeff Duda, Research Scientist<br>
>     > University of Colorado Boulder<br>
>     > Cooperative Institute for Research in Environmental Sciences<br>
>     > NOAA/OAR/ESRL/Global Systems Laboratory<br>
>     > Boulder, CO<br>
>     > _______________________________________________<br>
>     > gradsusr mailing list<br>
>     > <a href="mailto:gradsusr@gradsusr.org" target="_blank">gradsusr@gradsusr.org</a> <mailto:<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>
>     <<a href="http://gradsusr.org/mailman/listinfo/gradsusr" rel="noreferrer" target="_blank">http://gradsusr.org/mailman/listinfo/gradsusr</a>><br>
><br>
>     _______________________________________________<br>
>     gradsusr mailing list<br>
>     <a href="mailto:gradsusr@gradsusr.org" target="_blank">gradsusr@gradsusr.org</a> <mailto:<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>
>     <<a href="http://gradsusr.org/mailman/listinfo/gradsusr" rel="noreferrer" target="_blank">http://gradsusr.org/mailman/listinfo/gradsusr</a>><br>
><br>
><br>
><br>
> -- <br>
> Jeff Duda, Research Scientist<br>
> University of Colorado Boulder<br>
> Cooperative Institute for Research in Environmental Sciences<br>
> NOAA/OAR/ESRL/Global Systems Laboratory<br>
> Boulder, CO<br>
><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>
<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>