Skip to content

Commit

Permalink
Update for grib2io/templates.py
Browse files Browse the repository at this point in the history
Changing metadata attr names...

unitOfTimeRange -> unitOfForecastTime
forecastTime -> valueOfForecastTime

These new names are more consistent with attr names elsewhere and should
be less confusing as end users should use leadTime attr which is a
datetime.timedelta object.
  • Loading branch information
EricEngle-NOAA committed Nov 8, 2023
1 parent f7ecf04 commit e590758
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions grib2io/templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -884,15 +884,15 @@ def __get__(self, obj, objtype=None):
def __set__(self, obj, value):
obj.section4[self._key[obj.pdtn]+2] = value

class UnitOfTimeRange:
class UnitOfForecastTime:
_key = defaultdict(lambda: 7, {48:18})
#_key = {0:7, 1:7, 2:7, 5:7, 6:7, 8:7, 9:7, 10:7, 11:7, 12:7, 15:7, 48:18}
def __get__(self, obj, objtype=None):
return Grib2Metadata(obj.section4[self._key[obj.pdtn]+2],table='4.4')
def __set__(self, obj, value):
obj.section4[self._key[obj.pdtn]+2] = value

class ForecastTime:
class ValueOfForecastTime:
_key = defaultdict(lambda: 8, {48:19})
def __get__(self, obj, objtype=None):
return obj.section4[self._key[obj.pdtn]+2]
Expand Down Expand Up @@ -1390,8 +1390,8 @@ class ProductDefinitionTemplate0():
backgroundGeneratingProcessIdentifier: int = field(init=False,repr=False,default=BackgroundGeneratingProcessIdentifier())
hoursAfterDataCutoff: int = field(init=False,repr=False,default=HoursAfterDataCutoff())
minutesAfterDataCutoff: int = field(init=False,repr=False,default=MinutesAfterDataCutoff())
unitOfTimeRange: Grib2Metadata = field(init=False,repr=False,default=UnitOfTimeRange())
forecastTime: int = field(init=False,repr=False,default=ForecastTime())
unitOfForecastTime: Grib2Metadata = field(init=False,repr=False,default=UnitOfForecastTime())
valueOfForecastTime: int = field(init=False,repr=False,default=ValueOfForecastTime())
typeOfFirstFixedSurface: Grib2Metadata = field(init=False,repr=False,default=TypeOfFirstFixedSurface())
scaleFactorOfFirstFixedSurface: int = field(init=False,repr=False,default=ScaleFactorOfFirstFixedSurface())
scaledValueOfFirstFixedSurface: int = field(init=False,repr=False,default=ScaledValueOfFirstFixedSurface())
Expand Down

0 comments on commit e590758

Please sign in to comment.