Skip to content

attributes are not read as valid outputControl.txt value when using pysumma.Simulation() #167

@bartvanosnabrugge

Description

@bartvanosnabrugge

The following outputControl file throws errors (outputControl.txt).

The problem seems to be in the lines:

hruId
latitude
longitude

When these variables (lines) are omitted, the Simulation object loads without errors.

`---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
/tmp/ipykernel_27996/1849484293.py in
1 # Create a model instance
----> 2 s = ps.Simulation(executable, file_manager)

~/venvs/hydromt-env/lib/python3.8/site-packages/pysumma/simulation.py in init(self, executable, filemanager, initialize, config_dir)
63 self.status = 'Uninitialized'
64 if initialize:
---> 65 self.initialize()
66
67 def initialize(self):

~/venvs/hydromt-env/lib/python3.8/site-packages/pysumma/simulation.py in initialize(self)
77 self.status = 'Initialized'
78 self.decisions = self.manager.decisions
---> 79 self.output_control = self.manager.output_control
80 self.trial_params = self.manager.trial_params
81 self.force_file_list = self.manager.force_file_list

~/venvs/hydromt-env/lib/python3.8/site-packages/pysumma/file_manager.py in output_control(self)
66 p1 = self.get_value('settingsPath')
67 p2 = self.get_value('outputControlFile')
---> 68 self._output_control = OutputControl(p1, p2)
69 return self._output_control
70

~/venvs/hydromt-env/lib/python3.8/site-packages/pysumma/output_control.py in init(self, dirpath, filepath)
86
87 def init(self, dirpath, filepath=None):
---> 88 super().init(OutputControlOption, dirpath, filepath)
89
90 def set_option(self, name=None, period=None, sum=0, instant=1,

~/venvs/hydromt-env/lib/python3.8/site-packages/pysumma/option.py in init(self, optiontype, dir, name)
122 self.header = []
123 self.options = []
--> 124 self.read(os.path.abspath(self.original_path / self.file_name))
125
126 def set_option(self):

~/venvs/hydromt-env/lib/python3.8/site-packages/pysumma/option.py in read(self, path)
151 self.header.append(line)
152 elif not line.startswith('!') and isnt_empty:
--> 153 self.options.append(self.OptionType(
154 *self.get_constructor_args(line)))
155 self.opt_count += 1

~/venvs/hydromt-env/lib/python3.8/site-packages/pysumma/output_control.py in init(self, var, period, sum, instant, mean, variance, min, max, mode)
31 self.period = period
32 else:
---> 33 self.period = int(period)
34 self.sum = int(sum)
35 self.instant = int(instant)

TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'`

outputControl.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions