diff --git a/requirements.txt b/requirements.txt index f9cb5ec..2ea7900 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,7 +5,6 @@ pydantic numpy requests nowcasting_datamodel==1.5.18 -nowcasting_dataset==3.7.12 sqlalchemy psycopg2-binary geopandas diff --git a/src/system.py b/src/system.py index 26ec129..b224ee5 100644 --- a/src/system.py +++ b/src/system.py @@ -7,7 +7,6 @@ from fastapi import APIRouter, Depends, Request, Security from fastapi_auth0 import Auth0User from nowcasting_datamodel.models import GSPYield, Location -from nowcasting_dataset.data_sources.gsp.eso import get_gsp_metadata_from_eso from sqlalchemy.orm.session import Session from auth_utils import get_auth_implicit_scheme, get_user @@ -25,53 +24,6 @@ NationalYield = GSPYield -def get_gsp_boundaries_from_eso_wgs84() -> gpd.GeoDataFrame: - """Get GSP boundaries in lat/lon format (EPSG:4326)""" - - # get gsp boundaries - boundaries = get_gsp_metadata_from_eso() - - # change to lat/lon - https://epsg.io/4326 - boundaries = boundaries.to_crs(4326) - - # fill nans - boundaries = boundaries.fillna("") - - return boundaries - - -# corresponds to API route /v0/system/GB/gsp/boundaries -@router.get( - "/boundaries", - dependencies=[Depends(get_auth_implicit_scheme())], -) -@cache_response -@limiter.limit(f"{N_CALLS_PER_HOUR}/hour") -def get_gsp_boundaries( - request: Request, - session: Session = Depends(get_session), - user: Auth0User = Security(get_user()), -) -> dict: - """### Get GSP boundaries - - Returns an object with GSP boundaries provided by National Grid ESO. - - [This is a wrapper around the dataset](https://data.nationalgrideso.com/systemgis-boundaries-for-gb-grid-supply-points). - - The return object is in EPSG:4326 (ie. contains latitude & longitude - coordinates). - - """ - - logger.info(f"Getting all GSP boundaries for user {user}") - - json_string = get_gsp_boundaries_from_eso_wgs84().to_json() - - json.loads(json_string) - - return json.loads(json_string) - - # corresponds to API route /v0/system/GB/gsp/, get system details for all GSPs @router.get( "/", diff --git a/src/tests/test_system.py b/src/tests/test_system.py index 9ae9efb..ca3ec26 100644 --- a/src/tests/test_system.py +++ b/src/tests/test_system.py @@ -28,13 +28,3 @@ def test_get_gsp_systems(db_session, api_client): locations = [Location(**location) for location in response.json()] assert len(locations) == 10 assert locations[1].installed_capacity_mw == 1.1 - - -def test_gsp_boundaries(db_session, api_client): - """Check main system/GB/gsp/boundaries""" - - app.dependency_overrides[get_session] = lambda: db_session - - response = api_client.get("/v0/system/GB/gsp/boundaries") - assert response.status_code == 200 - assert len(response.json()) > 0