<div dir="ltr"><div>Hi Jeff, <br></div><div><br></div><div>The code below looks good and I thought it would solve my issue, but it didn't quite work.  Does it assume that t=1 is at the initial model run time such as 0Z, 6Z, 12Z, and 18Z?  Also, I had issues at t=1 with apcpsfc.  I had a lot of values there at: 
-39330708 based on a grid check.  I believe that I corrected the issue by using const(apcpsfc,0,-u) when I download the .dat file to set all of those large negative numbers to 0.  <br></div><div><br></div><div>I am finding that I still need the following if statement or t=1 will error out and t=2 will show no data:</div><div><br></div><div> if (t=1|t=2)  <br></div><div> 'define snow = apcpsfc * csnowsfc' <br></div><div>else</div><div>...</div><div><br></div><div>Can you tell me if I am using the math_fmod properly?</div><div><br></div><div> For example, let's say I'm using the 18Z model run, t=1 (18Z), t=2 (21Z) and t=3 (0Z), etc...  At t = 3, then fhr = 3 * 3 = 9 and 9/6 is 1 with a remainder of 3 so skip to the if (mod = 3).  Am I using that function correctly?  So, t =1 (say at 18Z), would be 3/6 = 0.5 which is not defined unless I use my if statement above.<br></div><div><br></div><div>Thanks again,</div><div><br></div><div>Jeff C<br></div><div><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Dec 29, 2021 at 2:03 PM Jeff Duda <<a href="mailto:jeffduda319@gmail.com" target="_blank">jeffduda319@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"><div dir="ltr"><div>csnowsfc represents a snow-mask only for falling precip in that time step. It is not a fixed mask. Therefore, you will not be able to used your proposed explicit formula for computing fallen snow at each time step. You will need to sum the time-step snowfall to get run-total snowfall accumulation using something like the following:</div><div><br></div><div>fhr = t * 3<br></div><div>mod = math_fmod(fhr,6)</div><div>if (mod = 0)</div><div> 'define snow = sum(apcpsfc*csnowsfc,t=1,t-0,2)'</div><div>else</div><div> if (mod = 3)</div><div>  'define snow = sum(apcpsfc*csnowsfc,t=1,t-1,2) + apcpsfc*csnowsfc'<br></div><div> endif</div><div>endif</div><div><br></div><div>'d 10*snow/25.4'</div><div><br></div><div>the ",2)" in the sum command refers to skipping one time slice each, to avoid double counting those 3-hour increments. The second part of the if-statement is to add the final 3-hour accumulated snowfall.</div><div><br></div><div>There is a different way to do this, since those data files also contain snowdepth as snodsfc. You could simply display 39.97*(snowdsfc - snowdsfc(t-1)) as the difference in snow depth between 3-hour outputs (scaled to inches from meters). Yes, there will be some negatives due to snow melt, but you can easily mask those out. I would imagine this method would be quite similar to the above method, as it is unlikely that there would be much snow melt or removal at a grid point during which snow was actively falling during a 3-hour window. And this latter formula is certainly simpler and less computationally intensive.<br></div><div><br></div><div>Jeff Duda<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Dec 28, 2021 at 10:03 PM Jeff Chabot <<a href="mailto:jsc219@gmail.com" target="_blank">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"><div dir="ltr"><div>Hello GrADS Users,</div><div><br></div><div>I have been struggling to plot total snow accumulations with GFS .25 degree for the past week or so.  I know GFS does the following with precip accum: 0-3hr;0-6hr,6-9hr; 6-12hr, etc and I am trying to workaround that alternating precip totals.<br></div><div><br></div><div>I was able to get this equation to work for total liquid precip, but I can't get it to work with snow:</div><div><br></div><div>if t=1|t=2<br></div><div>'display 'precip'<br></div><div>else<br></div><div>'display sum(precip,t-1,t+0) - sum(precip,t-1,t-1)'</div><div>endif</div><div><br></div><div>Where:<br></div><div>precip = apcpsfc/25.4 (for inches) and t = time steps from 1 to 129.</div><div><br></div><div>When I try to convert this to snow, I either get snow totals off the charts 100+ inches or I get rolling precip that moves and does not accumulate.  I am using a 10:1 ratio with csnowsfc to detect snow where 1 is snow, 0 is no snow.</div><div><br></div><div>I started with the equation above:</div><div><br></div><div>
<div>if t=1|t=2<br></div><div>'display 'asnow'<br></div><div>else<br></div><div>'define preciptot = sum(precip,t-1,t+0) - sum(precip,t-1,t-1)'</div><div>'display preciptot * 10'</div><div>endif</div>

</div><div><br></div><div>Where: <br></div><div>asnow = apcpsfc * csnowsfc * 10.<br></div><div><br></div><div>The above equation shows a 10:1 ratio for all of the precip.  Once I attempt to multiply by * csnowsfc (in the else section), I lose total precip and instead see moving precip over time.  I tried it in the sum equations multiplying precip * csnowsfc; then just in the display preciptot * csnowsfc * 10.  I even tried to use the same sum equation for precip substituting precip for csnowsfc, but none of these attempts worked to show total snow accumulations from t=1 to 129. I just can't get it to work with GFS.  All other models like nam, hrrr, use a nice simple sum equation:  'display sum(asnow,t=1,t='t')'.</div><div><br></div><div>Any help here would be really appreciative.  <br></div><div><br></div><div>Sincerely,</div><div><br></div><div>Jeff C<br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div></div>
_______________________________________________<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"><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>
_______________________________________________<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></div>