NREL / PVDegradationTools

Set of tools to calculate degradation responses and degradation related parameters for PV.
https://pvdegradationtools.readthedocs.io/
Other
24 stars 6 forks source link

Dev_geospatial_templates - Autotemplating (new decorator and function) #101

Closed tobin-ford closed 1 month ago

tobin-ford commented 1 month ago

Describe your changes

Created an generalized autotemplating system for pvdeg functions. Remove the work of creating your own shapes/templates for geospatial analysis. Also updated the PR template to include a check box for autotemplating considerations with changes.

Adds a new module, decorators.py (not in init on purpose), containing a decorator to modify the attributes of functions so we can skip runtime introspection and go straight to the relevant attributes for creating a geospatial template using pvdeg.geospatial.autotemplate.

This is only meant to work on functions with strict return types. i.e. the function always returns the same type of values, such as

then the autotemplating decorator can be used. However, if the function return type is ambigious (it returns different types) based on the input, then autotemplating cannot be used.

Note: I named the decorator geospatial_return_type and it adds two attributes to a wrapped function, numeric_or_timeseries and shape_names. I'm not in love with the decorator name, or the first attribute name because it is a boolean. Name suggestions are welcome.

Type of change

Please delete options that are not relevant.

Checklist before requesting a review

codecov-commenter commented 1 month ago

Codecov Report

Attention: Patch coverage is 79.77528% with 18 lines in your changes missing coverage. Please review.

Project coverage is 68.78%. Comparing base (57cb222) to head (0dc5089).

Files Patch % Lines
pvdeg/geospatial.py 35.71% 18 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## development #101 +/- ## =============================================== + Coverage 67.02% 68.78% +1.75% =============================================== Files 29 31 +2 Lines 2111 2185 +74 =============================================== + Hits 1415 1503 +88 + Misses 696 682 -14 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.