Skip to content

Commit

Permalink
quick update
Browse files Browse the repository at this point in the history
  • Loading branch information
st-te committed Mar 19, 2024
1 parent a23390e commit acbe461
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 6 deletions.
4 changes: 0 additions & 4 deletions catchment/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ def read_variable_from_csv(filename):
Columns will be the individual sites
"""
dataset = pd.read_csv(filename, usecols=['Date', 'Site', 'Rainfall (mm)'])

dataset = dataset.rename({'Date':'OldDate'}, axis='columns')
dataset['Date'] = [pd.to_datetime(x,dayfirst=True) for x in dataset['OldDate']]
dataset = dataset.drop('OldDate', axis='columns')
Expand All @@ -44,15 +43,12 @@ def daily_mean(data):
Index must be np.datetime64 compatible format."""
return data.groupby(data.index.date).mean()


def daily_max(data):
"""Calculate the daily max of a 2D data array.
Index must be np.datetime64 compatible format."""
return data.groupby(data.index.date).max()


def daily_min(data):
"""Calculate the daily min of a 2D data array.
Index must be np.datetime64 compatible format."""
return data.groupby(data.index.date).min()

2 changes: 0 additions & 2 deletions catchment/views.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
"""Module containing code for plotting inflammation data."""

from matplotlib import pyplot as plt
import numpy as np


def visualize(data_dict):
"""Display plots of basic statistical properties of the given data.
Expand Down
2 changes: 2 additions & 0 deletions tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ def test_daily_max(test_input, expected_output):
from catchment.models import daily_max
pdt.assert_frame_equal(daily_max(test_input), expected_output)



#def test_daily_mean_zeros():
"""Test that mean function works for an array of zeros."""
from catchment.models import daily_mean
Expand Down

0 comments on commit acbe461

Please sign in to comment.