diff --git a/src/pyaro_readers/eeareader/EEATimeseriesReader.py b/src/pyaro_readers/eeareader/EEATimeseriesReader.py index edcb593..5e7de53 100644 --- a/src/pyaro_readers/eeareader/EEATimeseriesReader.py +++ b/src/pyaro_readers/eeareader/EEATimeseriesReader.py @@ -174,6 +174,9 @@ def _read_polars(self, filters, filename) -> None: continue file_unit = self._convert_unit(df.row(0)[df.get_column_index("Unit")]) + if s in self.datafile["changeunit"]: + file_unit = self.datafile["changeunit"][s]["unit"] + df.with_columns((polars.col(PARQUET_FIELDS["values"]) * self.datafile["changeunit"][s]["factor"]).alias(PARQUET_FIELDS["values"])) for key in PARQUET_FIELDS: array[key][ diff --git a/src/pyaro_readers/eeareader/data.toml b/src/pyaro_readers/eeareader/data.toml index d4aed9e..89164f2 100644 --- a/src/pyaro_readers/eeareader/data.toml +++ b/src/pyaro_readers/eeareader/data.toml @@ -62,6 +62,8 @@ "ugso2.m-3" = "µg SO2/m3" "nm" = "nm" +[changeunit] +"SO4--" = { unit = "µg /m3", factor = 2995.82 } [pollutant] 1 = "SO2" diff --git a/src/pyaro_readers/eeareader/utils/generate_data_toml.py b/src/pyaro_readers/eeareader/utils/generate_data_toml.py index 2f67098..3e72c3b 100644 --- a/src/pyaro_readers/eeareader/utils/generate_data_toml.py +++ b/src/pyaro_readers/eeareader/utils/generate_data_toml.py @@ -31,6 +31,10 @@ "HNO3", ] +changeunit = { + "SO4--" : '{ unit = "µg /m3", factor = 2995.82 }' +} + with open("response.json", "r") as f: properties = {} data = json.load(f) @@ -56,6 +60,11 @@ target.write(f'"{poll}",\n') target.write("]\n\n") + target.write('[changeunits]\n') + for s in changeunit: + target.write(f'"{s}" = {changeunit[s]}\n') + target.write("]\n\n") + target.write("[units]\n") for key in response: target.write(f'"{key.lower()}" = {response[key]}\n')