Skip to content

Commit 3344b6a

Browse files
authored
Merge pull request #24 from MAIF/feature/warn_when_cfgrib_not_installed
ImportError with clear help when cfgrib not installed
2 parents 9536cca + a3f3b88 commit 3344b6a

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/meteole/forecast.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import tempfile
77
from abc import ABC, abstractmethod
88
from functools import reduce
9+
from importlib.util import find_spec
910
from typing import Any
1011

1112
import pandas as pd
@@ -15,6 +16,12 @@
1516
from meteole.clients import BaseClient
1617
from meteole.errors import MissingDataError
1718

19+
if find_spec("cfgrib") is None:
20+
raise ImportError(
21+
"The 'cfgrib' module is required to read Arome and Arpege GRIB files. Please install it using:\n\n"
22+
" conda install -c conda-forge cfgrib\n\n"
23+
)
24+
1825
logger = logging.getLogger(__name__)
1926

2027

0 commit comments

Comments
 (0)