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

Drop python 3.6; add python 3.10; update requirements-min #302

Merged
merged 57 commits into from Jan 6, 2022
Merged

Conversation

kandersolar
Copy link
Member

@kandersolar kandersolar commented Nov 30, 2021

  • Code changes are covered by tests
  • Code changes have been evaluated for compatibility/integration with TrendAnalysis
  • 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
  • Updated changelog

See #299. scikit-learn is the only dependency without python 3.10 wheels, but the CI passes anyway because it manages to build it from source. Still, I suggest waiting for them to release 3.10 wheels on PyPI so that we can use the new version (likely 1.0.2) in requirements.txt. According to scikit-learn/scikit-learn#21882 this might happen as soon as mid December.

mdeceglie and others added 30 commits November 20, 2020 16:03
* Add normalized_filter() function to replace the mannual filter in example

* Initial working system analysis class

* system analysis version that reproduces notebook results

Works for both sensor and clearsky workflows

* Improve underlying analysis

These improvements slightly change the clearsky results relative to the existing version of the notebook.

* Allow poa, temperature, and temperature_coefficient to be None

This leaves room for BYO modeled PV perofmrance in the future

* Add system_analysis to rdtools namespace

* Basic example of system_analysis() use

* Update degradation_and_soiling_example.ipynb

1) Use apparent zenith in irradiance calculations instead of zenith
2) Apply clearsky filter based on poa irradiance rather than insolation
3) Include ground diffuse in irradiance transposition calculations

* Update system_analysis_example notebook

Update notes and change initial poa calculation to include ground diffuse

* Add a plotting module

* Update notebook to use plotting module

* Add plotting methods

* update system_analysis example notebook

* add docstrings

* Delete model chain dev notes

* add matplotlib to setup.py and update requirements

* change matplotlib version

* Move docstring to class

* renormalization bug fix

* Update temperature input interface

(Also fix merge bug in plotting)

* update docstring for new temperature interface

* Remove __init__ docstring

* update class name to CamelCase

* update kwarg explanatations in docstrings

* remove model parameter from calc_clearsky_poa()

It is still addressable through kwargs passed to pvlib

* Update SystemAnalysis_example.ipynb

* Reformat dosctrings to numpy style

* command style docstrings

* Remove duplicate line

* Update plotting docstrings to numpy style

* Format normalized_filter docstring according to numpy style

Other docstrings in this module have been updated in #125

* Add an ad hoc filter example to the notebook

* Fixes system_analysis bug #132 when pv_nameplate is passed into syste… (#133)

* Fixes system_analysis bug #132 when pv_nameplate is passed into system_analysis object.

* typo fix

Co-Authored-By: Kevin Anderson <57452607+kanderso-nrel@users.noreply.github.com>

* add bins parameter to plotting.degradation_summary_plot from #132

(cherry picked from commit efcbe2e)

# Conflicts:
#	rdtools/plotting.py

* plotting bug fix

* Drop py2.7 and add 3.7 and 3.8 to testing (#135)

* Drop 2.7 and add 3.7 and 3.8 to testing, update docs.

* creating DatetimeIndex directly is deprecated, switch to pd.date_range

* require pandas < 1.0.0

* bump requirements.txt numpy to 1.17.3 for testing on py3.8

* more requirements.txt updates for py3.8 wheel availability

* Update v2.0.0.rst

* add matplotlib to requirements

* matplotlib 3.1

* matplotlib

* merge pytests and jupyter example

* PVLib > 0.7 changes to cell_temp calculation

* Modelchain pytests (#196)

* pytests for system_analysis.  coverage: 91%. 

* rename system_analysis.py to analysis.py. Rename class to RdAnalysis. Update pvwatts_kws to match Master updates

* Allow temp_model_params to either be string or dict with 'a','b', 'deltaT' keys

* update calc_cell_temperature for pvlib > 0.6.3, use energy_normalized in normalize_with_pvwatts

* Warn if temp coefficient not passed into normalize_with_Pvwatts instead of exit with error.

* Add tables=3.6.1 to requirements.txt to allow clearsky analysis

* add tables to setup.py since it appears to be a required pvlib for the clearsky workflow and not installed by default.

* Add RdAnalysis notebook for pvdaq4 system

* add max_timedelta=15T and clearsky poa calculation update to pvdaq4 standard notebook example

* Sphinx release notes for 2.1.0 updated and API update

Co-authored-by: Michael Deceglie <mdeceglie@users.noreply.github.com>
Co-authored-by: Kevin Anderson <57452607+kanderso-nrel@users.noreply.github.com>

* Update tests, include tables in setup.py

* suppress import warnings for soiling module.

* Change warning suppression from warnings.resetwarnings to with warnings.catch_warnings().
Re-run notebooks

* Model chains exp energy (#232)

* enable normalize_with_expected_energy. 

* Update RdAnalysis_example.ipynb with manually defined power_expected option.

* Add post-filter error check for < 2 yrs data per kanderson

* Remove error message for no thermal model if power_expected is passed in.

* remove tcell_filter from filter list if power_expected is passed in but not cell_temperature

* pep8 compliance

* more robust frequency check

* shorten long lines

* Model chains set clearsky (#233)

* Move CS inputs to new set_clearsky function: pvlib_location ,pv_tilt, pv_azimuth, clearsky_poa, clearsky temp, albedo

* Explicit error message if set_clearsky not run prior to clearsky_analysis.

* remove Py2.7 check in block 3 of RdAnalysis_example.ipynb

* boost analysis.py test coverage to 94%

* add pv_energy pytest case. Change to ValueError rather than basic Exception when set_clearsky hasn't been run.

Co-authored-by: Kevin Anderson <57452607+kanderso-nrel@users.noreply.github.com>

* improve index equality conditional

* pep8 cleanup

* change dict key syntax

* Clarify behavior when pv_nameplate is omitted

* Useful errors for plotting methods

* update requreiments for tables

* reduce minimum version of tables

* Delete RdAnalysis_example.ipynb

* Remove max_timedelta parameter use in PVDAQ example

* Move sun position calculation to clearsky section of example

This brings the clearsky results into better allignement with the objected oriented example, now sun position is calculated after interpolation on both

* Update chage log version number

* Allow warning for experimental modules

* pep8 analysis_test.py

* Change module and class names

* Update example with new module/class name

* Fix outdated ref to system_analysis

* Update api.rst with analysis chains module name

* Fix changelog underline length

* update index.rst with TrendAnalysis info

* poa -> poa_global

* cell_temperature -> temperature_cell

* ambient_temperature->temperature_ambient

* temperature_coefficient->gamma_pdc

* temperature_model docstring

* pv_nameplate->power_dc_rated

* clearsky_poa->poa_global_clearsky

* clearsky_temperature_cell->temperature_cell_clearsky

* clearsky_temperature_ambient->temperature_ambient_clearsky

* Align yoy and srr parameters with functional API

* Use `case` in plotting methods

* Change notebook kernel

* weakly privatize some methods

* Update rdtools/analysis_chains.py

Co-authored-by: Kevin Anderson <57452607+kanderso-nrel@users.noreply.github.com>

* Interpolate windspeed

* Update rdtools/analysis_chains.py

Co-authored-by: Kevin Anderson <57452607+kanderso-nrel@users.noreply.github.com>

* implement review suggestions

* more TrendAnalysis tests to improve coverage

* cleanup

* Fix copy/paste error in notebook

* change _calc_cell_temeprature parameter order

* More elegant error if filtering results in empty series

* Changelog consolidation

* change log update

Co-authored-by: cdeline <chris.deline@nrel.gov>
Co-authored-by: Kevin Anderson <57452607+kanderso-nrel@users.noreply.github.com>
Co-authored-by: Kevin Anderson <kevin.anderson@nrel.gov>
* parameters -> params

* changelog
* Remove consecutive cleaning filter

* Change day_scale default to 13 and raise warning for even values

* Update soiling tests

* Run notebooks

* Update changelog

* changelog adjustment

* Update rdtools/soiling.py

Co-authored-by: Kevin Anderson <57452607+kanderso-nrel@users.noreply.github.com>

* keep invalid intervals at beginning and end

* Revert "keep invalid intervals at beginning and end"

This reverts commit b3f5efc.

* keep invalid intervals at beginning abd end

This revision properly hanldes the trim option

* Handle consecutive invalid intervals correctly for random_clean

* Remove outdated comment

* Adjust trend_analysis soiling test

* Add a warning for >20% invalid data and random cleaning assumptions

* Run notebooks

degradation_and_soiling_example.ipynb exhibits a small change in the clearsky degradation results attributed to changes in random number generator state from soiling workflow changes

* patch test

* Add outlier factor to adjust cleaning detection sensitivity

* fix flake8 errors

* Add a test for outlier_factor

* add outlier_factor to change log

* add #234 to change log

* Add invalid interval retention at start and end to change log

* Clean up review suggestions

* add references to #272

* fix line length

* parametrize some tests

* update changelog

* Update the notebooks

Only some warnings changed slightly

* change min_interval_length default from 2 to 7

* fix line length

* Add Matt to the change log contributors

Co-authored-by: Kevin Anderson <57452607+kanderso-nrel@users.noreply.github.com>
* Revise NaN pixel handling in clearsky_temperature.py. Raise specific warning.  Fixes #120

* Changelog update

* rewrite cs tamb test in pytest style

* add test for not-on-land

Co-authored-by: Kevin Anderson <kevin.anderson@nrel.gov>
* suppress experimental module warnings

* close figs to avoid pyplot warning

* use odd day_scale value

* don't use deprecated check_less_precise

* prevent pandas warning about average of non-numeric types

* soiling warnings

* interpolation warning

* add notes

* cleaner suppression for soiling warning

* revert unnecessary changes
* bump numpy version to handle windows compat issue

* bump pygments and jinja2 using dependabot reccs

* add missing indirect dependencies to requirements.txt

* add missing indirect dependencies to notebook_requirements.txt

* changelog

* partially un-bump numpy

* update nbsphinx version in setup.py

spatialaudio/nbsphinx#563

Co-authored-by: Michael Deceglie <Michael.Deceglie@nrel.gov>
* add intersphinx so that type links work

[Sphinx intersphinx](https://www.sphinx-doc.org/en/master/usage/extensions/intersphinx.html) is not added by default, it must be enabled and configured. Added links for:
* python
* numpy
* pandas
* scipy

this will create links for types like `float`, `dict`, _etc_. and `pandas.DataFrame`, `numpy.ndarray`, _etc_.

* remove trailing single quote in doc confs

Co-authored-by: Michael Deceglie <mdeceglie@users.noreply.github.com>

* add pvlib intersphinx

* addresses #241

* add mpl intersphinx url

* fix up docstring types

* more type fixes

* python 3.8 -> python 3

* changelog

* make soiling docstrings more consistent

* fix indents in soiling docstrings

* fix unexpected indent

* Get the bulleted lists working in sphinx

* attempt to get tuple type link working

* Attempt to get type links working on TrendAnalysis

* Fix trailing whitespace

* type link adjustments

* change from datetime to pandas timedelta in TrenAnalysis docs

* Couple more link type adjustments

* add type aliases

* remove numpy.array

Co-authored-by: Michael Deceglie <mdeceglie@users.noreply.github.com>
Co-authored-by: Kevin Anderson <kevin.anderson@nrel.gov>
Co-authored-by: Kevin Anderson <57452607+kanderso-nrel@users.noreply.github.com>
Co-authored-by: Michael Deceglie <Michael.Deceglie@nrel.gov>
* add attributes

* test

* changelog

* unrelated linting

* bug fixes

* remove unnecessary default filter, test

* fix up index union funny business

* preliminary fix for #266

* add test to cover new warnings

* improve warning messages

* expand tests

* delete extra blank line

Co-authored-by: Michael Deceglie <mdeceglie@users.noreply.github.com>
Co-authored-by: Michael Deceglie <Michael.Deceglie@nrel.gov>
* remove empty line in pending.rst

* use pd.infer_freq instead of checking index.freq directly

* add test

* add test for other warnings/errors too, for coverage
* Interpolate things onto pv index

* add test for interpolation behavior

* Update rdtools/test/analysis_chains_test.py

Co-authored-by: Kevin Anderson <57452607+kanderso-nrel@users.noreply.github.com>

* Test set_clearsky interpolation

* consolidate dummy series in test

Co-authored-by: Kevin Anderson <57452607+kanderso-nrel@users.noreply.github.com>
* add 'usage_of_points' calculation to degradation.py.  Seems to work ok now..

* usage of points pytest

* add 'usage_of_points' to rd_result output

* plotting function update add 'detailed' option, = False by default

* PEP8 updates

* streamline color selector with map instead of apply

* add detailed=True kwarg to test_degradation_summary_plots_kwargs

* Update plotting docstring. Add changelog entry.

Co-authored-by: Kevin Anderson <kevin.anderson@nrel.gov>
Co-authored-by: Michael Deceglie <Michael.Deceglie@nrel.gov>
Update TrendAnalysis notebook to avoid filter index mismatch warning
* dedent non-pv inputs

* dedent clearsky inputs as well

* add basic test
assert len(w) == 2
assert_warnings(['The logic-based filter is an experimental',
'Function expects timestamps in local time'],
record)
Copy link
Member Author

Choose a reason for hiding this comment

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

These warning changes aren't related to py 3.10 or 3.6. It's just because testing the number of emitted warnings is rather brittle and failed on the new 3.10 test because of some unrelated warning from an indirect dependency. Normally I'd use pytest.warns to check the specific warning message text, but I don't think it has a way to check for multiple warnings like we need to do here. Thus the new function assert_warnings in conftest.py.

Copy link
Member Author

@kandersolar kandersolar left a comment

Choose a reason for hiding this comment

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

@mdeceglie I think this is ready for you to take a look whenever is convenient

@kandersolar kandersolar marked this pull request as ready for review December 27, 2021 18:34
@@ -0,0 +1,42 @@
************************
Copy link
Collaborator

Choose a reason for hiding this comment

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

For previous releases, we have included a "testing" section. Is one warranted here?

@@ -395,18 +395,19 @@ def availability_summary_plots(power_system, power_subsystem, loss_total,
ax3 = fig.add_subplot(gs[2, 0], sharex=ax1)
ax4 = fig.add_subplot(gs[:, 1], sharex=ax1)

# inverter power
power_system.plot(ax=ax1)
ax1.set_ylabel('Inverter Power [kW]')
# meter power
Copy link
Collaborator

Choose a reason for hiding this comment

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

At the risk of nitpicking, should this comment be "inverter power"?

Copy link
Member Author

Choose a reason for hiding this comment

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

no, but the one a few lines down should be. d'oh

@mdeceglie mdeceglie changed the base branch from development to master January 6, 2022 22:18
@mdeceglie
Copy link
Collaborator

For some reason after I changed the base to master 3.6 tests are showing up as pending, but we aren't supposed to be testing on 3.6 anymore. I'll merge it and hope for the best.

@mdeceglie mdeceglie merged commit 0749090 into master Jan 6, 2022
@mdeceglie mdeceglie deleted the py310 branch January 6, 2022 22:29
@mdeceglie mdeceglie mentioned this pull request Feb 9, 2022
2 tasks
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

5 participants