Skip to content

Commit

Permalink
fixed test
Browse files Browse the repository at this point in the history
  • Loading branch information
benvanbasten-ns committed Nov 21, 2024
1 parent a74f9f3 commit 7a15ee4
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions datasource/threedi_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,8 @@ def get_timeseries(

if isinstance(ga, GridH5StructureControl):
# GridH5StructureControl has a different interface compared to the other GridAdmin structures
assert nc_variable
assert node_id
timestamps = []
values = []
for control_type in StructureControlTypes.__members__.values():
Expand All @@ -270,15 +272,15 @@ def get_timeseries(
filtered_result = ga.get_model_instance_by_field_name(nc_variable).timeseries(
indexes=slice(None)
)
filtered_result = filtered_result.filter(id=node_id)
if node_id:
filtered_result = filtered_result.filter(id=node_id)
values = self.get_timeseries_values(filtered_result, nc_variable)
if fill_value is not None:
values[values == NO_DATA_VALUE] = fill_value

timestamps = self.get_timestamps(nc_variable)
timestamps = timestamps.reshape(-1, 1) # reshape (n,) to (n, 1)

if fill_value is not None:
values[values == NO_DATA_VALUE] = fill_value

return np.hstack([timestamps, values])

def get_values_by_timestep_nr(self, variable, timestamp_idx, node_ids):
Expand Down

0 comments on commit 7a15ee4

Please sign in to comment.