This repository was archived by the owner on Sep 11, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +0
-12
lines changed
nowcasting_dataset/data_sources/pv Expand file tree Collapse file tree 1 file changed +0
-12
lines changed Original file line number Diff line number Diff line change @@ -377,23 +377,11 @@ def load_solar_pv_data(
377377 """
378378 logger .debug (f"Loading Solar PV Data from { filename } from { start_dt } to { end_dt } ." )
379379
380- # It is possible to simplify the code below and do
381- # xr.open_dataset(file, engine='h5netcdf')
382- # in the first 'with' block, and delete the second 'with' block.
383- # But that takes 1 minute to load the data, where as loading into memory
384- # first and then loading from memory takes 23 seconds!
385380 with fsspec .open (filename , mode = "rb" ) as file :
386- file_bytes = file .read ()
387-
388- with io .BytesIO (file_bytes ) as file :
389381 pv_power = xr .open_dataset (file , engine = "h5netcdf" )
390382 pv_power = pv_power .sel (datetime = slice (start_dt , end_dt ))
391383 pv_power_df = pv_power .to_dataframe ()
392384
393- # Save memory
394- del file_bytes
395- del pv_power
396-
397385 # Process the data a little
398386 pv_power_df = pv_power_df .dropna (axis = "columns" , how = "all" )
399387 pv_power_df = pv_power_df .clip (lower = 0 , upper = 5e7 )
You can’t perform that action at this time.
0 commit comments