-
Notifications
You must be signed in to change notification settings - Fork 1.1k
changed default types to float in solarposition.py #2280
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
Merged
Merged
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
70e0156
changed default types to float in solarposition.py
0ec0cbf
switched to floats in the docstrings and removed type hints
e33872b
Update pvlib/solarposition.py
kurt-rhee 5fe6df8
Update pvlib/solarposition.py
kurt-rhee 9c966f3
attempt to fix flake8 errors
bcf8b73
Apply suggestions from code review
kandersolar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -30,7 +30,7 @@ | |
| def get_solarposition(time, latitude, longitude, | ||
| altitude=None, pressure=None, | ||
| method='nrel_numpy', | ||
| temperature=12, **kwargs): | ||
| temperature=12.0, **kwargs): | ||
| """ | ||
| A convenience wrapper for the solar position calculators. | ||
|
|
||
|
|
@@ -125,8 +125,8 @@ def get_solarposition(time, latitude, longitude, | |
| return ephem_df | ||
|
|
||
|
|
||
| def spa_c(time, latitude, longitude, pressure=101325, altitude=0, | ||
| temperature=12, delta_t=67.0, | ||
| def spa_c(time, latitude, longitude, pressure=101325., altitude=0., | ||
| temperature=12., delta_t=67.0, | ||
| raw_spa_output=False): | ||
| r""" | ||
| Calculate the solar position using the C implementation of the NREL | ||
|
|
@@ -149,11 +149,11 @@ def spa_c(time, latitude, longitude, pressure=101325, altitude=0, | |
| longitude : float | ||
| Longitude in decimal degrees. Positive east of prime meridian, | ||
| negative to west. | ||
| pressure : float, default 101325 | ||
| pressure : float, default 101325.0 | ||
| Pressure in Pascals | ||
| altitude : float, default 0 | ||
| altitude : float, default 0.0 | ||
| Height above sea level. [m] | ||
| temperature : float, default 12 | ||
| temperature : float, default 12.0 | ||
| Temperature in C | ||
| delta_t : float, default 67.0 | ||
| Difference between terrestrial time and UT1. | ||
|
|
@@ -279,7 +279,7 @@ def _datetime_to_unixtime(dtindex): | |
|
|
||
|
|
||
| def spa_python(time, latitude, longitude, | ||
| altitude=0, pressure=101325, temperature=12, delta_t=67.0, | ||
| altitude=0., pressure=101325., temperature=12., delta_t=67.0, | ||
| atmos_refract=None, how='numpy', numthreads=4): | ||
| """ | ||
| Calculate the solar position using a python implementation of the | ||
|
|
@@ -302,11 +302,11 @@ def spa_python(time, latitude, longitude, | |
| longitude : float | ||
| Longitude in decimal degrees. Positive east of prime meridian, | ||
| negative to west. | ||
| altitude : float, default 0 | ||
| altitude : float, default 0.0 | ||
| Distance above sea level. | ||
| pressure : int or float, optional, default 101325 | ||
| pressure : int or float, optional, default 101325.0 | ||
| avg. yearly air pressure in Pascals. | ||
| temperature : int or float, optional, default 12 | ||
| temperature : int or float, optional, default 12.0 | ||
| avg. yearly air temperature in degrees C. | ||
| delta_t : float or array, optional, default 67.0 | ||
| Difference between terrestrial time and UT1. | ||
|
|
@@ -507,9 +507,9 @@ def _ephem_setup(latitude, longitude, altitude, pressure, temperature, | |
|
|
||
| def sun_rise_set_transit_ephem(times, latitude, longitude, | ||
| next_or_previous='next', | ||
| altitude=0, | ||
| pressure=101325, | ||
| temperature=12, horizon='0:00'): | ||
| altitude=0., | ||
| pressure=101325., | ||
| temperature=12., horizon='0:00'): | ||
| """ | ||
| Calculate the next sunrise and sunset times using the PyEphem package. | ||
|
|
||
|
|
@@ -523,11 +523,11 @@ def sun_rise_set_transit_ephem(times, latitude, longitude, | |
| Longitude in degrees, positive east of prime meridian, negative to west | ||
| next_or_previous : str | ||
| 'next' or 'previous' sunrise and sunset relative to time | ||
| altitude : float, default 0 | ||
| altitude : float, default 0.0 | ||
| distance above sea level in meters. | ||
| pressure : int or float, optional, default 101325 | ||
| pressure : int or float, optional, default 101325.0 | ||
| air pressure in Pascals. | ||
| temperature : int or float, optional, default 12 | ||
| temperature : int or float, optional, default 12.0 | ||
| air temperature in degrees C. | ||
| horizon : string, format +/-X:YY | ||
| arc degrees:arc minutes from geometrical horizon for sunrise and | ||
|
|
@@ -590,8 +590,8 @@ def sun_rise_set_transit_ephem(times, latitude, longitude, | |
| 'transit': trans}) | ||
|
|
||
|
|
||
| def pyephem(time, latitude, longitude, altitude=0, pressure=101325, | ||
| temperature=12, horizon='+0:00'): | ||
| def pyephem(time, latitude, longitude, altitude=0., pressure=101325., | ||
| temperature=12., horizon='+0:00'): | ||
| """ | ||
| Calculate the solar position using the PyEphem package. | ||
|
|
||
|
|
@@ -605,11 +605,11 @@ def pyephem(time, latitude, longitude, altitude=0, pressure=101325, | |
| longitude : float | ||
| Longitude in decimal degrees. Positive east of prime meridian, | ||
| negative to west. | ||
| altitude : float, default 0 | ||
| altitude : float, default 0.0 | ||
| Height above sea level in meters. [m] | ||
| pressure : int or float, optional, default 101325 | ||
| pressure : int or float, optional, default 101325.0 | ||
| air pressure in Pascals. | ||
| temperature : int or float, optional, default 12 | ||
| temperature : int or float, optional, default 12.0 | ||
| air temperature in degrees C. | ||
| horizon : string, optional, default '+0:00' | ||
| arc degrees:arc minutes from geometrical horizon for sunrise and | ||
|
|
@@ -679,7 +679,7 @@ def pyephem(time, latitude, longitude, altitude=0, pressure=101325, | |
| return sun_coords | ||
|
|
||
|
|
||
| def ephemeris(time, latitude, longitude, pressure=101325, temperature=12): | ||
| def ephemeris(time, latitude, longitude, pressure=101325.0, temperature=12.0): | ||
| """ | ||
| Python-native solar position calculator. | ||
| The accuracy of this code is not guaranteed. | ||
|
|
@@ -695,9 +695,9 @@ def ephemeris(time, latitude, longitude, pressure=101325, temperature=12): | |
| longitude : float | ||
| Longitude in decimal degrees. Positive east of prime meridian, | ||
| negative to west. | ||
| pressure : float or Series, default 101325 | ||
| pressure : float or Series, default 101325.0 | ||
| Ambient pressure (Pascals) | ||
| temperature : float or Series, default 12 | ||
| temperature : float or Series, default 12.0 | ||
| Ambient temperature (C) | ||
|
|
||
| Returns | ||
|
|
@@ -856,8 +856,8 @@ def ephemeris(time, latitude, longitude, pressure=101325, temperature=12): | |
|
|
||
|
|
||
| def calc_time(lower_bound, upper_bound, latitude, longitude, attribute, value, | ||
| altitude=0, pressure=101325, temperature=12, horizon='+0:00', | ||
| xtol=1.0e-12): | ||
| altitude=0.0, pressure=101325.0, temperature=12.0, | ||
| horizon='+0:00', xtol=1.0e-12): | ||
| """ | ||
| Calculate the time between lower_bound and upper_bound | ||
| where the attribute is equal to value. Uses PyEphem for | ||
|
|
@@ -879,12 +879,12 @@ def calc_time(lower_bound, upper_bound, latitude, longitude, attribute, value, | |
| and 'az' (which must be given in radians). | ||
| value : int or float | ||
| The value of the attribute to solve for | ||
| altitude : float, default 0 | ||
| altitude : float, default 0.0 | ||
| Distance above sea level. | ||
| pressure : int or float, optional, default 101325 | ||
| pressure : int or float, optional, default 101325.0 | ||
| Air pressure in Pascals. Set to 0 for no | ||
| atmospheric correction. | ||
| temperature : int or float, optional, default 12 | ||
| temperature : int or float, optional, default 12.0 | ||
| Air temperature in degrees C. | ||
| horizon : string, optional, default '+0:00' | ||
| arc degrees:arc minutes from geometrical horizon for sunrise and | ||
|
|
@@ -1052,7 +1052,9 @@ def equation_of_time_spencer71(dayofyear): | |
| Myers [4]_ and printed in both the Fourier paper from the Sundial | ||
| Mailing List and R. Hulstrom's [5]_ book. | ||
|
|
||
| .. _Fourier paper: http://www.mail-archive.com/[email protected]/msg01050.html | ||
| .. `Fourier paper: | ||
| <http://www.mail-archive.com/ | ||
| [email protected]/msg01050.html>`_ | ||
|
|
||
| Parameters | ||
| ---------- | ||
|
|
@@ -1100,7 +1102,8 @@ def equation_of_time_pvcdrom(dayofyear): | |
| `PVCDROM`_ is a website by Solar Power Lab at Arizona State | ||
| University (ASU) | ||
|
|
||
| .. _PVCDROM: http://www.pveducation.org/pvcdrom/2-properties-sunlight/solar-time | ||
| .. `PVCDROM: <http://www.pveducation.org/ | ||
| pvcdrom/2-properties-sunlight/solar-time>`_ | ||
kandersolar marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| Parameters | ||
| ---------- | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.