Skip to content

Conversation

@martin-springer
Copy link
Collaborator

@martin-springer martin-springer commented Nov 6, 2024

  • 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

nmoyer and others added 30 commits June 24, 2024 11:57
…tio and fit multiple soiling rates per soiling interval (piecewise)) as well as CODS algorithm being added
Signed-off-by: nmoyer <noah.moyer@nrel.gov>
Move SRR and CODS development branch from noromo01 to rdtools repo
"max_neg_step": min(run.delta),
"start_loss": 1,
"inferred_start_loss": run.pi_norm.median(), # changed from mean/Matt
"inferred_end_loss": run.pi_norm.median(), # changed from mean/Matt
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@mdeceglie - This change from .mean() to .median() seems to cause the RuntimeWarning:Mean of empty slice.
Seems counterintuitive but changing it back to mean get's rid of the warning...

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We could add a check whether pi_norm is empty.
Also, I'm not sure why "inferred_start_loss" and "inferred_end_loss" are the same here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm adding the following condition for now. If there's a better way , we can change it:

"inferred_start_loss": np.nan if run.pi_norm.isna().any() else run.pi_norm.median(), # changed from mean/Matt "inferred_end_loss": np.nan if run.pi_norm.isna().any() else run.pi_norm.median(), # changed from mean/Matt

mdeceglie and others added 3 commits January 22, 2025 17:42
Bumps [notebook](https://github.com/jupyter/notebook) from 7.2.1 to 7.2.2.
- [Release notes](https://github.com/jupyter/notebook/releases)
- [Changelog](https://github.com/jupyter/notebook/blob/@jupyter-notebook/tree@7.2.2/CHANGELOG.md)
- [Commits](https://github.com/jupyter/notebook/compare/@jupyter-notebook/tree@7.2.1...@jupyter-notebook/tree@7.2.2)

---
updated-dependencies:
- dependency-name: notebook
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Bump notebook from 7.2.1 to 7.2.2 in /docs
@mdeceglie mdeceglie requested a review from Copilot April 23, 2025 18:25
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request updates the soiling algorithm by modifying dependencies, adding new testing fixtures, and refining plotting functions.

  • Updated nbval dependency and CLI flag for compatibility with the latest version
  • Introduced two new test fixtures for soiling normalization variations
  • Revised plotting functions to remove runtime warnings and standardize docstrings

Reviewed Changes

Copilot reviewed 11 out of 12 changed files in this pull request and generated no comments.

File Description
setup.py Removed the nbval version constraint, potentially affecting bug workarounds
rdtools/test/conftest.py Added new fixtures for simulating soiling normalization with negative shifts and piecewise slopes
rdtools/plotting.py Standardized docstrings and removed experimental warnings from plotting functions
.github/workflows/nbval.yaml Updated the nbval CLI flag to match the new version's requirements
Files not reviewed (1)
  • docs/sphinx/source/changelog/v3.0.0-beta.0.rst: Language not supported
Comments suppressed due to low confidence (2)

setup.py:39

  • The removal of the nbval version constraint may reintroduce the semicolon bug noted in earlier versions. Confirm that the currently used nbval version resolves that issue.
    "nbval",

.github/workflows/nbval.yaml:32

  • Ensure that the new CLI flag '--nbval-sanitize-with' is supported by the nbval version in use and functions as expected compared to the previous '--sanitize-with' flag.
        pytest --nbval --nbval-sanitize-with docs/nbval_sanitization_rules.cfg docs/${{ matrix.notebook-file }}

Bumps [tornado](https://github.com/tornadoweb/tornado) from 6.4.2 to 6.5.1.
- [Changelog](https://github.com/tornadoweb/tornado/blob/master/docs/releases.rst)
- [Commits](tornadoweb/tornado@v6.4.2...v6.5.1)

---
updated-dependencies:
- dependency-name: tornado
  dependency-version: 6.5.1
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Copy link
Collaborator

@mdeceglie mdeceglie left a comment

Choose a reason for hiding this comment

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

Many minor comments, but my biggest point of discussion is how the the values for the new parameters neg_shift and picewise can be combined and how those combos can be combined with the new _complex cleaning options.

Must neg_shift and picewise always be turned on together? If not, how should the cleaning assumptions behave? If so, perhaps we can combine them into a single parameter.

Ideally I'd like to remove the _complex versions of the cleaning assumptions and instead have the existing versions check the values of neg_shift and piecewise and adjust their logic appropriately,

After addressing all this we should give the docs a once over to ensure everything appears the way we want.

The soiling module is currently experimental. The API, results,
and default behaviors may change in future releases (including MINOR
and PATCH releases) as the code matures.
'''
from rdtools import degradation as RdToolsDeg
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's change this to from rdtools import degradation and make the associated changes throughout

raise ValueError('Daily insolation series must have '
'daily frequency')
if pd.infer_freq(self.insolation_daily.index) != "D":
raise ValueError("Daily insolation series must have " "daily frequency")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
raise ValueError("Daily insolation series must have " "daily frequency")
raise ValueError("Daily insolation series must have daily frequency")

outlier_factor=1.5):
'''
if pd.infer_freq(self.precipitation_daily.index) != "D":
raise ValueError("Precipitation series must have " "daily frequency")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
raise ValueError("Precipitation series must have " "daily frequency")
raise ValueError("Precipitation series must have daily frequency")

raise ValueError('Daily performance metric series must have '
'daily frequency')
if pd.infer_freq(self.pm.index) != "D":
raise ValueError("Daily performance metric series must have " "daily frequency")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
raise ValueError("Daily performance metric series must have " "daily frequency")
raise ValueError("Daily performance metric series must have daily frequency")

Comment on lines +2881 to +2883
###############################################################################
# all code below for new piecewise fitting in soiling intervals within srr/Matt
###############################################################################
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this comment can be deleted

Comment on lines +77 to +78
("perfect_clean_complex", True, True, 0.977116),
("inferred_clean_complex", True, True, 0.975805)])
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can perfect_clean_complex and inferred_clean_complex be used with neg_shift OR piecewise? Or do both neg_shift and picewise have to be True together? If not, we should test update the doc strings in soiling.py to say "or", and augment the the test matrix to mix and match.

Comment on lines +161 to +162
("perfect_clean_complex", True, True, 0.966912),
("inferred_clean_complex", True, True, 0.965565)])
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same questions as above regarding mixing and matching piecewise and neg_shift

'''
#######################################################################
# add neg_shift and piecewise to the following def/Matt
def run(self, reps=1000, day_scale=13, clean_threshold="infer", trim=False,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's consider what defaults we want (also for soiling_srr(), which should be aligned with the run method). Should we activate some of the new functionality by default?

Comment on lines +1043 to +1067
method : str, {'half_norm_clean', 'random_clean', 'perfect_clean',
perfect_clean_complex,inferred_clean_complex} \
default 'half_norm_clean'

How to treat the recovery of each cleaning event

* 'random_clean' - a random recovery between 0-100%
* 'random_clean' - a random recovery between 0-100%,
pair with piecewise=False and neg_shift=False
* 'perfect_clean' - each cleaning event returns the performance
metric to 1
metric to 1,
pair with piecewise=False and neg_shift=False
* 'half_norm_clean' - The starting point of each interval is taken
randomly from a half normal distribution with its mode (mu) at 1 and
its sigma equal to 1/3 * (1-b) where b is the intercept of the fit to
the interval.
the interval,
pair with piecewise=False and neg_shift=False
*'perfect_clean_complex' - each detected clean event returns the
performance metric to 1 while negative shifts in the data or
piecewise linear fits result in no cleaning,
pair with piecewise=True and neg_shift=True
*'inferred_clean_complex' - at each detected clean event the
performance metric increases based on fits to the data while
negative shifts in the data or piecewise linear fits result in no
cleaning,
pair with piecewise=True and neg_shift=True
Copy link
Collaborator

Choose a reason for hiding this comment

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

The updated doc string is not rendering correctly on read the docs

Comment on lines +834 to +858
method : str, {'half_norm_clean', 'random_clean', 'perfect_clean',
perfect_clean_complex,inferred_clean_complex} \
default 'perfect_clean_complex'

How to treat the recovery of each cleaning event

* 'random_clean' - a random recovery between 0-100%
* 'random_clean' - a random recovery between 0-100%,
pair with piecewise=False and neg_shift=False
* 'perfect_clean' - each cleaning event returns the performance
metric to 1
metric to 1,
pair with piecewise=False and neg_shift=False
* 'half_norm_clean' - The starting point of each interval is taken
randomly from a half normal distribution with its mode (mu) at 1 and
its sigma equal to 1/3 * (1-b) where b is the intercept of the fit to
the interval.
the interval,
pair with piecewise=False and neg_shift=False
* 'perfect_clean_complex' - each detected clean event returns the
performance metric to 1 while negative shifts in the data or
piecewise linear fits result in no cleaning,
pair with piecewise=True and neg_shift=True
* 'inferred_clean_complex' - at each detected clean event the
performance metric increases based on fits to the data while
negative shifts in the data or piecewise linear fits result in no
cleaning,
pair with piecewise=True and neg_shift=True
Copy link
Collaborator

Choose a reason for hiding this comment

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

Updated doc string not appearing correctly in read the docs

cdeline and others added 16 commits June 23, 2025 15:47
statsmodels 0.14.4 is not able to handle the latest scipy.
Bumps [jinja2](https://github.com/pallets/jinja) from 3.1.5 to 3.1.6.
- [Release notes](https://github.com/pallets/jinja/releases)
- [Changelog](https://github.com/pallets/jinja/blob/main/CHANGES.rst)
- [Commits](pallets/jinja@3.1.5...3.1.6)

---
updated-dependencies:
- dependency-name: jinja2
  dependency-version: 3.1.6
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Bumps [requests](https://github.com/psf/requests) from 2.32.3 to 2.32.4.
- [Release notes](https://github.com/psf/requests/releases)
- [Changelog](https://github.com/psf/requests/blob/main/HISTORY.md)
- [Commits](psf/requests@v2.32.3...v2.32.4)

---
updated-dependencies:
- dependency-name: requests
  dependency-version: 2.32.4
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Bumps [urllib3](https://github.com/urllib3/urllib3) from 2.2.2 to 2.5.0.
- [Release notes](https://github.com/urllib3/urllib3/releases)
- [Changelog](https://github.com/urllib3/urllib3/blob/main/CHANGES.rst)
- [Commits](urllib3/urllib3@2.2.2...2.5.0)

---
updated-dependencies:
- dependency-name: urllib3
  dependency-version: 2.5.0
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Bump jinja2 from 3.1.5 to 3.1.6 in /docs
remove scipy restrictions in setup.py now that statsmodels has a new release.
Bump tornado from 6.4.2 to 6.5.1 in /docs
@cdeline
Copy link
Collaborator

cdeline commented Sep 16, 2025

I'm merging the new RdTools 3.0.1 release into this branch and development to bring it up to speed

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.

5 participants