From 5d53eb99ae4b8fa699361aed0ef0aa32e9655eaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Louis=20Poulain--Auz=C3=A9au?= <47986600+louisPoulain@users.noreply.github.com> Date: Fri, 18 Oct 2024 16:27:12 +0200 Subject: [PATCH] Add some initial thoughts and rename value_filler.py to imputer.py --- mlpp_lib/{value_filler.py => imputer.py} | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) rename mlpp_lib/{value_filler.py => imputer.py} (60%) diff --git a/mlpp_lib/value_filler.py b/mlpp_lib/imputer.py similarity index 60% rename from mlpp_lib/value_filler.py rename to mlpp_lib/imputer.py index 48983f5..9cd2270 100644 --- a/mlpp_lib/value_filler.py +++ b/mlpp_lib/imputer.py @@ -7,10 +7,16 @@ from typing_extensions import Self -class ValueFiller: +class Imputer: """ Abstract class for filling missing values in a dataset. """ + #TODO: + # - create subclasses to handle different types of imputing: + # - constant + # - location-based (stations) / elevation + # - based on lead time ? E.g., replace by the mean of the distribution for observed values at such lead time + # - based on valid time -> may be more appropriate than lead time @abstractmethod def fill(self, data: xr.Dataset) -> xr.Dataset: @@ -29,4 +35,4 @@ class ConstantFiller(ValueFiller): fillvalue: dict[str, float] = field(init=True, default=-5) def fill(self, data: xr.Dataset) -> xr.Dataset: - return data.fillna(self.fillvalue) \ No newline at end of file + return data.fillna(self.fillvalue)