Skip to content

Commit e3a8958

Browse files
authored
Merge pull request #243 from jswhit/issue241
fix for issue #241
2 parents 00c8892 + 69fe545 commit e3a8958

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/pygrib/_pygrib.pyx

+4-2
Original file line numberDiff line numberDiff line change
@@ -686,6 +686,8 @@ def setdates(gribmessage grb):
686686
elif grb.has_key('stepRange'):
687687
# if forecastTime doesn't exist, use end of stepRange.
688688
ftime = grb['stepRange'] # computed key, uses stepUnits
689+
if grb.has_key('stepUnits') and grb.stepUnits in _ftimedict:
690+
grb.fcstimeunits = _ftimedict[grb.stepUnits]
689691
# if it's a range, use the end of the range to define validDate
690692
try:
691693
ftime = float(ftime.split('-')[1])
@@ -873,9 +875,9 @@ cdef class gribmessage(object):
873875
ftime = self['stepRange'] # computed key, uses stepUnits
874876
if self.valid_key('stepType') and self['stepType'] != 'instant':
875877
inventory.append(':fcst time %s %s (%s)'%\
876-
(ftime,self.fcstimeunits,self.stepType))
878+
(ftime,_ftimedict[self.stepUnits],self.stepType))
877879
else:
878-
inventory.append(':fcst time %s %s'% (ftime,self.fcstimeunits))
880+
inventory.append(':fcst time %s %s'% (ftime,_ftimedict[self.stepUnits]))
879881
elif self.valid_key('forecastTime'):
880882
ftime = repr(self['forecastTime'])
881883
inventory.append(':fcst time %s %s'% (ftime,self.fcstimeunits))

0 commit comments

Comments
 (0)