Skip to content

Commit

Permalink
Replaced some more formatted strings...
Browse files Browse the repository at this point in the history
to work around the numba issue described here: numba/numba#3250
  • Loading branch information
gc56 committed Aug 9, 2019
1 parent 25825e0 commit 1e2ff6d
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions climate_indices/eto.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,8 @@ def _sunset_hour_angle(latitude_radians, solar_declination_radians):
# http://www.itacanet.org/the-sun-as-a-source-of-energy/part-1-solar-astronomy/
if (not _SOLAR_DECLINATION_RADIANS_MIN
<= solar_declination_radians <= _SOLAR_DECLINATION_RADIANS_MAX):
raise ValueError("solar declination angle outside "
f"valid range [{_SOLAR_DECLINATION_RADIANS_MIN!r} "
f"to {_SOLAR_DECLINATION_RADIANS_MAX!r}]: "
f"{solar_declination_radians!r}")
raise ValueError("solar declination angle outside valid range [{_SOLAR_DECLINATION_RADIANS_MIN!r} to {_SOLAR_DECLINATION_RADIANS_MAX!r}]:{solar_declination_radians!r}".format(
_SOLAR_DECLINATION_RADIANS_MIN, _SOLAR_DECLINATION_RADIANS_MAX, solar_declination_radians))

# calculate the cosine of the sunset hour angle (*Ws* in FAO 25)
# from latitude and solar declination
Expand Down Expand Up @@ -144,8 +142,7 @@ def _daylight_hours(sunset_hour_angle_radians):
# range of 0 to pi radians (180 degrees), inclusive
# see http://mypages.iit.edu/~maslanka/SolarGeo.pdf
if not 0.0 <= sunset_hour_angle_radians <= math.pi:
raise ValueError(f"sunset hour angle outside valid range [0.0 to {math.pi!r}]"
f": {sunset_hour_angle_radians!r}")
raise ValueError("sunset hour angle outside valid range [0.0 to {math.pi!r}]: {sunset_hour_angle_radians!r}".format(sunset_hour_angle_radians))

# calculate daylight hours from the sunset hour angle
return (24.0 / math.pi) * sunset_hour_angle_radians
Expand Down

0 comments on commit 1e2ff6d

Please sign in to comment.