Skip to content

Commit d52f430

Browse files
Bring all Analysis Modules up to v3 spec with speed/readability improvements (#212)
* rename ._plant to .plant * update reanalysis products naming * update _aggregate and refactor MonteCarloAEP to attrs * update initialization and removal of unnecessary shortening * update examples for renaming * continue renaming unnecessary dunders and shortening, and initializations * reorganizing and simplifying code and getting initialization working * update minor formatting and bugs * fix data persistency bug causing tests to fail * add final AEP changes before needing to stop * make electrical losses an attrs dataclass and sort out inputs * add power-energy conversion and continue refactoring elect. losses * add s to turbine_id and tower_id * update EL routines and add a plot to the class * update EL tests * add styling method call to plotting * add frequency checks to the timeseries module * address edge cases in offset to seconds conversion * implement proper frequency checking * complete data validation * update regression tests for validation and implement plant validator in AEP * make integer conversion robust * update test to adjust for energy col * merged aep_v3_refactor branch with rhammond pull request 212. This brings in a fix for the structure of the logger, which allows us to attach analysis classes to the openoa object in init. For some reason the electrical losses test is now failing * refactor basic input format of EYA class * fix bug inducing typo in setup_inputs * get eya init running * start plot refactor * add timeseries method * start turbine loss refactor into attrs with v3 api * bring turbine energy up to v3 in theory * update for common validations and to get turbine energy almost working * finish basic refactor of TIE and add tests * update analysis notebooks * remove notebook file outputs * add missing class to init * get all but the intro examples working again and refactor waterfall plot * minor unsaved updates * tidy up plotting API and routines for analysis classes * debugging QA code to find issues * fix documentation build issues * rerun examples * cleanup the analysis docs * finish plotting refactor for analysis methods * update examples docs layout * tidy up examples presentation and docs build issues * update working and rerun examples * fix unit test for net_energy removal from curtail * fix tests * continue debugging QA, though there is some data modification happening improperly * fix QA bug with timestamps and rerun notebook * tidy up examples page Co-authored-by: Jordan Perr-Sauer <[email protected]>
1 parent 37d4f86 commit d52f430

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+6307
-3441
lines changed

examples/00_intro_to_plant_data.ipynb

Lines changed: 187 additions & 182 deletions
Large diffs are not rendered by default.

examples/00_toolkit_examples_entr.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@
9999
"# Load meta data\n",
100100
"plant._lat_lon = (48.452, 5.588)\n",
101101
"plant._plant_capacity = 8.2 # MW\n",
102-
"plant._num_turbines = 4\n",
102+
"plant.n_turbines = 4\n",
103103
"plant._turbine_capacity = 2.05 # MW\n",
104104
"\n",
105105
"\n",

examples/00_v3_demonstration.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -738,7 +738,7 @@
738738
" \"columns\": [\"windspeed\", \"rho\"],\n",
739739
" \"conditional_columns\": {\n",
740740
" \"reg_temperature\": [\"temperature\"],\n",
741-
" \"reg_winddirection\": [\"windspeed_u\", \"windspeed_v\"],\n",
741+
" \"reg_wind_direction\": [\"windspeed_u\", \"windspeed_v\"],\n",
742742
" },\n",
743743
" },\n",
744744
" },\n",

examples/01_utils_examples.ipynb

Lines changed: 130 additions & 148 deletions
Large diffs are not rendered by default.

examples/02_plant_aep_analysis.ipynb

Lines changed: 58 additions & 33 deletions
Large diffs are not rendered by default.

examples/02b_augmented_plant_aep_analysis.ipynb

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -128,16 +128,16 @@
128128
],
129129
"source": [
130130
"pa_lin = plant_analysis.MonteCarloAEP(project, reanal_products = ['merra2','era5'], time_resolution = 'M',\n",
131-
" reg_temperature = False, reg_winddirection = False, reg_model = 'lin')\n",
131+
" reg_temperature = False, reg_wind_direction = False, reg_model = 'lin')\n",
132132
"\n",
133133
"pa_gam = plant_analysis.MonteCarloAEP(project, reanal_products = ['merra2','era5'], time_resolution = 'H',\n",
134-
" reg_temperature = False, reg_winddirection = False, reg_model = 'gam')\n",
134+
" reg_temperature = False, reg_wind_direction = False, reg_model = 'gam')\n",
135135
"\n",
136136
"pa_gbm = plant_analysis.MonteCarloAEP(project, reanal_products = ['merra2','era5'], time_resolution = 'D', \n",
137-
" reg_temperature = False, reg_winddirection = False, reg_model = 'gbm')\n",
137+
" reg_temperature = False, reg_wind_direction = False, reg_model = 'gbm')\n",
138138
"\n",
139139
"pa_etr = plant_analysis.MonteCarloAEP(project, reanal_products = ['merra2','era5'], time_resolution = 'D',\n",
140-
" reg_temperature = False, reg_winddirection = False, reg_model = 'etr')"
140+
" reg_temperature = False, reg_wind_direction = False, reg_model = 'etr')"
141141
]
142142
},
143143
{
@@ -368,7 +368,7 @@
368368
],
369369
"source": [
370370
"# View the monthly data frame\n",
371-
"pa_lin._aggregate.df.head()"
371+
"pa_lin.aggregate.df.head()"
372372
]
373373
},
374374
{
@@ -390,10 +390,10 @@
390390
"name": "stderr",
391391
"output_type": "stream",
392392
"text": [
393-
"INFO:openoa.methods.plant_analysis:Running with parameters: {'uncertainty_meter': 0.005, 'uncertainty_losses': 0.05, 'uncertainty_loss_max': array([10., 20.]), 'uncertainty_windiness': array([10., 20.]), 'uncertainty_nan_energy': 0.01, 'num_sim': 1000, 'reanal_subset': ['merra2', 'era5']}\n",
393+
"INFO:openoa.methods.plant_analysis:Running with parameters: {'uncertainty_meter': 0.005, 'uncertainty_losses': 0.05, 'uncertainty_loss_max': array([10., 20.]), 'uncertainty_windiness': array([10., 20.]), 'uncertainty_nan_energy': 0.01, 'num_sim': 1000, 'reanalysis_subset': ['merra2', 'era5']}\n",
394394
"100%|██████████| 1000/1000 [00:29<00:00, 33.89it/s]\n",
395395
"INFO:openoa.methods.plant_analysis:Run completed\n",
396-
"INFO:openoa.methods.plant_analysis:Running with parameters: {'uncertainty_meter': 0.005, 'uncertainty_losses': 0.05, 'uncertainty_loss_max': array([10., 20.]), 'uncertainty_windiness': array([10., 20.]), 'uncertainty_nan_energy': 0.01, 'num_sim': 500, 'reanal_subset': ['merra2', 'era5']}\n",
396+
"INFO:openoa.methods.plant_analysis:Running with parameters: {'uncertainty_meter': 0.005, 'uncertainty_losses': 0.05, 'uncertainty_loss_max': array([10., 20.]), 'uncertainty_windiness': array([10., 20.]), 'uncertainty_nan_energy': 0.01, 'num_sim': 500, 'reanalysis_subset': ['merra2', 'era5']}\n",
397397
" 0%| | 0/500 [00:00<?, ?it/s]"
398398
]
399399
},
@@ -424,7 +424,7 @@
424424
"text": [
425425
"100%|██████████| 500/500 [05:00<00:00, 1.66it/s]\n",
426426
"INFO:openoa.methods.plant_analysis:Run completed\n",
427-
"INFO:openoa.methods.plant_analysis:Running with parameters: {'uncertainty_meter': 0.005, 'uncertainty_losses': 0.05, 'uncertainty_loss_max': array([10., 20.]), 'uncertainty_windiness': array([10., 20.]), 'uncertainty_nan_energy': 0.01, 'num_sim': 500, 'reanal_subset': ['merra2', 'era5']}\n",
427+
"INFO:openoa.methods.plant_analysis:Running with parameters: {'uncertainty_meter': 0.005, 'uncertainty_losses': 0.05, 'uncertainty_loss_max': array([10., 20.]), 'uncertainty_windiness': array([10., 20.]), 'uncertainty_nan_energy': 0.01, 'num_sim': 500, 'reanalysis_subset': ['merra2', 'era5']}\n",
428428
" 0%| | 0/500 [00:00<?, ?it/s]"
429429
]
430430
},
@@ -455,7 +455,7 @@
455455
"text": [
456456
"100%|██████████| 500/500 [04:09<00:00, 2.01it/s]\n",
457457
"INFO:openoa.methods.plant_analysis:Run completed\n",
458-
"INFO:openoa.methods.plant_analysis:Running with parameters: {'uncertainty_meter': 0.005, 'uncertainty_losses': 0.05, 'uncertainty_loss_max': array([10., 20.]), 'uncertainty_windiness': array([10., 20.]), 'uncertainty_nan_energy': 0.01, 'num_sim': 500, 'reanal_subset': ['merra2', 'era5']}\n",
458+
"INFO:openoa.methods.plant_analysis:Running with parameters: {'uncertainty_meter': 0.005, 'uncertainty_losses': 0.05, 'uncertainty_loss_max': array([10., 20.]), 'uncertainty_windiness': array([10., 20.]), 'uncertainty_nan_energy': 0.01, 'num_sim': 500, 'reanalysis_subset': ['merra2', 'era5']}\n",
459459
" 0%| | 0/500 [00:00<?, ?it/s]"
460460
]
461461
},
@@ -621,7 +621,7 @@
621621
"metadata": {},
622622
"source": [
623623
"The augmented capabilities of the AEP class now allow the user to include temperature and/or wind direction as additional inputs to the long-term OA. \n",
624-
"This choice is controlled by the booleans \"reg_temperature\" and \"reg_winddirection\".\n",
624+
"This choice is controlled by the booleans \"reg_temperature\" and \"reg_wind_direction\".\n",
625625
"In this example, we will compute AEP using a multivariate hourly GAM regression, including wind speed and temperature as inputs, and compare the results with the univariate GAM applied in the previous comparison."
626626
]
627627
},
@@ -640,7 +640,7 @@
640640
],
641641
"source": [
642642
"pa_gam_T = plant_analysis.MonteCarloAEP(project, reanal_products = ['merra2','era5'], time_resolution = 'H',\n",
643-
" reg_temperature = True, reg_winddirection = False, reg_model = 'gam')"
643+
" reg_temperature = True, reg_wind_direction = False, reg_model = 'gam')"
644644
]
645645
},
646646
{
@@ -659,7 +659,7 @@
659659
"name": "stderr",
660660
"output_type": "stream",
661661
"text": [
662-
"INFO:openoa.methods.plant_analysis:Running with parameters: {'uncertainty_meter': 0.005, 'uncertainty_losses': 0.05, 'uncertainty_loss_max': array([10., 20.]), 'uncertainty_windiness': array([10., 20.]), 'uncertainty_nan_energy': 0.01, 'num_sim': 500, 'reanal_subset': ['merra2', 'era5']}\n",
662+
"INFO:openoa.methods.plant_analysis:Running with parameters: {'uncertainty_meter': 0.005, 'uncertainty_losses': 0.05, 'uncertainty_loss_max': array([10., 20.]), 'uncertainty_windiness': array([10., 20.]), 'uncertainty_nan_energy': 0.01, 'num_sim': 500, 'reanalysis_subset': ['merra2', 'era5']}\n",
663663
" 0%| | 0/500 [00:00<?, ?it/s]"
664664
]
665665
},

0 commit comments

Comments
 (0)