Handling Leap Years in OpenMeteo Resource Data#633
Open
elenya-grant wants to merge 4 commits intoNatLabRockies:developfrom
Open
Handling Leap Years in OpenMeteo Resource Data#633elenya-grant wants to merge 4 commits intoNatLabRockies:developfrom
elenya-grant wants to merge 4 commits intoNatLabRockies:developfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Handling Leap Years in OpenMeteo Resource Data
The NLR API calls handle leap years by removing them. The PySAM solar function
SAM_CSV_to_solar_data(from PySAM.ResourceTools) also has logic to remove leap days (although it's hard-coded for hourly data and assumes UTC timezone). If we were to run the floris wind plant model using openmeteo wind resource data from 2024, we would get an error on the linepower_farm = self.fi.get_farm_power().reshape(self.n_timesteps)becausen_timestepsis 8760 but the resource data (and therefore the wind farm timeseries) is length 8784 (includes a leap day).This PR adds the ability to remove resource data for a leap day data in the OpenMeteo resource models. This option is user-controlled with the new configuration parameter for the openmeteo resource models
include_leap_day(which defaults to False).Section 1: Type of Contribution
Section 2: Draft PR Checklist
Type of Reviewer Feedback Requested (on Draft PR)
Structural feedback:
Implementation feedback:
Other feedback:
Section 3: General PR Checklist
docs/files are up-to-date, or added when necessaryCHANGELOG.md"A complete thought. [PR XYZ]((https://github.com/NatLabRockies/H2Integrate/pull/XYZ)", where
XYZshould be replaced with the actual number.Section 3: Related Issues
Section 4: Impacted Areas of the Software
Section 4.1: New Files
resource_files/wind/-28.454864_114.551749_2024_openmeteo_archive_60min_local_tz.csvresource_files/solar/-28.454864_114.551749_2024_openmeteo_archive_solar_60min_local_tz.csvSection 4.2: Modified Files
h2integrate/resource/resource_base.py:ResourceBaseAPIModel.setup(): addedn_timestepsas an attribute of the classh2integrate/resource/wind/openmeteo_wind.pyOpenMeteoHistoricalWindAPIConfig: addedinclude_leap_dayattributeOpenMeteoHistoricalWindResourceload_data(): updated to remove leap day if specified and needed. Added error message if resource data is not the same length as n_timesteps.format_timeseries_data: updated units foris_dayto be unitless (bugfix)h2integrate/resource/solar/openmeteo_solar.pyOpenMeteoHistoricalSolarAPIConfig: addedinclude_leap_dayattributeOpenMeteoHistoricalSolarResourceload_data(): updated to remove leap day if specified and needed. Added error message if resource data is not the same length as n_timesteps.Tests
h2integrate/resource/wind/test/test_openmeteo_wind_api.py: added test for leap-year datah2integrate/resource/solar/test/test_resource_models.py: added test for leap-year datah2integrate/resource/solar/test/test_pvwatts_integration.py: added test for leap-year dataSection 5: Additional Supporting Information
Section 6: Test Results, if applicable
Section 7 (Optional): New Model Checklist
docs/developer_guide/coding_guidelines.mdattrsclass to define theConfigto load in attributes for the modelBaseConfigorCostModelBaseConfiginitialize()method,setup()method,compute()methodCostModelBaseClasssupported_models.pycreate_financial_modelinh2integrate_model.pytest_all_examples.pydocs/user_guide/model_overview.mddocs/section<model_name>.mdis added to the_toc.yml