[gradsusr] Total Snow Accumulation with GFS .25 Degree

Jeff Duda jeffduda319 at gmail.com
Thu Dec 30 12:44:08 EST 2021


Jeff,
My previous response included some pseudo-code...it was not meant to be
used verbatim. You will need to make adjustments for your specific
application.

What is your source for the GFS data? Can you post output from wgrib2 -v or
g2ctl ?

As far as I've ever known, the time index in Grads always starts at 1,
regardless of the actual forecast length. The time axis is defined in the
control file...in the TDEF entry. So in reality, a formula converting the
time index in Grads to the valid forecast hour is fhr = (t - 1)*3 instead
of what I previously said...unless of course your TDEF entry did not
include the 00-hr output from GFS.

Remember, a modulus in math is simply a remainder. So (3 mod 6) = 3 even
though the value of 3/6 is 0.5.

This method does not depend on the initialization time.

Jeff Duda

On Thu, Dec 30, 2021 at 12:36 AM Jeff Chabot <jsc219 at gmail.com> wrote:

> Hi Jeff,
>
> 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.
>
> I am finding that I still need the following if statement or t=1 will
> error out and t=2 will show no data:
>
> if (t=1|t=2)
>  'define snow = apcpsfc * csnowsfc'
> else
> ...
>
> Can you tell me if I am using the math_fmod properly?
>
> 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.
>
> Thanks again,
>
> Jeff C
>
>
> On Wed, Dec 29, 2021 at 2:03 PM Jeff Duda <jeffduda319 at gmail.com> wrote:
>
>> 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:
>>
>> fhr = t * 3
>> mod = math_fmod(fhr,6)
>> if (mod = 0)
>>  'define snow = sum(apcpsfc*csnowsfc,t=1,t-0,2)'
>> else
>>  if (mod = 3)
>>   'define snow = sum(apcpsfc*csnowsfc,t=1,t-1,2) + apcpsfc*csnowsfc'
>>  endif
>> endif
>>
>> 'd 10*snow/25.4'
>>
>> 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.
>>
>> 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.
>>
>> Jeff Duda
>>
>> On Tue, Dec 28, 2021 at 10:03 PM Jeff Chabot <jsc219 at gmail.com> wrote:
>>
>>> Hello GrADS Users,
>>>
>>> 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.
>>>
>>> I was able to get this equation to work for total liquid precip, but I
>>> can't get it to work with snow:
>>>
>>> if t=1|t=2
>>> 'display 'precip'
>>> else
>>> 'display sum(precip,t-1,t+0) - sum(precip,t-1,t-1)'
>>> endif
>>>
>>> Where:
>>> precip = apcpsfc/25.4 (for inches) and t = time steps from 1 to 129.
>>>
>>> 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.
>>>
>>> I started with the equation above:
>>>
>>> if t=1|t=2
>>> 'display 'asnow'
>>> else
>>> 'define preciptot = sum(precip,t-1,t+0) - sum(precip,t-1,t-1)'
>>> 'display preciptot * 10'
>>> endif
>>>
>>> Where:
>>> asnow = apcpsfc * csnowsfc * 10.
>>>
>>> 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')'.
>>>
>>> Any help here would be really appreciative.
>>>
>>> Sincerely,
>>>
>>> Jeff C
>>>
>>>
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> gradsusr mailing list
>>> gradsusr at gradsusr.org
>>> http://gradsusr.org/mailman/listinfo/gradsusr
>>>
>>
>>
>> --
>> Jeff Duda, Research Scientist
>> University of Colorado Boulder
>> Cooperative Institute for Research in Environmental Sciences
>> NOAA/OAR/ESRL/Global Systems Laboratory
>> Boulder, CO
>> _______________________________________________
>> gradsusr mailing list
>> gradsusr at gradsusr.org
>> http://gradsusr.org/mailman/listinfo/gradsusr
>>
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr
>


-- 
Jeff Duda, Research Scientist
University of Colorado Boulder
Cooperative Institute for Research in Environmental Sciences
NOAA/OAR/ESRL/Global Systems Laboratory
Boulder, CO
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://gradsusr.org/pipermail/gradsusr/attachments/20211230/67a94741/attachment.html>


More information about the gradsusr mailing list