From 35625dd7cb6192529f072dacc26c361eca73c9a3 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 11 Dec 2023 04:58:32 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- examples/india_box_plots.py | 8 +++----- examples/india_chart_per_system.py | 8 +++++--- examples/india_gantt_chart.py | 5 +++-- examples/india_map.py | 3 +-- examples/india_mean_production.py | 15 ++++++--------- examples/india_system_capacity_histogram.py | 1 + pvoutput/mapscraper.py | 1 + pvoutput/pvoutput.py | 2 +- scripts/fetch_pv_timeseries.py | 11 ++++++----- 9 files changed, 27 insertions(+), 27 deletions(-) diff --git a/examples/india_box_plots.py b/examples/india_box_plots.py index e393b1e..0a0a057 100644 --- a/examples/india_box_plots.py +++ b/examples/india_box_plots.py @@ -1,8 +1,8 @@ """Box plots of max cumulative energy generation per system""" -import pandas as pd +import h5py import numpy as np +import pandas as pd import plotly.graph_objects as go -import h5py # load hdf file with the generation data for each system pv_systems_hdf = os.environ.get("PV_DATA_HDF") @@ -45,9 +45,7 @@ df_pv_system["index"] = pd.to_datetime(df_pv_system["index"], unit="ns") df_pv_system = df_pv_system.groupby(pd.Grouper(key="index", freq="D")).max() df_pv_system["System ID"] = system_id - df_pv_system = pd.DataFrame( - df_pv_system, columns=["cumulative_energy_gen_Wh", "System ID"] - ) + df_pv_system = pd.DataFrame(df_pv_system, columns=["cumulative_energy_gen_Wh", "System ID"]) df_pv_system["cumulative_energy_gen_kWh"] = ( df_pv_system["cumulative_energy_gen_Wh"] / 1000 ).astype(float) diff --git a/examples/india_chart_per_system.py b/examples/india_chart_per_system.py index 2fcfa59..7dc8667 100644 --- a/examples/india_chart_per_system.py +++ b/examples/india_chart_per_system.py @@ -1,10 +1,12 @@ """Chart generation for a single system. This shows the cumulative energy -generation or instantaneous power generation over time. Some of the commented out code can be used to filter the data by date or plot max, mean, min, median values, etc.""" +generation or instantaneous power generation over time. Some of the commented out code can be used to filter the data by date or plot max, mean, min, median values, etc. +""" import os -import pandas as pd + +import h5py import numpy as np +import pandas as pd import plotly.express as px -import h5py # load hdf file with the generation data for each system pv_systems_hdf = os.environ.get("PV_DATA_HDF") diff --git a/examples/india_gantt_chart.py b/examples/india_gantt_chart.py index a26d20a..c1654b7 100644 --- a/examples/india_gantt_chart.py +++ b/examples/india_gantt_chart.py @@ -1,9 +1,10 @@ """Gantt chart for India PV systems. This shows where there are gaps in the data.""" import os -import pandas as pd + +import h5py import numpy as np +import pandas as pd import plotly.express as px -import h5py # load hdf file with the generation data for each system pv_data_hdf = os.environ.get("PV_DATA_HDF") diff --git a/examples/india_map.py b/examples/india_map.py index c2fdca9..c849402 100644 --- a/examples/india_map.py +++ b/examples/india_map.py @@ -1,7 +1,6 @@ """ Example of plotting PVOutput India system locations on a map.""" -import os -import plotly.express as px import pandas as pd +import plotly.express as px # load csv file with system metadata pv_system_metadata = "./examples/pv_data/PVOutput_India_systems.csv" diff --git a/examples/india_mean_production.py b/examples/india_mean_production.py index 362c69b..0b461ca 100644 --- a/examples/india_mean_production.py +++ b/examples/india_mean_production.py @@ -3,11 +3,12 @@ This makes a plot with 2 columns and half as many rows as there are systems with data. """ import os -import pandas as pd -from plotly.subplots import make_subplots + +import h5py import numpy as np +import pandas as pd import plotly.graph_objects as go -import h5py +from plotly.subplots import make_subplots # load hdf file with the generation data for each system pv_data_hdf_file = os.environ.get("SYSTEM_DATA") @@ -66,9 +67,7 @@ def row(row): # df["index"] = df[df["index"] > pd.Timestamp("2019-01-01")] df_pv_system = df.groupby(pd.Grouper(key="index", freq="M")).mean() df_pv_system["System ID"] = system_id - df_pv_system = pd.DataFrame( - df_pv_system, columns=["cumulative_energy_gen_Wh", "System ID"] - ) + df_pv_system = pd.DataFrame(df_pv_system, columns=["cumulative_energy_gen_Wh", "System ID"]) # convert Wh to kWh df_pv_system["cumulative_energy_gen_kWh"] = ( df_pv_system["cumulative_energy_gen_Wh"] / 1000 @@ -99,8 +98,6 @@ def row(row): ) i += 1 fig.update_yaxes(title_text="kWh") - fig.update_layout( - height=3000, width=750, title_text="Mean Monthly Production per System" - ) + fig.update_layout(height=3000, width=750, title_text="Mean Monthly Production per System") fig.update_annotations(font_size=12) fig.show() diff --git a/examples/india_system_capacity_histogram.py b/examples/india_system_capacity_histogram.py index 2196f47..fda4c2e 100644 --- a/examples/india_system_capacity_histogram.py +++ b/examples/india_system_capacity_histogram.py @@ -1,5 +1,6 @@ """Histogram of system capacities for India.""" import os + import pandas as pd import plotly.express as px diff --git a/pvoutput/mapscraper.py b/pvoutput/mapscraper.py index c64f1f1..9c0c8d1 100644 --- a/pvoutput/mapscraper.py +++ b/pvoutput/mapscraper.py @@ -350,6 +350,7 @@ def clean_soup(soup): """Function to clean scraped soup object. Note that the downloaded soup could change over time. + Args: soup: bs4.BeautifulSoup diff --git a/pvoutput/pvoutput.py b/pvoutput/pvoutput.py index 0e4ea35..6993985 100644 --- a/pvoutput/pvoutput.py +++ b/pvoutput/pvoutput.py @@ -924,7 +924,7 @@ def _download_multiple_worker( ) else: total_rows += len(timeseries) - _LOG.info(f'Adding timezone {timezone} to {total_rows} rows') + _LOG.info(f"Adding timezone {timezone} to {total_rows} rows") timeseries = timeseries.tz_localize(timezone) _LOG.info( "system_id: %d: %d rows retrieved: %s to %s", diff --git a/scripts/fetch_pv_timeseries.py b/scripts/fetch_pv_timeseries.py index ac7d4a6..39b6eda 100644 --- a/scripts/fetch_pv_timeseries.py +++ b/scripts/fetch_pv_timeseries.py @@ -21,14 +21,15 @@ or create and use a ~/.pvoutput.yml file as described in the PVOutput library documentation """ -from pvoutput import * - -import click as cl import datetime as dt +import logging +import pathlib import sys + +import click as cl import pandas as pd -import pathlib -import logging + +from pvoutput import * @cl.command()