BUG: competitors not appearing in latex reports

Bug

Error description

There is always only a single station in all error tables for all competitors.

Error message

silent error

First guess on error origin

  • Maybe there are no competitors
  • Loading of competitors does not work properly
  • anything else wrong in the code

Error origin

In postprocessing, the remove items command prevents the program to enter the loop (which becomes of zero length) once a model type was added for the frist station. Afterwards, length is always zero and no result is appended to errors.

class PostProcessing(RunEnvironment):
    ....
    def calculate_error_metrics(self) -> Tuple[Dict, Dict, Dict, Dict]:
    ....
        for station in all_stations:
            ....
            # test errors of competitors
            for model_type in remove_items(model_list or [], list(errors.keys())):
                if self.observation_indicator not in combined.coords[self.model_type_dim]:
                    continue
                if model_type not in errors.keys():
                    errors[model_type] = {}
                errors[model_type][station] = statistics.calculate_error_metrics(
                    *map(lambda x: combined.sel(**{self.model_type_dim: x}),
                         [model_type, self.observation_indicator]), dim=self.index_dim)

Solution

class PostProcessing(RunEnvironment):
    ....
    def calculate_error_metrics(self) -> Tuple[Dict, Dict, Dict, Dict]:
    ....
        for station in all_stations:
            ....
            # test errors of competitors
-           for model_type in remove_items(model_list or [], list(errors.keys())):
+           for model_type in (model_list or []):
                if self.observation_indicator not in combined.coords[self.model_type_dim]:
                    continue
                if model_type not in errors.keys():
                    errors[model_type] = {}
                errors[model_type][station] = statistics.calculate_error_metrics(
                    *map(lambda x: combined.sel(**{self.model_type_dim: x}),
                         [model_type, self.observation_indicator]), dim=self.index_dim)