open-plan-tool / gui

Energy Planning Application
Other
6 stars 4 forks source link

Warn the user if they upload a timeseries shorter than expected simulation timesteps #261

Open Bachibouzouk opened 4 months ago

Bachibouzouk commented 4 months ago

They are warned when they reopen the faulty asset but they could also be warned when clicking on next, or by asset saving

Bachibouzouk commented 4 months ago

Suggested fix in projects/forms.py::AssetCreateForm.clean_input_timeseries within the if timeseries_file is not None: section :

                if self.timestamps is not None:
                    if len(input_timeseries_values) < len(self.timestamps):
                        raise ValidationError(f"The uploaded timeseries ({len(input_timeseries_values)} values) does not cover the number of simulation timesteps ({len(self.timestamps)} timesteps) ")

As well as

        except ValidationError as ve:
            raise ve

before the except Exception as ex: statement