diff --git a/mlair/plotting/postprocessing_plotting.py b/mlair/plotting/postprocessing_plotting.py index 5383914d6229e2c7017dada2bdcb9c315e327cf7..35ab70327d88b161ce23228f2c42ea5d906a3a30 100644 --- a/mlair/plotting/postprocessing_plotting.py +++ b/mlair/plotting/postprocessing_plotting.py @@ -1252,6 +1252,7 @@ class PlotAvailabilityHistogram(AbstractPlotClass): station_data_x = station.get_X(as_numpy=False)[0] station_data_x = station_data_x.loc[{self.history_dim: 0, # select recent window frame self.target_dim: station_data_x[self.target_dim].values[0]}] + station_data_x = self._reduce_dims(station_data_x) avail_list.append(station_data_x.notnull()) avail_data = xr.concat(avail_list, dim=self.station_dim).notnull() avail_data_time_sum[subset] = avail_data.sum(dim=self.station_dim) @@ -1268,6 +1269,14 @@ class PlotAvailabilityHistogram(AbstractPlotClass): self.avail_data_amount = avail_data_amount.reindex({self.temporal_dim: full_time_index}) self.dataset_time_interval = dataset_time_interval + def _reduce_dims(self, dataset): + if len(dataset.dims) > 2: + required = {self.temporal_dim, self.station_dim} + unimportant = set(dataset.dims).difference(required) + sel_dict = {un: dataset[un].values[0] for un in unimportant} + dataset = dataset.loc[sel_dict] + return dataset + @staticmethod def _get_first_and_last_indexelement_from_xarray(xarray, dim_name, return_type='as_tuple'): if isinstance(xarray, xr.DataArray): diff --git a/mlair/run_modules/pre_processing.py b/mlair/run_modules/pre_processing.py index 7f546865f3ab3ebae8b48f375300035f5be766a4..8be5870a3d1945c18e0f27278dc30af0c7c61139 100644 --- a/mlair/run_modules/pre_processing.py +++ b/mlair/run_modules/pre_processing.py @@ -121,6 +121,7 @@ class PreProcessing(RunEnvironment): self.save_to_tex(path=path, filename="station_sample_size.tex", column_format=column_format, df=df) self.save_to_md(path=path, filename="station_sample_size.md", df=df) df_nometa = df.drop(meta_data, axis=1) + column_format = self.create_column_format_for_tex(df) self.save_to_tex(path=path, filename="station_sample_size_short.tex", column_format=column_format, df=df_nometa) self.save_to_md(path=path, filename="station_sample_size_short.md", df=df_nometa) # df_nometa.to_latex(os.path.join(path, "station_sample_size_short.tex"), na_rep='---',