Skip to content

Commit

Permalink
comments and rpc remove
Browse files Browse the repository at this point in the history
  • Loading branch information
daanvaningen committed Oct 13, 2023
1 parent c65540b commit 5aff299
Showing 1 changed file with 22 additions and 12 deletions.
34 changes: 22 additions & 12 deletions threedigrid/admin/gridresultadmin.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,25 @@ def time_units(self):


class GridH5StructureControl(GridH5Admin):
"""Interface for structure control netcdf"""
"""Interface for structure control netcdf
This interface is different from the GridH5ResultAdmin and
GridH5AggregateResultAdmin, as it resembles less the Nodes and Lines data compared
to those interfaces. This interface should be viewed as a CSV file interface
which can be used to extract the different control structures by control type and
output data. It supplies interfaces to Nodes, Lines, Weirs, etc but does not
provide the same timeseries filter capabilities as the GridH5ResultAdmin and
GridH5AggregateResultAdmin.
>>> gst = GridH5StructureControl(gridadmin_path, struct_control_actions_3di.nc)
>>> gst.table_control
>>> gst.timed_control
>>> gst.memory_control
>>> gst.table_control.id
>>> struct_control = gst.table_control.group_by_id(ga.table_control.id[0])
>>> struct_control.time
>>> struct_control.action_value_1
"""

def __init__(
self,
Expand All @@ -295,18 +313,10 @@ def __init__(
self._netcdf_file_path: str = netcdf_file_path
super().__init__(h5_file_path, file_modus)

if h5_file_path.startswith("rpc://"):
if not asyncio_rpc_support:
raise Exception("Please reinstall this package with threedigrid[rpc]")

from threedigrid.admin.rpc_datasource import RPCFile

self.netcdf_file = RPCFile(h5_file_path, file_modus)
if swmr:
self.netcdf_file = H5SwmrFile(netcdf_file_path, file_modus)
else:
if swmr:
self.netcdf_file = H5SwmrFile(netcdf_file_path, file_modus)
else:
self.netcdf_file = h5py.File(netcdf_file_path, file_modus)
self.netcdf_file = h5py.File(netcdf_file_path, file_modus)

@property
def table_control(self) -> "_GridH5NestedStructureControl":
Expand Down

0 comments on commit 5aff299

Please sign in to comment.