8000 [DRAFT] Allow arbitrary IAM function in pvlib.iam.marion_diffuse by markcampanelli · Pull Request #2050 · pvlib/pvlib-python · GitHub
[go: up one dir, main page]

Skip to content

[DRAFT] Allow arbitrary IAM function in pvlib.iam.marion_diffuse #2050

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

Draft
wants to merge 36 commits into
base: main
Choose a base branch
from
Draft
Show file tree< 8000 /tool-tip>
Hide file tree
Changes from 1 commit
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
2a50a63
Add iam_pchip function and callable model for marion_diffuse
markcampanelli May 12, 2024
398a8ff
Tidy up
markcampanelli May 12, 2024
ed79db8
Appease flake8
markcampanelli May 12, 2024
d596e28
Pin flake8 to match github workflow
markcampanelli May 12, 2024
3e3f0d6
Tidy up more
markcampanelli May 12, 2024
f63a018
Improve test
markcampanelli May 12, 2024
bc519be
Only use pchip in tests
markcampanelli May 15, 2024
d97d077
flake8 ftw
markcampanelli May 15, 2024
c4c18d7
flake8 more ftw
markcampanelli May 15, 2024
8727b04
Remove unused lines in test
markcampanelli May 15, 2024
e726eed
Merge branch 'markcampanelli/main' into marion_diffuse_dep_inj
markcampanelli Jun 30, 2024
6322523
Update builtin models and models' parameters maps
markcampanelli Jun 30, 2024
fe7833b
Appease flake8
markcampanelli Jun 30, 2024
5d218d5
Appease flake8 more
markcampanelli Jun 30, 2024
bcc8429
Undo function moves
markcampanelli Jun 30, 2024
deb466e
Revert to better exception message
markcampanelli Jun 30, 2024
05319f3
Make iam_model required for ModelChain
markcampanelli Jul 1, 2024
dd8408f
Restore infer_aoi_model
markcampanelli Jul 1, 2024
1bd8f0d
Revert additional changes
markcampanelli Jul 1, 2024
0aff7c7
Address failing test and minimize diff
markcampanelli Jul 1, 2024
567374f
Get ModelChain codecov
markcampanelli Jul 1, 2024
e41621a
Add/improve test coverage
markcampanelli Jul 1, 2024
6a0d14d
Add docstring and cover bad model name
markcampanelli Jul 1, 2024
a580ec6
Appease flake8
markcampanelli Jul 1, 2024
2bb3fb6
Cover required params check
markcampanelli Jul 1, 2024
b6fe2bf
Minimize unrelated diff
markcampanelli Jul 1, 2024
2c0d11b
Test get_builtin_models
markcampanelli Jul 1, 2024
083c3c9
Improve comment
markcampanelli Jul 1, 2024
ce7577c
Remove spurious function
markcampanelli Jul 1, 2024
d49ee79
Merge branch 'main' into marion_diffuse_dep_inj
markcampanelli Dec 21, 2024
a037bae
Update modelchain docstrings
markcampanelli Dec 21, 2024
ec3790b
Make sapm iam function use common interface
markcampanelli Dec 21, 2024
0b4a91d
Appease flake8
markcampanelli Dec 21, 2024
c64e6b9
Harmonize IAM and spectral correction and update IAM inference
markcampanelli Dec 22, 2024
08ae199
Appease the linter
markcampanelli Dec 22, 2024
6e8421c
Fix spectral correction example
markcampanelli Dec 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Appease flake8
  • Loading branch information
markcampanelli committed Jun 30, 2024
commit fe7833b567ca15d640dfdbc9e4dc72acd92143f8
6 changes: 3 additions & 3 deletions pvlib/iam.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
def get_builtin_models():
"""Return a dictionary of all builtin IAM models."""

return {

Check warning on line 23 in pvlib/iam.py

View check run for this annotation

Codecov / codecov/patch

pvlib/iam.py#L23

Added line #L23 was not covered by tests
'ashrae': ashrae,
'interp': interp,
'martin_ruiz': martin_ruiz,
Expand All @@ -35,7 +35,7 @@
def get_builtin_direct_models():
"""Return a dictionary of all builtin direct IAM models."""

return {

Check warning on line 38 in pvlib/iam.py

View check run for this annotation

Codecov / codecov/patch

pvlib/iam.py#L38

Added line #L38 was not covered by tests
'ashrae': ashrae,
'interp': interp,
'martin_ruiz': martin_ruiz,
Expand Down Expand Up @@ -668,7 +668,7 @@
for Diffuse radiation on Inclined photovoltaic Surfaces (FEDIS)",
Renewable and Sustainable Energy Reviews, vol. 161, 112362. June 2022.
:doi:`10.1016/j.rser.2022.112362`

See Also
--------
pvlib.iam.ashrae
Expand Down Expand Up @@ -1036,8 +1036,8 @@

if passed_params != exp_params:
raise ValueError(
f"The {builtin_model_name} model was expecting to be passed {exp_params},"
f"but was handed {passed_params}"
f"The {builtin_model_name} model was expecting to be passed"
f"{exp_params}, but was handed {passed_params}"
)


Expand Down
21 changes: 11 additions & 10 deletions pvlib/modelchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ def _head(obj):
'\n')
lines = []
for attr in mc_attrs:
if not (attr.startswith('_') or attr=='times'):
if not (attr.startswith('_') or attr == 'times'):
lines.append(f' {attr}: ' + _mcr_repr(getattr(self, attr)))
desc4 = '\n'.join(lines)
return (desc1 + desc2 + desc3 + desc4)
Expand Down Expand Up @@ -386,7 +386,6 @@ def __init__(self, system, location,

self.results = ModelChainResult()


@classmethod
def with_pvwatts(cls, system, location,
clearsky_model='ineichen',
Expand Down Expand Up @@ -785,8 +784,9 @@ def aoi_model(self, model):
else:
self._aoi_model = partial(model, self)

# FIXME What about diffuse versions of models? What about schlick,
# schlick_diffuse, and custom models?

# FIXME What about diffuse versions of models? What about schlick and custom models?
def infer_aoi_model(self):
module_parameters = tuple(
array.module_parameters for array in self.system.arrays)
Expand All @@ -805,13 +805,14 @@ def infer_aoi_model(self):
elif iam_model_params['interp'] <= params:
return self.interp_aoi_loss

raise ValueError('could not infer AOI model from '
'system.arrays[i].module_parameters. Check that '
'the module_parameters for all Arrays in '
'system.arrays contain parameters for the '
'physical, aoi, ashrae, martin_ruiz or interp '
'model; explicitly set the model with the '
'aoi_model kwarg; or set aoi_model="no_loss".')
raise ValueError(
'could not infer AOI model from '
'system.arrays[i].module_parameters. Check that the '
'module_parameters for all Arrays in system.arrays contain '
'parameters for the physical, aoi, ashrae, martin_ruiz or interp '
'model; explicitly set the model with the aoi_model kwarg; or '
'set aoi_model="no_loss".'
)

def ashrae_aoi_loss(self):
self.results.aoi_modifier = self.system.get_iam(
Expand Down
Loading
0