ecoscope.analysis.astronomy =========================== .. py:module:: ecoscope.analysis.astronomy Module Contents --------------- .. py:data:: DEFAULT_IS_NIGHT_TIME_RESOLUTION .. py:function:: to_EarthLocation(geometry) Location on Earth, initialized from geocentric coordinates. :param geometry: GeoDataFrame's geometry column :type geometry: gpd.GeoSeries :rtype: astropy.coordinates.EarthLocation. .. py:function:: is_night(geometry, time, time_resolution = DEFAULT_IS_NIGHT_TIME_RESOLUTION) Classify each (geometry, time) pair as night vs day. :param geometry: :type geometry: aligned series of locations and timestamps. :param time: :type time: aligned series of locations and timestamps. :param time_resolution: values give more accurate results near sunrise/sunset at the cost of execution speed; larger values are much faster, introducing sub-degree errors in sun altitude. Defaults to 1 hour. :type time_resolution: sample spacing for astropy's ErfaAstromInterpolator. Smaller .. py:function:: sun_time(date, geometry) Sunrise and sunset of the local solar day labelled by `date` at `geometry`. Returned timestamps are in UTC, representing the UTC time of the local sunrise/sunset. The `geometry` provided is assumed to be in EPSG:4326 (WGS84 lon/lat) .. py:function:: calculate_day_night_distance(date, segment_start, segment_end, dist_meters, daily_summary) .. py:function:: calculate_day_fraction(sunrise, sunset, segment_start, segment_end) Vectorized fraction of each [segment_start, segment_end] interval that falls in daylight, given the corresponding sunrise/sunset per row. Handles both `sunrise < sunset` (normal) and `sunrise >= sunset` (inverted / high-latitude) day orderings. Boundary samples (segment touching sunrise or sunset exactly) are assigned to the same side as the adjacent open interval, so np.select never falls through to NaN for valid `segment_start < segment_end`. .. py:function:: get_nightday_ratio(gdf)