From 4ff5bcc4ba83dbc977c737a3a7efdaf10222b101 Mon Sep 17 00:00:00 2001 From: Peter Dudfield <34686298+peterdudfield@users.noreply.github.com> Date: Mon, 3 Jun 2024 13:00:00 +0100 Subject: [PATCH] Issue/optional geopandas (#141) * optional geopandas * lint * dont raise error * more wrapper around imports * lint --- pvsite_datamodel/write/data/dno.py | 3 +-- pvsite_datamodel/write/data/gsp.py | 2 +- pvsite_datamodel/write/data/utils.py | 5 ++++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/pvsite_datamodel/write/data/dno.py b/pvsite_datamodel/write/data/dno.py index 03d3fa3..97c0a47 100644 --- a/pvsite_datamodel/write/data/dno.py +++ b/pvsite_datamodel/write/data/dno.py @@ -13,12 +13,11 @@ import logging import os -from shapely.geometry import Point - from pvsite_datamodel.write.data.utils import lat_lon_to_osgb try: import geopandas as gpd + from shapely.geometry import Point except ImportError: print("You might want to install geopandas") # noqa diff --git a/pvsite_datamodel/write/data/gsp.py b/pvsite_datamodel/write/data/gsp.py index 15005e3..58967e9 100644 --- a/pvsite_datamodel/write/data/gsp.py +++ b/pvsite_datamodel/write/data/gsp.py @@ -4,12 +4,12 @@ import os import pandas as pd -from shapely.geometry import Point from pvsite_datamodel.write.data.utils import lat_lon_to_osgb try: import geopandas as gpd + from shapely.geometry import Point except ImportError: print("You might want to install geopandas") # noqa diff --git a/pvsite_datamodel/write/data/utils.py b/pvsite_datamodel/write/data/utils.py index 0c240ee..5a8987b 100644 --- a/pvsite_datamodel/write/data/utils.py +++ b/pvsite_datamodel/write/data/utils.py @@ -1,6 +1,9 @@ """ Utils for GSP and DNO. """ -import pyproj +try: + import pyproj +except ImportError: + print("You might want to install pyproj") # noqa # OSGB is also called "OSGB 1936 / British National Grid -- United # Kingdom Ordnance Survey". OSGB is used in many UK electricity