Skip to content

Commit

Permalink
ruff lint and format
Browse files Browse the repository at this point in the history
  • Loading branch information
paulf81 committed Dec 12, 2023
1 parent c0c2ddc commit a1eba38
Show file tree
Hide file tree
Showing 14 changed files with 253 additions and 6,643 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -722,7 +722,7 @@
" # In this case, we have an operational_status flag. If that has a 'False' value, then we\n",
" # mark those measurements as faulty.\n",
" ws_pow_filtering.filter_by_condition(\n",
" condition=(ws_pow_filtering.df[\"is_operation_normal_{:03d}\".format(ti)] == False),\n",
" condition=(ws_pow_filtering.df[\"is_operation_normal_{:03d}\".format(ti)] is False),\n",
" label=\"Self-flagged (is_operation_normal==False)\",\n",
" ti=ti,\n",
" verbose=True,\n",
Expand Down Expand Up @@ -842,7 +842,8 @@
" print(\"\\n\")\n",
"\n",
" if plot_figures:\n",
" # Plot farm-averaged power curve based on the data (useful to e.g., feed into FLORIS when not provided by OEM)\n",
" # Plot farm-averaged power curve based on the data (useful to e.g., feed\n",
" # into FLORIS when not provided by OEM)\n",
" fig, ax = ws_pow_filtering.plot_farm_mean_power_curve(fi=fi)\n",
" if save_figures:\n",
" plt.savefig(os.path.join(figure_save_path, \"median_farm_power_curves.png\"))\n",
Expand Down
2,183 changes: 27 additions & 2,156 deletions examples_artificial_data/01_raw_data_processing/01_northing_calibration.ipynb

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@
}
],
"source": [
"# Create a time history of points where the wind speed and wind direction step different combinations\n",
"# Create a time history of points where the wind speed and\n",
"# wind direction step different combinations\n",
"ws_points = np.arange(5.0, 10.0, 1.0)\n",
"wd_points = np.arange(\n",
" 250.0,\n",
Expand Down Expand Up @@ -263,8 +264,6 @@
"metadata": {},
"outputs": [],
"source": [
"# erp.compute_energy_ratio(df_energy, [0], [2], df_names=['Baseline', 'WakeSteering'])\n",
"\n",
"er_out = erp.compute_energy_ratio(\n",
" er_in,\n",
" test_turbines=[2],\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@
}
],
"source": [
"# Create a time history of points where the wind speed and wind direction step different combinations\n",
"# Create a time history of points where the wind\n",
"# speed and wind direction step different combinations\n",
"ws_points = np.arange(5.0, 10.0, 1.0)\n",
"wd_points = np.arange(\n",
" 250.0,\n",
Expand Down Expand Up @@ -235,7 +236,8 @@
}
],
"source": [
"# Calculate and plot the energy ratio of turbine 2 with respect to turbine 0, using turbine 0's measurements of wind speed and wind direction\n",
"# Calculate and plot the energy ratio of turbine 2 with respect to\n",
"# turbine 0, using turbine 0's measurements of wind speed and wind direction\n",
"er_out = erp.compute_energy_ratio(\n",
" er_in, test_turbines=[2], ref_turbines=[0], ws_turbines=[0], wd_turbines=[0], N=50\n",
")\n",
Expand Down Expand Up @@ -272,7 +274,8 @@
}
],
"source": [
"# Reverse the above calculation showing the energy ratio of T0 / T2, letting T1 supply wind speed and direction\n",
"# Reverse the above calculation showing the energy ratio of T0 / T2,\n",
"# letting T1 supply wind speed and direction\n",
"er_out = erp.compute_energy_ratio(\n",
" er_in, test_turbines=[0], ref_turbines=[2], ws_turbines=[1], wd_turbines=[1], N=50\n",
")\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@
"metadata": {},
"outputs": [],
"source": [
"# Identify the indexes of the reference turbine, the control turbine, the single_wake turbine and the deep_wake turbine\n",
"# Identify the indexes of the reference turbine, the control turbine,\n",
"# the single_wake turbine and the deep_wake turbine\n",
"ref_idx = 0\n",
"control_idx = int(np.floor(n_row_y / 2))\n",
"single_wake_idx = int(np.floor(n_row_y / 2) + n_row_y)\n",
Expand Down Expand Up @@ -234,7 +235,8 @@
}
],
"source": [
"# Create a time history of points where the wind speed and wind direction step different combinations\n",
"# Create a time history of points where the wind speed and wind\n",
"# direction step different combinations\n",
"ws_points = np.arange(5.0, 10.0, 1.0)\n",
"wd_points = np.arange(\n",
" 250.0,\n",
Expand Down
1,473 changes: 26 additions & 1,447 deletions examples_artificial_data/_legacy/table_analysis/test_out_table.ipynb

Large diffs are not rendered by default.

20 changes: 13 additions & 7 deletions examples_smarteole/02_download_and_format_dataset.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -594,27 +594,31 @@
" ), # We want to use the 'active' power production for our analysis in FLASC\n",
" \"wind_speed_{:1d}_avg\".format(ii + 1): \"ws_{:03d}\".format(\n",
" ii\n",
" ), # Turbine-felt wind speed. Ideally, this should be the freestream-equivalent wind speed at this turbine.\n",
" ), # Turbine-felt wind speed. Ideally, this should be the freestream-equivalent\n",
" # wind speed at this turbine.\n",
" \"wind_direction_{:1d}_avg\".format(ii + 1): \"wd_{:03d}\".format(\n",
" ii\n",
" ), # Wind direction from the data. If this is not available, can approximate this with the nacelle heading.\n",
" ), # Wind direction from the data. If this is not available, can approximate\n",
" # this with the nacelle heading.\n",
" \"derate_{:1d}\".format(ii + 1): \"is_operation_normal_{:03d}\".format(ii),\n",
" }\n",
" )\n",
"\n",
" df_list = []\n",
" # df_list = []\n",
" print(\"formatting dataframe...\")\n",
" df_scada = df_scada.rename(columns=scada_dict)\n",
"\n",
" # Convert is_operation_normal columns from integers in original format (0: normal, 1: not normal)\n",
" # Convert is_operation_normal columns from integers in\n",
" # original format (0: normal, 1: not normal)\n",
" # to boolean FLASC convention (True: normal, False: not normal)\n",
" for ii in range(len(turbine_names)):\n",
" df_scada[\"is_operation_normal_{:03d}\".format(ii)] = ~df_scada[\n",
" \"is_operation_normal_{:03d}\".format(ii)\n",
" ].astype(bool)\n",
"\n",
" # We'll also save the wind vane angle of the turbine for which wake steering is implemented, the\n",
" # target yaw offset from the wake steering controller, and the control mode (baseline or wake steering)\n",
" # target yaw offset from the wake steering controller,\n",
" # and the control mode (baseline or wake steering)\n",
" scada_dict = {\n",
" \"wind_vane_6_avg\": \"wind_vane_005\",\n",
" \"control_log_offset_avg\": \"target_yaw_offset_005\",\n",
Expand All @@ -624,7 +628,8 @@
" columns=scada_dict\n",
" ) # Simplify names and use FLASC zero indexing convention\n",
"\n",
" # The control mode is indicated as 0 for baseline and 1 for wake steering. Let's change this to a column of\n",
" # The control mode is indicated as 0 for baseline and 1 for wake steering.\n",
" # Let's change this to a column of\n",
" # strings with values of \"baseline\" or \"controlled\".\n",
" df_scada[\"control_mode\"] = df_scada[\"control_mode\"].round()\n",
" df_scada.loc[df_scada[\"control_mode\"] == 0.0, \"control_mode\"] = \"baseline\"\n",
Expand Down Expand Up @@ -746,7 +751,8 @@
" all turbines.\n",
"\n",
" Returns:\n",
" df [pd.DataFrame]: Dataframe with added wd_smarteole, ws_smarteole, and pow_ref_smarteole columns.\n",
" df [pd.DataFrame]: Dataframe with added wd_smarteole,\n",
" ws_smarteole, and pow_ref_smarteole columns.\n",
" \"\"\"\n",
"\n",
" data_dir = os.path.join(\"data\", \"SMARTEOLE-WFC-open-dataset\")\n",
Expand Down
375 changes: 21 additions & 354 deletions examples_smarteole/03_filter_ws_power_curves.ipynb

Large diffs are not rendered by default.

Loading

0 comments on commit a1eba38

Please sign in to comment.