You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ENH: geometric calculations for sunrise, sunset, and transit (#583)
* add analytical methods from Frank Vignola's book for sunrise, sunset, and sun transit times
* ENH: remove test data file for sunrise/sunset/transit
* use hardcoded values for 10-20 expected values
* remove DIRNAME, etc
* make stickler happy
* no rst markup in numpydoc parameters
* add references to duffie/beckman and Frank Vignola
* get pytz timezone info first so it's not weird
* add returns to docstring
* ENH: PERF: use numpy instead of loop to improve performance
* add one-liners to explain helpers
* remove import os from test
* ENH: use ducktyping to handle different versions of pandas
* if old pandas change tz directly, and hours is already a numpy array
* if new pandas then use tz_localize to strip tz, and change hours from
Float64Index to numpy array
* move operator to end to match existing style in pvlib
* ducktype hours if Float64index or not, convert datetime64[D] to ns before adding
* ENH: use "geometric" instead of "analytical"
* change name in solarposition.py and test_solarposition.py
* enforce that hours is a numpy array in _hours instead of in _times
* add more useful comments, separate into steps to explain process
* ENH: use more verbose, meaningful names for helpers _hours and _times
* change _hours to _hour_angle_to_hours
* change _times to _local_times_from_hours_since_midnite
* fix typos in warning circular orbit
* fix reference numbers
* clarify sign conventions for latitude and longitude
* remove EXPECTED_ANALYTICAL_SUNRISE_SUNSET_TRANSIT
* instead use a test pytest.fixture with a few dates like the ephem and
spa.c test
* stickler - missing whitespace after comma in list
* use np.asarray to ensure consistent return
* remove try-except, doesn't work anyway, wait for pandas >=0.15.0
* also remove utcoffset(), unreliable with pandas dataframes, only really
works with scalar datetimes and timestamps
* instead use tz_localise(None) to get naive, but still local time, and
subtract the localized time, to get a sequence of timezones
* reuse expected_rise_set_spa test fixture
* remove geometric expected sunrise/sunset/transite test fixture
* check abs tolerance between geometric and spa are less than max absolute
error difference which is typically 4-6 minutes for sunrise/sunset, and
about 10-40 seconds for transite
* move _times_to_hours to solarposition, and use the same approach as
other hour/time conversions, use pandas>= tz_localize(None) or normalize
to get the local, naive times, and time at previous midnight, then convert
to np.int64, and then convert to hours from nanoseconds
* since fixture is a dataframe, get column, convert to MST timezone, before
calling _times_to_hours(<pd.DatetimeIndex>)
* get times from expected_rise_set_spa.index
* get lat/lon from golden_mst test_fixture
* stickler
* ENH: update what's new and api.rst
* wrap long lines, link to issues
* add constant NS_PER_HR and substiture for (3600. * 1.e9)
* change arg name to hourangle avoid shadowing function hour_angle()
* fix spelling in _local_times_from_hours_since_midnight()
* use normalize() and astype(np.int64) instead of
naive_times.astype('datetime64[D]').astype('datetim64[ns]') and
midnight_times + (hours*NS_PER_HR).astype('timedelta64[ns]') for
stability and consistency with other hour/times conversion functions
* stickler - line break before operator
* group sunrise/sunset enhancements together, separate iotools
* change private func name to be more descriptive
* _times_to_hours -> _times_to_hours_after_local_midnight
* change corresponding usage in test_solarposition.py and wrap some
long lines
* in docstring specify that times should be localized to the timzeone
of the lat/lon args in hour_angle() and sunrise_sunset_transit_geometric()
* change arg in solar_azimuth_analytical() and solar_zenith_analytical()
from hour_angle -> hourangle to avoid shadowing func name hour_angle()
from outer scope and remove redundant parentheses from return
* TST: change name to test_sunrise_sunset_transit_geometric
* change description to say "geometric" vs. analytical
* improve description of _local_times_from_hours_since_midnight to be
more specific by adding "hours since midnight"
0 commit comments