Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
visr committed Sep 25, 2024
1 parent 71d9fbc commit fdf25d9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
7 changes: 5 additions & 2 deletions python/ribasim/ribasim/input_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import geopandas as gpd
import numpy as np
import pandas as pd
import pyogrio
from pandera.typing import DataFrame
from pandera.typing.geopandas import GeoDataFrame
from pydantic import BaseModel as PydanticBaseModel
Expand Down Expand Up @@ -295,6 +294,8 @@ def _from_db(cls, path: Path, table: str) -> pd.DataFrame | None:
df = pd.read_sql_query(
query,
connection,
# we store TIMESTAMP in SQLite like "2025-05-29 14:16:00"
# see https://www.sqlite.org/lang_datefunc.html
parse_dates={"time": {"format": "ISO8601"}},
dtype_backend="pyarrow",
)
Expand Down Expand Up @@ -376,11 +377,13 @@ def _from_db(cls, path: Path, table: str):
with closing(connect(path)) as connection:
if exists(connection, table):
# pyogrio hardcodes fid name on reading
df = pyogrio.read_dataframe(
df = gpd.read_file(
path,
layer=table,
engine="pyogrio",
fid_as_index=True,
use_arrow=True,
# tell pyarrow to map to pd.ArrowDtype rather than NumPy
arrow_to_pandas_kwargs={"types_mapper": pd.ArrowDtype},
)
df.index.rename(cls.tableschema()._index_name(), inplace=True)
Expand Down
1 change: 0 additions & 1 deletion python/ribasim/ribasim/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ def _concat(dfs, **kwargs):
# the concat operation.
filterwarnings(
"ignore",
message="The behavior of array concatenation with empty entries is deprecated.",
category=FutureWarning,
)
return pd.concat(dfs, **kwargs)
Expand Down

0 comments on commit fdf25d9

Please sign in to comment.