Skip to content
Snippets Groups Projects
Commit 54d6e591 authored by Simon Grasse's avatar Simon Grasse
Browse files

fix: handle date inconsistencies at begin/end due to local time

parent 810952ac
No related branches found
No related tags found
1 merge request!11Creation of first beta release version
from datetime import datetime
from datetime import datetime, timedelta
from enum import Enum
from dataclasses import dataclass
......@@ -33,7 +33,8 @@ class TimeSample:
@property
def daterange_option(self):
return f"{self.start.isoformat()},{self.end.isoformat()}"
end_with_padding = self.end + timedelta(1)
return f"{self.start.isoformat()},{end_with_padding.isoformat()}"
@property
def frequency(self):
......
......@@ -154,16 +154,16 @@ class AnalysisService:
return coords[valid_coords]
def get_clean_timeseries(self, timeseries, metadata: Metadata):
# TODO maybe use cf-index here already ?
first, last = timeseries.columns[0], timeseries.columns[-1]
# remove data where utc -> sun/local ? time conversion leads to dateshift
timeseries.drop(columns=[first, last], inplace=True)
timeseries.columns = metadata.time.as_datetime_index()
all_na = timeseries.isna().all(axis=1)
timeseries = timeseries[~all_na]
timeseries = timeseries.fillna(0)
response_timesteps = timeseries.columns
expected_timesteps = metadata.time.as_datetime_index()
if not (response_timesteps == expected_timesteps).all():
raise ValueError("foo")
# TODO maybe use cf-index here already ?
timeseries.columns = metadata.time.as_datetime_index()
return timeseries
def load_data(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment