NOAA-OWP / hydrotools

Suite of tools for retrieving USGS NWIS observations and evaluating National Water Model (NWM) data.
Other
53 stars 12 forks source link

nwm_client_new `get` methods fails with custom Parquet Store #231

Closed jarq6c closed 10 months ago

jarq6c commented 10 months ago

The following call to get fails with a StoreNotFoundError.

from hydrotools.nwm_client_new.NWMFileClient import NWMFileClient
from hydrotools.nwm_client_new.ParquetStore import ParquetStore

my_custom_store = ParquetStore(
    "my_custom_store.parquet",
    write_index=False,
    compression="snappy"
)

model_data_client = NWMFileClient(dataframe_store=my_custom_store)

forecast_data = model_data_client.get(
    configurations = ["short_range"],
    reference_times = ["20210101T01Z"],
    nwm_feature_ids = [724696]
    )

The issue is this line: https://github.com/NOAA-OWP/hydrotools/blob/b7baa7b0691374a1b99c06675631d82fd0f8cafc/python/nwm_client_new/src/hydrotools/nwm_client_new/NWMFileClient.py#L183

ParquetStore has no __bool__ dunder method, so it always evaluates to False. I'm not sure why this doesn't fail with the default dataframe_store argument.