From 7b3d15e252c81ee372312100ef31138712cc8246 Mon Sep 17 00:00:00 2001 From: peterdudfield Date: Tue, 30 Jan 2024 17:00:58 +0000 Subject: [PATCH] fix for 15 minute satellite data --- pvnet_app/app.py | 2 +- pvnet_app/data.py | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/pvnet_app/app.py b/pvnet_app/app.py index 12421f7..43b670a 100644 --- a/pvnet_app/app.py +++ b/pvnet_app/app.py @@ -167,7 +167,7 @@ def app( # Get capacities from the database url = os.getenv("DB_URL") - db_connection = DatabaseConnection(url=url, base=Base_Forecast) + db_connection = DatabaseConnection(url=url, base=Base_Forecast, echo=False) with db_connection.get_session() as session: #  Pandas series of most recent GSP capacities gsp_capacities = get_latest_gsp_capacities(session, gsp_ids) diff --git a/pvnet_app/data.py b/pvnet_app/data.py index a85794e..9c3a255 100644 --- a/pvnet_app/data.py +++ b/pvnet_app/data.py @@ -29,9 +29,10 @@ def download_sat_data(): os.system(f"unzip sat_5_min.zarr.zip -d {sat_5_path}") # Also download 15-minute satellite if it exists - sat_15_dl_path = os.environ["SATELLITE_ZARR_PATH"].replace("sat.zarr", "sat_15.zarr") + sat_15_dl_path = os.environ["SATELLITE_ZARR_PATH"]\ + .replace("sat.zarr", "sat_15.zarr").replace("latest.zarr", "latest_15.zarr") if fs.exists(sat_15_dl_path): - logger.info("Downloading 15-minute satellite data") + logger.info(f"Downloading 15-minute satellite data {sat_15_dl_path}") fs.get(sat_15_dl_path, "sat_15_min.zarr.zip") os.system(f"unzip sat_15_min.zarr.zip -d {sat_15_path}") @@ -57,6 +58,8 @@ def preprocess_sat_data(t0): logger.debug("Resampling 15 minute data to 5 mins") #ds_sat_15.resample(time="5T").interpolate("linear").to_zarr(sat_path) ds_sat_15.attrs["source"] = "15-minute" + + logger.debug(f"Saving 15 minute data to {sat_path}") ds_sat_15.to_zarr(sat_path)