-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
upgrade 1D #390
upgrade 1D #390
Changes from 42 commits
d95ba9a
cc2ab37
9d03000
d6220d1
b10e584
6979b97
ab9cdac
2d8d0b3
ec73ce8
9b52b34
ca04337
632a44f
c4a369d
661b03f
f757e1e
613f139
165cc98
f6b489f
de6dba4
09849e1
e98a008
f35990f
1de6b80
7a32e3a
b83b717
38fb132
4573d6d
9b1bd47
14f3478
54894d1
fb586fb
5aabff9
bf627d4
57c05ee
9a8503b
114cb67
ef19b3b
981e2ea
14b1e9f
b9ce3c9
ba1bc99
bcba3a1
4e3dbf0
950cbaf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,14 +24,12 @@ class ConnectionNode: | |
the_geom: shapely.Geometry | ||
code: str | ||
storage_area: float | ||
manhole_id: int | ||
is_manhole: bool | ||
margrietpalm marked this conversation as resolved.
Show resolved
Hide resolved
|
||
calculation_type: CalculationType | ||
manhole_indicator: int | ||
bottom_level: float | ||
drain_level: float | ||
surface_level: float | ||
shape: str # enum with classes "00", "01", "02" | ||
width: float | ||
initial_waterlevel: float | ||
display_name: str | ||
zoom_category: int | ||
|
@@ -59,7 +57,7 @@ def get_nodes(self, node_id_counter): | |
- node_type: NODE_1D_STORAGE or NODE_1D_NO_STORAGE depending on storage_area | ||
- calculation_type: from calculation_type (which comes from manhole) | ||
- dmax: from bottom_level (which comes from manhole) | ||
- manhole_id: id of associated manhole. | ||
- is_manhole: node is a manhole | ||
- drain_level: drain_level of associated manhole. | ||
- storage_area: area of connection_node. | ||
""" | ||
|
@@ -77,7 +75,7 @@ def get_nodes(self, node_id_counter): | |
node_type=node_type, | ||
calculation_type=self.calculation_type, | ||
dmax=self.bottom_level, | ||
manhole_id=self.manhole_id, | ||
is_manhole=~np.isnan(self.bottom_level), | ||
drain_level=self.drain_level, | ||
storage_area=self.storage_area, | ||
display_name=self.display_name, | ||
|
@@ -93,6 +91,14 @@ def is_closed(self, content_pk): | |
""" | ||
return self.storage_area[self.id_to_index(content_pk)] >= 0 | ||
|
||
def is_channel(self, content_pk, channels): | ||
"""Whether object is connected to a channel""" | ||
has_channel = np.logical_or( | ||
np.isin(self.id, channels.connection_node_start_id), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ik heb nog wel vraagteken bij deze check. Wat nu als de connection_node_start_id ook aan een pipe zit? Dan is dat nu altijd een channel, ondanks dat het misschien een manhole is en is_closed logischer is. Ik overzie het niet helemaal, maar potentieel is dit te strict. als kcu bekend is hier voor aanliggende 1d2d verbinding zou ik die checken, ook omdat de dpumax uiteindelijk gezet wordt voor de 1d2d line. LineType enum definieert de kcu types There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Dit lijkt me niet de plek om zoiets aan te passen; dit doet namelijk niet meer dan checken of iets een channel is. Als dat de lading niet dekt moet hooguit de naam worden aangepast.
Lijkt me iets wat aangepast moet worden in het kiezen tussen
|
||
np.isin(self.id, channels.connection_node_end_id), | ||
) | ||
return has_channel[content_pk] | ||
|
||
def get_1d2d_exchange_levels(self, content_pk, channels, locations, **kwargs): | ||
"""Compute the exchange level (dpumax) for 1D-2D flowlines. | ||
|
||
|
@@ -109,17 +115,16 @@ def get_1d2d_exchange_levels(self, content_pk, channels, locations, **kwargs): | |
""" | ||
# get the corresponding connection_node ids and indexes | ||
connection_node_idx = self.id_to_index(content_pk) | ||
is_manhole = self.manhole_id[connection_node_idx] != -9999 | ||
is_manhole = ~np.isnan(self.bottom_level[connection_node_idx]) | ||
is_manhole_idx = connection_node_idx[is_manhole] | ||
|
||
# Check if manhole has drain_level below bottom_level | ||
has_lower_drn_lvl = ( | ||
self.drain_level[is_manhole_idx] < self.bottom_level[is_manhole_idx] | ||
) | ||
if np.any(has_lower_drn_lvl): | ||
ids = self.manhole_id[is_manhole_idx[has_lower_drn_lvl]] | ||
ids = self.id[is_manhole_idx[has_lower_drn_lvl]] | ||
logger.warning( | ||
f"Manholes {sorted(ids.tolist())} have a " | ||
f"ConnectionNode {sorted(ids.tolist())} have a " | ||
f"bottom_level that is above drain_level." | ||
) | ||
|
||
|
@@ -143,7 +148,6 @@ def get_1d2d_exchange_levels(self, content_pk, channels, locations, **kwargs): | |
_put_if_less(dpumax, cn_idx_with_channel, drain_level) | ||
# filter out connection nodes that were not in node_idx (non-connected ones) | ||
dpumax = dpumax[connection_node_idx] | ||
|
||
# for manholes: put in the drain level | ||
dpumax[is_manhole] = self.drain_level[is_manhole_idx] | ||
return dpumax | ||
|
@@ -270,12 +274,13 @@ def set_bottom_levels(nodes: Nodes, lines: Lines): | |
dmax = np.fmin(nodes.dmax[node_idx], dmax_per_node) | ||
|
||
# Check if the new node dmax is below the original manhole dmax | ||
is_manhole = nodes.manhole_id[node_idx] != -9999 | ||
is_manhole = nodes.is_manhole[node_idx] | ||
|
||
has_lower_dmax = dmax[is_manhole] < nodes.dmax[node_idx[is_manhole]] | ||
if np.any(has_lower_dmax): | ||
ids = nodes.manhole_id[node_idx[is_manhole][has_lower_dmax]] | ||
ids = nodes.id[node_idx[is_manhole][has_lower_dmax]] | ||
logger.warning( | ||
f"Manholes {sorted(ids.tolist())} have a " | ||
f"Nodes {sorted(ids.tolist())} have a " | ||
f"bottom_level that is above one ore more of the following connected " | ||
f"objects: channel reference level, pipe/culvert invert level, " | ||
f"weir/orifice crest level." | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reading of cross section locations, pipes, weirs, culverts and orifices is moved up so the extracted cross section definitions can be properly mapped.