leaf_engine.adapt.utilities =========================== .. py:module:: leaf_engine.adapt.utilities Attributes ---------- .. autoapisummary:: leaf_engine.adapt.utilities.r_earth Functions --------- .. autoapisummary:: leaf_engine.adapt.utilities.cartesian leaf_engine.adapt.utilities.create_dest_address leaf_engine.adapt.utilities.create_origin_address leaf_engine.adapt.utilities.dow_days leaf_engine.adapt.utilities.fill_nan leaf_engine.adapt.utilities.haversine leaf_engine.adapt.utilities.haversine_lanes leaf_engine.adapt.utilities.lane_ships_per_period leaf_engine.adapt.utilities.scalar_haversine Module Contents --------------- .. py:function:: cartesian(a, b, **kwargs) .. py:function:: create_dest_address(row, use_zip=True) .. py:function:: create_origin_address(row, use_zip=True) .. py:function:: dow_days(days) .. py:function:: fill_nan(num, fill) .. py:function:: haversine(a, b) Computes the great circle distance between two points. :param a: np.array([(lon,lat) ... (lon,lat)]) :param b: np.array([(lon,lat) ... (lon,lat)]) :returns: Distance in miles between a,b .. py:function:: haversine_lanes(a, b) Computes the great circle distance between the origin and destination of two lanes. :param a: lane 1 with origin and destination lon and lat :param b: lane 2 with origin and destination lon and lat :returns: Distance in miles between origin and destination of the two lanes .. py:function:: lane_ships_per_period(ships, period, start='', end='', label='left') Find the number of shipments on each lane per period. :param ships: a dataframe of shipment data containing columns named lane_id, shipments, period :param period: pandas offset alias for the period over which to group shipments (e.g., 'B' for business day, 'W' for week) :param start: start date for the period index. Will only be used if both start and end are provided. :param end: end date for the period index. Will only be used if both start and end are provided. :param label: 'right' or 'left' to indicate whether the period index will be labeled with the start or end of the period. 'left' is the start of the period, 'right' is the end of the period. The default is 'left'. :returns: Dataframe of the shipment volume per period for each lane. .. py:function:: scalar_haversine(a, b) Computes the great circle distance between two points. :param a: [lon,lat] :param b: [lon,lat] :returns: Distance in miles between a,b .. py:data:: r_earth :value: 3961