Skip to content

Commit

Permalink
*Actually* set crs
Browse files Browse the repository at this point in the history
  • Loading branch information
Hofer-Julian committed Apr 4, 2024
1 parent b6669a3 commit 6a72aaf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
7 changes: 4 additions & 3 deletions python/ribasim/ribasim/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,12 +182,13 @@ def _save(self, directory: DirectoryPath, input_dir: DirectoryPath):
sub._save(directory, input_dir)

def set_crs(self, crs: str) -> None:
self.edge.df.set_crs(crs)
self.edge.df = self.edge.df.set_crs(crs)
for sub in self._nodes():
if sub.node.df is not None:
sub.node.df = sub.node.df.set_crs(crs)
for table in sub._tables():
if isinstance(table, SpatialTableModel) and table.df is not None:
# TODO: that is missing node tables now
table.df.set_crs(crs)
table.df = table.df.set_crs(crs)

def node_table(self) -> NodeTable:
"""Compute the full NodeTable from all node types."""
Expand Down
1 change: 1 addition & 0 deletions python/ribasim/tests/test_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ def test_node_ids_unsequential(basic):

def test_tabulated_rating_curve_model(tabulated_rating_curve, tmp_path):
model_orig = tabulated_rating_curve
model_orig.set_crs(model_orig.crs)
basin_area = tabulated_rating_curve.basin.area.df
assert basin_area is not None
assert basin_area.geometry.geom_type.iloc[0] == "Polygon"
Expand Down

0 comments on commit 6a72aaf

Please sign in to comment.