Skip to content

Commit

Permalink
Merge pull request #243 from jswhit/issue241
Browse files Browse the repository at this point in the history
fix for issue #241
  • Loading branch information
jswhit authored Apr 22, 2024
2 parents 00c8892 + 69fe545 commit e3a8958
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/pygrib/_pygrib.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -686,6 +686,8 @@ def setdates(gribmessage grb):
elif grb.has_key('stepRange'):
# if forecastTime doesn't exist, use end of stepRange.
ftime = grb['stepRange'] # computed key, uses stepUnits
if grb.has_key('stepUnits') and grb.stepUnits in _ftimedict:
grb.fcstimeunits = _ftimedict[grb.stepUnits]
# if it's a range, use the end of the range to define validDate
try:
ftime = float(ftime.split('-')[1])
Expand Down Expand Up @@ -873,9 +875,9 @@ cdef class gribmessage(object):
ftime = self['stepRange'] # computed key, uses stepUnits
if self.valid_key('stepType') and self['stepType'] != 'instant':
inventory.append(':fcst time %s %s (%s)'%\
(ftime,self.fcstimeunits,self.stepType))
(ftime,_ftimedict[self.stepUnits],self.stepType))
else:
inventory.append(':fcst time %s %s'% (ftime,self.fcstimeunits))
inventory.append(':fcst time %s %s'% (ftime,_ftimedict[self.stepUnits]))
elif self.valid_key('forecastTime'):
ftime = repr(self['forecastTime'])
inventory.append(':fcst time %s %s'% (ftime,self.fcstimeunits))
Expand Down

0 comments on commit e3a8958

Please sign in to comment.