-
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
Conversation
* Disable any code that cannot yet work * Skip tests or asserts that are known to fail atm
Any node with bottom_level != -9999 is considered to be a manhole. For migrated schematisations, this are all nodes that were linked to a manhole.
884020f
to
d6220d1
Compare
…ne_id. Any node with bottom_level != nan is considered to be a manhole. For migrated schematisations, this are all nodes that were linked to a manhole.
Added attribute is_manhole to Node based on ConnectionNode.bottom_level != nan. I did consider using Node.dmax because this is initialized as ConnectionNode.bottom_level. But any modifications to that value may break this functionality.
…idth and height and add unit test for _parse_tabulated
…ble and use in make_gridadmin
…rid-builder into margriet_389_schema_300_1D
c214d46
to
dc0cbe1
Compare
This reverts commit 1de6b80.
if test_case == "open": | ||
obstacles.affects_1d2d_open_water = np.array([True, True, True]) | ||
obstacles.affects_1d2d_closed = np.array([False, False, False]) | ||
lines = Lines1D2D( | ||
id=range(3), | ||
kcu=[ | ||
LineType.LINE_1D2D_SINGLE_CONNECTED_OPEN_WATER, | ||
LineType.LINE_1D2D_SINGLE_CONNECTED_CLOSED, | ||
LineType.LINE_1D2D_SINGLE_CONNECTED_OPEN_WATER, | ||
], | ||
) | ||
lines.assign_dpumax_from_obstacles_open(obstacles) | ||
elif test_case == "closed": | ||
obstacles.affects_1d2d_closed = np.array([True, True, True]) | ||
obstacles.affects_1d2d_open_water = np.array([False, False, False]) | ||
lines = Lines1D2D( | ||
id=range(3), | ||
kcu=[ | ||
LineType.LINE_1D2D_SINGLE_CONNECTED_CLOSED, | ||
LineType.LINE_1D2D_SINGLE_CONNECTED_OPEN_WATER, | ||
LineType.LINE_1D2D_SINGLE_CONNECTED_CLOSED, | ||
], | ||
) | ||
lines.assign_dpumax_from_obstacles_closed(obstacles) |
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.
Any suggestions of doing this in a better way are welcome. I've considered putting this in a parameterize decorator, but that became complex very quickly.
…ial table when needed
9d9c5ea
to
114cb67
Compare
locations = db.get_cross_section_locations() | ||
pipes = db.get_pipes() | ||
weirs = db.get_weirs() | ||
culverts = db.get_culverts() | ||
orifices = db.get_orifices() | ||
cross_section_definitions = db.get_cross_section_definitions() | ||
( | ||
cross_section_definitions_unique, | ||
mapping, | ||
) = cross_section_definitions.get_unique() | ||
map_cross_section_definition( | ||
[locations, orifices, pipes, culverts, weirs], mapping | ||
) | ||
|
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.
4e00db7
to
11136ad
Compare
11136ad
to
ba1bc99
Compare
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 comment
The 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 comment
The 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.
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.
Lijkt me iets wat aangepast moet worden in het kiezen tussen is_closed
en is_channel
: https://github.com/nens/threedigrid-builder/blob/margriet_389_schema_300_1D/threedigrid_builder/grid/grid.py#L757-L765. Maar ik snap nog niet helemaal welke logica je hier zou willen zien. Is dat iets als:
if node_open_water_detection == 0 and isinstance(objects, ConnectionNodes):
if line.kcu != -9999:
is_closed = (line.kcu == LINE_1D2D_SINGLE_CONNECTED_CLOSED or line.kcu == INE_1D2D_DOUBLE_CONNECTED_CLOSED)
else:
is_closed = is_channel()
self.write_dataset(group, "manhole_id", nodes.manhole_id) | ||
# Set manhole_id to match nodes.id when there is a manhole | ||
self.write_dataset( | ||
group, "manhole_id", np.where(nodes.is_manhole, nodes.id + 1, -9999) |
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.
Als het originele manhole_id de database pk is, zou ik hier de connection_node pk schrijven. Anders prima
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.
De originele manhole_id zit niet meer in de schematisatie; dus die kan ook niet meer in de gridadmin terecht komen. Daarnaast lijkt het me vreemd om een id te gebruiken dat niet meer naar een bestaand object refereert.
c2ad621
to
4e3dbf0
Compare
Major changes:
set_friction_vegetation_values
.model_settings.node_open_water_detection
is processed that modified how open / closed is detected for ConnectionNodes; either based on having storage (node_open_water_detection=1, default in migration) or being connected to channels (node_open_water_detection=0)Obstacle
is extended with columns:affects_2d
,affects_1d2d_open_water
andaffects_1d2d_closed
. When these are True, dpumax for intersected flow lines is increased with the obstacle's crest level. On migrationaffects_2d
andaffects_1d2d_open_water
are set to True andaffects_1d2d_closed
to False which should cause no changes in behavior.Testing
I used https://github.com/nens/schema_300_integration_tests/tree/test_228 to test these changes. The gridadmin files produced are not identical, but should be equivalent. See https://github.com/nens/schema_300_integration_tests/blob/test_228/test_libs/compare_gridadmin.py for details on this comparisson.