From 6bb2ddd95589133837e6c5760810bd45d9d4c94e Mon Sep 17 00:00:00 2001 From: peterdudfield Date: Tue, 13 Sep 2022 13:25:45 +0100 Subject: [PATCH 1/2] change urllib to requests --- ocf_datapipes/utils/eso.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ocf_datapipes/utils/eso.py b/ocf_datapipes/utils/eso.py index 32241105e..3c00a47bd 100644 --- a/ocf_datapipes/utils/eso.py +++ b/ocf_datapipes/utils/eso.py @@ -16,7 +16,7 @@ import logging import os from typing import Union -from urllib.request import urlopen +import requests import geopandas as gpd import pandas as pd @@ -126,8 +126,8 @@ def get_gsp_shape_from_eso( "resource/08534dae-5408-4e31-8639-b579c8f1c50b/download/gsp_regions_20220314.geojson" ) - with urlopen(url) as response: - shape_gpd = gpd.read_file(response) + with requests.get(url) as response: + shape_gpd = gpd.read_file(response.text) # calculate the centroid before using - to_crs shape_gpd["centroid_x"] = shape_gpd["geometry"].centroid.x From 0d99621f0ba546ddeab6488abbb11e544232adb4 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 13 Sep 2022 12:27:51 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- ocf_datapipes/utils/eso.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ocf_datapipes/utils/eso.py b/ocf_datapipes/utils/eso.py index 3c00a47bd..626fd4fb7 100644 --- a/ocf_datapipes/utils/eso.py +++ b/ocf_datapipes/utils/eso.py @@ -16,10 +16,10 @@ import logging import os from typing import Union -import requests import geopandas as gpd import pandas as pd +import requests from ocf_datapipes.utils.geospatial import osgb_to_lat_lon from ocf_datapipes.utils.pvlive import get_list_of_gsp_ids