diff --git a/src/post_processing/utils/core_utils.py b/src/post_processing/utils/core_utils.py index cf14302..f9b00cd 100644 --- a/src/post_processing/utils/core_utils.py +++ b/src/post_processing/utils/core_utils.py @@ -63,12 +63,10 @@ def get_season(ts: Timestamp, *, northern: bool = True) -> tuple[str, int]: """ if northern: - winter = [1, 2, 12] spring = [3, 4, 5] summer = [6, 7, 8] autumn = [9, 10, 11] else: - winter = [6, 7, 8] spring = [9, 10, 11] summer = [1, 2, 12] autumn = [3, 4, 5] @@ -79,11 +77,8 @@ def get_season(ts: Timestamp, *, northern: bool = True) -> tuple[str, int]: season = "summer" elif ts.month in autumn: season = "autumn" - elif ts.month in winter: - season = "winter" else: - msg = "Invalid timestamp" - raise ValueError(msg) + season = "winter" return season, ts.year - 1 if ts.month in [1, 2] else ts.year @@ -93,10 +88,7 @@ def get_sun_times( stop: Timestamp, lat: float, lon: float, -) -> ( - list[float], - list[float], -): +) -> tuple[list[float], list[float]]: """Fetch sunrise and sunset hours for dates between start and stop. Parameters @@ -171,7 +163,7 @@ def get_coordinates() -> tuple: f"'{lat}' is not a valid latitude. It must be between -90 and 90.\n" ) except ValueError: - errmsg += f"'{lat}' is not a valid entry for latitude.\n" + errmsg += f"'lat', invalid entry: '{lat}'.\n" try: lon_val = float(lon.strip()) # Convert to float for longitude @@ -349,7 +341,7 @@ def set_bar_height(ax: plt.Axes, pixel_height: int = 10) -> float: """ if not ax.has_data(): - msg = "Axe has no data" + msg = "Axe have no data" raise ValueError(msg) display_to_data = ax.transData.inverted().transform @@ -380,7 +372,7 @@ def add_recording_period( """ if not ax.has_data(): - msg = "Axe has no data" + msg = "Axe have no data" raise ValueError(msg) recorder_intervals = [ @@ -419,10 +411,6 @@ def get_count(df: DataFrame, bin_size: Timedelta | BaseOffset) -> DataFrame: "