@@ -686,6 +686,8 @@ def setdates(gribmessage grb):
686
686
elif grb.has_key(' stepRange' ):
687
687
# if forecastTime doesn't exist, use end of stepRange.
688
688
ftime = grb[' stepRange' ] # computed key, uses stepUnits
689
+ if grb.has_key(' stepUnits' ) and grb.stepUnits in _ftimedict:
690
+ grb.fcstimeunits = _ftimedict[grb.stepUnits]
689
691
# if it's a range, use the end of the range to define validDate
690
692
try :
691
693
ftime = float (ftime.split(' -' )[1 ])
@@ -869,16 +871,16 @@ cdef class gribmessage(object):
869
871
inventory.append(levstring)
870
872
elif self .valid_key(' level' ):
871
873
inventory.append(' :level %s ' % self [' level' ])
872
- if self .valid_key(' stepRange' ):
874
+ if self .valid_key(' forecastTime' ):
875
+ ftime = repr (self [' forecastTime' ])
876
+ inventory.append(' :fcst time %s %s ' % (ftime,self .fcstimeunits))
877
+ elif self .valid_key(' stepRange' ):
873
878
ftime = self [' stepRange' ] # computed key, uses stepUnits
874
879
if self .valid_key(' stepType' ) and self [' stepType' ] != ' instant' :
875
880
inventory.append(' :fcst time %s %s (%s )' % \
876
881
(ftime,self .fcstimeunits,self .stepType))
877
882
else :
878
883
inventory.append(' :fcst time %s %s ' % (ftime,self .fcstimeunits))
879
- elif self .valid_key(' forecastTime' ):
880
- ftime = repr (self [' forecastTime' ])
881
- inventory.append(' :fcst time %s %s ' % (ftime,self .fcstimeunits))
882
884
if self .valid_key(' dataDate' ) and self .valid_key(' dataTime' ):
883
885
inventory.append(
884
886
' :from ' + repr (self [' dataDate' ])+ ' %04i ' % self [' dataTime' ])
0 commit comments