Skip to content

Commit

Permalink
Merge pull request #39 from openclimatefix/issue/more-logging
Browse files Browse the repository at this point in the history
fix for 15 minute satellite data
  • Loading branch information
peterdudfield authored Jan 30, 2024
2 parents 4c8d9b5 + 7b3d15e commit e50bc77
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pvnet_app/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
7 changes: 5 additions & 2 deletions pvnet_app/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}")

Expand All @@ -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)


Expand Down

0 comments on commit e50bc77

Please sign in to comment.