Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update date parsing for river data collection #293

Merged
merged 1 commit into from
Sep 1, 2024
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
2 changes: 1 addition & 1 deletion nowcast/workers/collect_river_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def _calc_eccc_day_avg_discharge(river_name, data_date, config):
csv_file,
usecols=["Date", "Discharge / Débit (cms)"],
index_col="Date",
date_parser=lambda x: pandas.to_datetime(x.rpartition("-")[0]),
date_format="ISO8601",
)
day_avg_discharge = df.loc[f"{data_date.format('YYYY-MM-DD')}"].mean()[
"Discharge / Débit (cms)"
Expand Down
2 changes: 1 addition & 1 deletion tests/workers/test_collect_river_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ class TestCalcECCC_DayAvgDischarge:
"""Unit test for _calc_eccc_day_avg_discharge() function."""

def test_calc_eccc_day_avg_discharge(self, config, caplog, tmp_path, monkeypatch):
def mock_read_csv(csv_file, usecols, index_col, date_parser):
def mock_read_csv(csv_file, usecols, index_col, date_format):
return pandas.DataFrame(
numpy.linspace(41.9, 44.1, 290),
index=pandas.date_range(
Expand Down