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

Dev scenario geospatial #97

Merged
merged 118 commits into from
Aug 13, 2024
Merged

Conversation

tobin-ford
Copy link
Collaborator

Describe your changes

Initial Scenario Analysis Integration. Sweeping scenario changes. New temperature function temperature.temperature that combines all temperature calculations (cell and module) into one function with support for all pvlib temperature models. All pvdeg functions preforming temperature calculations have been updated accordingly.

Additionally

  • Unified Cell and Module Temperature function. See: `temperature.temperature``
  • Added support for pvlib temperature models. see pvlib docs <https://pvlib-python.readthedocs.io/en/stable/reference/pv_modeling/temperature.html>
  • Overhauled scenario class for pv system analysis. Scenario object for single point analysis and GeospatialScenario object for geospatial analysis. See: scenario.Scenario and scenario.GeospatialScenario
  • Created Scenario tutorials to showcase new scenario functionality.
  • Added a number of geospatial downselection functions. Find coordinates near mountains, rivers, coastlines and lakes from NSRDB data. See: geospatial.identify_mountains_weights, geospatial.identify_mountains_radii, geospatial.feature_downselect
  • Added geospatial bounding box support. Clip unwanted data with rectangular bounding boxes. See: geospatial.apply_bounding_box
  • Added stochastic non-uniform density downselection function to preferentially select for mountains (higher point density with changes in elevation, lower density when flatter.) See: geospatial.elevation_stochastic_downselection
  • Updated non-uniform downselection with thresholding and non-linear normalization (support for logarithmic and exponential normalization) See: geospatial.identify_mountains_weights
  • Added Scenario and GeospatialScenario methods for quick plotting and downselection. See: GeospatialScenario.plot_coords, GeospatialScenario.plot_meta_classification GeospatialScenario.plot_USA, Scenario.extract, Scenario.plot, GeospatialScenario.classify_mountain_weights, GeospatialScenario.classify_mountain_radii, GeospatialScenario.downselect_elevation_stochastic

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

Checklist before requesting a review

  • I have performed a self-review of my code
  • Code changes are covered by tests.
  • New functions added to init.py
  • API.rst is up to date, along with other sphinx docs pages
  • Example notebooks are rerun and differences in results scrutinized
  • What's new changelog has been updated in the docs

if two unique instances are created in the same notebook (i suspect current working dir as well)
they will use the same saved information and not be able to have unique data
for ex:
create foo and add job "A" in the pipline,
create bar and add job "B" in the pipline
foo.pipeline = bar.pipeline
=> A = B
the pipelines will be shared between class instances.
only current soltution is to not declare more than one class in the same file (/directory?!?)
resets scenario.

This is useful because the Scenario object stores its data in local files outside of the python script.
        This causes issues when two unique scenario instances are created in the same directory, they appear to be seperate instances to python but share the same data. Changes made to one are reflected in both.
potential: conflict between taking file path vs dataframe in func args.
@tobin-ford tobin-ford added documentation Improvements or additions to documentation enhancement New feature or request dependencies Pull requests that update a dependency file labels Jun 13, 2024
@codecov-commenter
Copy link

codecov-commenter commented Jun 13, 2024

Codecov Report

Attention: Patch coverage is 45.34884% with 564 lines in your changes missing coverage. Please review.

Project coverage is 62.83%. Comparing base (57cb222) to head (5e5d514).

Files Patch % Lines
pvdeg/scenario.py 31.38% 341 Missing ⚠️
pvdeg/geospatial.py 11.71% 113 Missing ⚠️
pvdeg/utilities.py 28.76% 104 Missing ⚠️
pvdeg/standards.py 71.42% 2 Missing ⚠️
pvdeg/temperature.py 96.77% 2 Missing ⚠️
pvdeg/degradation.py 94.44% 1 Missing ⚠️
pvdeg/weather.py 66.66% 1 Missing ⚠️
Additional details and impacted files
@@               Coverage Diff               @@
##           development      #97      +/-   ##
===============================================
- Coverage        67.02%   62.83%   -4.20%     
===============================================
  Files               29       30       +1     
  Lines             2111     3024     +913     
===============================================
+ Hits              1415     1900     +485     
- Misses             696     1124     +428     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@tobin-ford
Copy link
Collaborator Author

tobin-ford commented Jul 1, 2024

Not sure if we've run into this before @martin-springer

Pvlib=0.11.0 appears to be problematic.
As installed on a local environment with python=3.9.19 and numpy=2.0.0 it caused test_calc_injection_outdoors to fail. The test failes because the series values are similar to the saved values but slightly different. index=88 was NaN when it should not have been but a plot of the series reveals that the series are very similar anyways. This could just be an implementation change/update in the newer pvlib versions. This is caused by the effective irradiance from the modelchain instance being varying across these versions which is then used in the subsequent test calculation.
image
Orange are test calculated values and blue is stored test values.

When running with pvlib=0.10.3 and numpy=1.26.4 it will pass the test on python=3.9.19. This may be indicative of some other issues but we should restrict the github automations to using a working pvlib version.

Note: we could also upgrade the pvlib version and change the test check values.

Edit: Pvlib 0.11.0 released on June 21, 2024, which was after the last test passed on commit be577c2 (over 2 weeks ago) so if we are always using the most recent version we should apply the change i mentioned above ^

Edit: this appears to be the only test affected by the pvlib version so it would make sense to update the stored testing values rather than restricting ourselves to an older pvlib version.

@tobin-ford
Copy link
Collaborator Author

tobin-ford commented Jul 9, 2024

Dependency versioning issue again. This might be better as its own PR as it will affect all users with the newest scipy version.

scipy 1.14.0 changed the function signatures for many of the quadrature integration functions.

scipy < 1.14.0:
scipy.integrate.simpson(y, *, x=None, dx=1.0, axis=-1, even=<object object>)[source]

scipy 1.14.0
simpson(y, *, x=None, dx=1.0, axis=-1)[source]

Edit: My changes seem to have not propagated correctly during the testing. My branch is synced with the head and passes locally.

@tobin-ford tobin-ford mentioned this pull request Aug 1, 2024
@martin-springer martin-springer merged commit 645f895 into development Aug 13, 2024
5 checks passed
@tobin-ford tobin-ford deleted the dev_scenario_geospatial branch December 9, 2024 22:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants