Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Dec 11, 2023
1 parent bacdb5a commit 35625dd
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 27 deletions.
8 changes: 3 additions & 5 deletions examples/india_box_plots.py
Original file line number Diff line number Diff line change
@@ -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")
Expand Down Expand Up @@ -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)
Expand Down
8 changes: 5 additions & 3 deletions examples/india_chart_per_system.py
Original file line number Diff line number Diff line change
@@ -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")
Expand Down
5 changes: 3 additions & 2 deletions examples/india_gantt_chart.py
Original file line number Diff line number Diff line change
@@ -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")
Expand Down
3 changes: 1 addition & 2 deletions examples/india_map.py
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
15 changes: 6 additions & 9 deletions examples/india_mean_production.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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()
1 change: 1 addition & 0 deletions examples/india_system_capacity_histogram.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Histogram of system capacities for India."""
import os

import pandas as pd
import plotly.express as px

Expand Down
1 change: 1 addition & 0 deletions pvoutput/mapscraper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pvoutput/pvoutput.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
11 changes: 6 additions & 5 deletions scripts/fetch_pv_timeseries.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 35625dd

Please sign in to comment.