Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add generate_forecasts script #99

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

JadeVexo
Copy link

@JadeVexo JadeVexo commented Apr 2, 2024

Pull Request

Description

This commit introduces a new script named generate_forecasts.py that generates solar power forecasts for multiple photovoltaic (PV) sites.

The script contains a function called generate_forecasts that takes a list of site information tuples and a forecast date as input. For each site, it creates a PVSite object, runs the forecast using the run_forecast function from the quartz_solar_forecast module, and generates a DataFrame containing the site's latitude, longitude, capacity, and power forecast values.

The script then concatenates all the site DataFrames into a single DataFrame and returns it. The resulting DataFrame has columns for each site's latitude, longitude, capacity, and power forecast, with a column name in the format "{pv_id} Power". The index of the DataFrame is set to the forecast dates.

The script also includes an example usage section that demonstrates how to call the generate_forecasts function with sample site information and a forecast date. The generated forecasts are then saved to a CSV file named pv_forecasts.csv.

This script can be used to generate solar power forecasts for multiple PV sites.

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce.
Please also list any relevant details for your test configuration

  • Yes

If your changes affect data processing, have you plotted any changes? i.e. have you done a quick sanity check?

  • Yes

Checklist:

  • My code follows OCF's coding style guidelines
  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • I have checked my code and corrected any misspellings

This commit introduces a new script named generate_forecasts.py that generates solar power forecasts for multiple photovoltaic (PV) sites.

The script contains a function called generate_forecasts that takes a list of site information tuples and a forecast date as input. For each site, it creates a PVSite object, runs the forecast using the run_forecast function from the quartz_solar_forecast module, and generates a DataFrame containing the site's latitude, longitude, capacity, and power forecast values.

The script then concatenates all the site DataFrames into a single DataFrame and returns it. The resulting DataFrame has columns for each site's latitude, longitude, capacity, and power forecast, with a column name in the format "{pv_id} Power". The index of the DataFrame is set to the forecast dates.

The script also includes an example usage section that demonstrates how to call the generate_forecasts function with sample site information and a forecast date. The generated forecasts are then saved to a CSV file named pv_forecasts.csv.

This script can be used to generate solar power forecasts for multiple PV sites, which can be useful for various applications, such as energy management, grid integration, and financial analysis.
@zakwatts zakwatts self-requested a review April 17, 2024 15:22
@zakwatts
Copy link
Contributor

Hi @JadeVexo! Thanks for working on this.

Copy link
Contributor

@zakwatts zakwatts left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Could you also change the name of the script to mention that this is for multiple sites? Then should be good to go.

# Add more sites as needed, with format (pv_id, latitude, longitude, capacity)
]
forecast_date = "2023-11-01" # Forecast date
output_file = "pv_forecasts.csv" # Output file name
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you change the output file name to include the forecast_date, and also mention that is for multiple sites. Maybe "multiple_pv_forecasts_{forecast_date}"?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. Have had my finals this week. Will have the changes pushed by tonight

@JadeVexo
Copy link
Author

I have made the changes as requested. Anything else to be done?

@zakwatts
Copy link
Contributor

Could the output file include the forecast data? ("multiple_pv_forecasts_{forecast_date}"?)

@zakwatts
Copy link
Contributor

Then happy to merge

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants