Skip to content

Commit

Permalink
MNT: Move geopandas to its cli command to make it optional. [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
Taher Chegini committed Jan 18, 2025
1 parent fb72a47 commit 607f3d5
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/pygridmet/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from typing import TYPE_CHECKING, Literal, TypeVar

import click
import geopandas as gpd
import pandas as pd

from pygridmet import pygridmet as gridmet
Expand All @@ -18,6 +17,8 @@
)

if TYPE_CHECKING:
import geopandas as gpd

DFType = TypeVar("DFType", pd.DataFrame, gpd.GeoDataFrame)
VARS = Literal[
"pr",
Expand Down Expand Up @@ -190,6 +191,10 @@ def geometry(
Examples:
$ pygridmet geometry geo.gpkg -v prcp -v tmin
""" # noqa: D301
try:
import geopandas as gpd
except ImportError as e:
raise ImportError("This command requires geopandas") from e
fpath = Path(fpath)
if fpath.suffix not in (".shp", ".gpkg"):
raise InputTypeError("file", ".shp or .gpkg")
Expand Down

0 comments on commit 607f3d5

Please sign in to comment.