Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 0 additions & 37 deletions lib/iris/fileformats/rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,43 +315,6 @@ class Reference(iris.util._OrderedHashable):
"""


def calculate_forecast_period(time, forecast_reference_time):
"""
Return the forecast period in hours derived from time and
forecast_reference_time scalar coordinates.

.. deprecated:: 1.10

"""
warn_deprecated("the `iris.fileformats.rules.calculate_forecast_period "
"method is deprecated.")

if time.points.size != 1:
raise ValueError('Expected a time coordinate with a single '
'point. {!r} has {} points.'.format(time.name(),
time.points.size))

if not time.has_bounds():
raise ValueError('Expected a time coordinate with bounds.')

if forecast_reference_time.points.size != 1:
raise ValueError('Expected a forecast_reference_time coordinate '
'with a single point. {!r} has {} '
'points.'.format(forecast_reference_time.name(),
forecast_reference_time.points.size))

origin = time.units.origin.replace(time.units.origin.split()[0], 'hours')
units = cf_units.Unit(origin, calendar=time.units.calendar)

# Determine start and eof of period in hours since a common epoch.
end = time.units.convert(time.bounds[0, 1], units)
start = forecast_reference_time.units.convert(
forecast_reference_time.points[0], units)
forecast_period = end - start

return forecast_period


class Rule(object):
"""
A collection of condition expressions and their associated action expressions.
Expand Down