From 22dba3a614cc45a59fda6d0f9b562ac81836974d Mon Sep 17 00:00:00 2001 From: Panos Mavrogiorgos Date: Tue, 9 May 2023 11:08:10 +0300 Subject: [PATCH] Suggest installing cfgrib when GRIB is detected and GRIB support is not available. Fixes #16 --- inspectds/cli.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/inspectds/cli.py b/inspectds/cli.py index f4e1fa9..7ac1daa 100644 --- a/inspectds/cli.py +++ b/inspectds/cli.py @@ -93,7 +93,12 @@ def echo_dataset( # This is why we keep this function def infer_dataset_type(path: pathlib.Path) -> DATASET_TYPE: if path.suffix in (".grib", ".grib2"): - dataset_type = DATASET_TYPE.GRIB + if IS_GRIB_AVAILABLE: + dataset_type = DATASET_TYPE.GRIB + else: + msg = "GRIB file detected, but GRIB support is not available. Please install cfgrib." + typer.echo(msg) + raise typer.Exit(code=1) elif path.is_dir() or path.suffix == ".zarr" or path.suffix == ".zip": dataset_type = DATASET_TYPE.ZARR else: