Skip to content
This repository has been archived by the owner on Aug 28, 2023. It is now read-only.

Remove raw daily indicators #199

Merged
merged 1 commit into from
Dec 30, 2016
Merged
Show file tree
Hide file tree
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
34 changes: 2 additions & 32 deletions django/climate_change_api/indicators/indicators.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@
from .abstract_indicators import (Indicator, CountIndicator, BasetempIndicatorMixin,
YearlyMaxConsecutiveDaysIndicator, YearlySequenceIndicator)
from .params import DegreeDayIndicatorParams, Percentile1IndicatorParams, Percentile99IndicatorParams
from .unit_converters import (TemperatureUnitsMixin, PrecipUnitsMixin, PrecipRateUnitsMixin,
DaysUnitsMixin, CountUnitsMixin, TemperatureDeltaUnitsMixin,
SECONDS_PER_DAY)
from .unit_converters import (TemperatureUnitsMixin, PrecipUnitsMixin, DaysUnitsMixin,
CountUnitsMixin, TemperatureDeltaUnitsMixin, SECONDS_PER_DAY)


##########################
Expand All @@ -19,7 +18,6 @@ class AverageHighTemperature(TemperatureUnitsMixin, Indicator):
label = 'Average High Temperature'
description = ('Aggregated average high temperature, generated from daily data ' +
'using all requested models')
valid_aggregations = ('yearly', 'monthly',)
variables = ('tasmax',)
agg_function = Avg

Expand All @@ -28,7 +26,6 @@ class AverageLowTemperature(TemperatureUnitsMixin, Indicator):
label = 'Average Low Temperature'
description = ('Aggregated average low temperature, generated from daily data ' +
'using all requested models')
valid_aggregations = ('yearly', 'monthly',)
variables = ('tasmin',)
agg_function = Avg

Expand All @@ -37,7 +34,6 @@ class MaxHighTemperature(TemperatureUnitsMixin, Indicator):
label = 'Maximum High Temperature'
description = ('Maximum high temperature, generated from daily data ' +
'using all requested models')
valid_aggregations = ('yearly', 'monthly',)
variables = ('tasmax',)
agg_function = Max

Expand All @@ -46,15 +42,13 @@ class MinLowTemperature(TemperatureUnitsMixin, Indicator):
label = 'Minimum Low Temperature'
description = ('Minimum low temperature, generated from daily data ' +
'using all requested models')
valid_aggregations = ('yearly', 'monthly',)
variables = ('tasmin',)
agg_function = Min


class TotalPrecipitation(PrecipUnitsMixin, Indicator):
label = 'Total Precipitation'
description = 'Total precipitation'
valid_aggregations = ('yearly', 'monthly',)
variables = ('pr',)
# Precipitation is stored per-second, and we want a total for all days in the aggregation,
# so we need to multiple each day's value by 86400 to get the total for that day and then
Expand Down Expand Up @@ -188,30 +182,6 @@ def aggregate(self):
return super(HeatWaveDurationIndex, self).aggregate()


##########################
# Raw value indicators

class LowTemperature(TemperatureUnitsMixin, Indicator):
label = 'Low Temperature'
description = ('Daily low temperature')
valid_aggregations = ('daily',)
variables = ('tasmin',)


class HighTemperature(TemperatureUnitsMixin, Indicator):
label = 'High Temperature'
description = ('Daily high temperature')
valid_aggregations = ('daily',)
variables = ('tasmax',)


class Precipitation(PrecipRateUnitsMixin, Indicator):
label = 'Precipitation'
description = ('Daily precipitation')
valid_aggregations = ('daily',)
variables = ('pr',)


def list_available_indicators():
""" List the defined class members of this module as the available indicators """
class_members = inspect.getmembers(sys.modules[__name__], inspect.isclass)
Expand Down
4 changes: 2 additions & 2 deletions django/climate_change_api/indicators/tests/test_indicators.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ def test_unit_conversion(self):


class DailyHighTemperatureTestCase(TemperatureIndicatorTests, TestCase):
indicator_class = indicators.HighTemperature
indicator_name = 'high_temperature'
indicator_class = indicators.AverageHighTemperature
indicator_name = 'average_high_temperature'
time_aggregation = 'daily'
units = 'K'
test_indicator_rcp85_equals = {'2000-01-01': {'avg': 35.0, 'max': 40.0, 'min': 30.0}}
Expand Down