From b61bf2006c6c240f3b9b8bc1ea59d00b8abd4cea Mon Sep 17 00:00:00 2001 From: peterdudfield Date: Mon, 16 Sep 2024 23:18:00 +0100 Subject: [PATCH] scale sat data by 1024 --- pvnet_app/data/satellite.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/pvnet_app/data/satellite.py b/pvnet_app/data/satellite.py index 5541308..ad8fa62 100644 --- a/pvnet_app/data/satellite.py +++ b/pvnet_app/data/satellite.py @@ -209,4 +209,17 @@ def preprocess_sat_data(t0): # non-nan timestamp extend_satellite_data_with_nans(t0) - return all_datetimes, data_freq_minutes \ No newline at end of file + # scale the satellite data + scale_satellite_data() + + return all_datetimes, data_freq_minutes + + +def scale_satellite_data(): + """Scale the satellite data to be between 0 and 1 """ + + for file in [sat_5_path, sat_15_path]: + if os.path.exists(file): + ds_sat = xr.open_zarr(sat_path) + ds_sat = ds_sat / 1024 + ds_sat.to_zarr(sat_path)