Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/icefabric/hydrofabric/subset_nhf.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
import polars as pl
import pyogrio
import rustworkx as rx
from botocore.exceptions import ClientError
from pyiceberg.catalog import Catalog
from pyiceberg.exceptions import NoSuchTableError

from icefabric.cli.streamflow import NoResultsFoundError
from icefabric.schemas.hydrofabric import HydrofabricNamespace
Expand Down Expand Up @@ -106,9 +108,13 @@ def _get_lazy_frame(self, layer: str) -> pl.LazyFrame | None:
"""Get a LazyFrame for a given layer, or None if the layer doesn't exist."""
if self.catalog is not None:
table_id = f"{self.namespace.value}.{layer}"
if not self.catalog.table_exists(table_id):
try:
if not self.catalog.table_exists(table_id):
return None
return self.catalog.load_table(table_id).to_polars()
except (NoSuchTableError, ClientError):
logger.warning(f"Could not access table {table_id}, treating as missing")
return None
return self.catalog.load_table(table_id).to_polars()
else:
path = self.parquet_dir / f"{layer}.parquet"
if not path.exists():
Expand Down
Loading