Skip to content

Commit

Permalink
Merge branch 'main' into np.int32
Browse files Browse the repository at this point in the history
  • Loading branch information
visr authored Mar 26, 2024
2 parents 2058967 + 4b32b7d commit 3ce0fdc
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions python/ribasim/ribasim/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from pathlib import Path
from typing import Any

import geopandas as gpd
import numpy as np
import pandas as pd
import tomli
Expand Down Expand Up @@ -139,6 +140,16 @@ def _save(self, directory: DirectoryPath, input_dir: DirectoryPath):
for sub in self._nodes():
sub._save(directory, input_dir)

# Temporarily require unique node_id for #1262
# and copy them to the fid for #1306.
df = gpd.read_file(db_path, layer="Node")
if not df["node_id"].is_unique:
raise ValueError("node_id must be unique")
df.set_index("node_id", drop=False, inplace=True)
df.sort_index(inplace=True)
df.index.name = "fid"
df.to_file(db_path, layer="Node", driver="GPKG", index=True)

def node_table(self) -> NodeTable:
"""Compute the full NodeTable from all node types."""
df_chunks = [node.node.df for node in self._nodes()]
Expand Down

0 comments on commit 3ce0fdc

Please sign in to comment.