Skip to content

Working with delivery types

DeliveryType & DeliveryTypeSet Modules

Changelog

Version Description
3.0.3 initalise always a default value for holiday_delivery_type
3.0.0 Constructor doesn't reads anymore from xml node, use DeliveryTypeSet to build the object
2.0.2 Fixed bug when no holiday calendar chosen
1.5.7 Class DeliveryType added.

Documentation

DeliveryType Class

Attributes: id (int): id of delivery type calendar_id (int): id of calendar calendar (calendar obj or []): obj including holidays and bridge days delivery_moments (pandas.DataFrame): dataframe with all delivery days. For every 24 h and indicator True or False.

create_del_types(delivery_type_node=None, delivery_type_dict=None, holiday_del_type=False) staticmethod

Args: delivery_type_node (object): node in XML tree containing info about delivery types delivery_type_dict (dict): dict containing info about delivery types holiday_del_type (bool): indicating if there is special delivery types on holidays. e.g. no peak on holidays.

Returns:

Type Description
DataFrame

with delivery types

holidays_change(date_vector, delivery_matrix)

Adjusts delivery hours in the delivery matrix, according to holidays.

Parameters:

Name Type Description Default
date_vector array

Vector of dates (daily granularity).

required
delivery_matrix array

Matrix of delivery hours for each date in date_vector. Elements in the matrix must be of type boolean, with value=True (delivery) or value=False (no delivery). Size: L-by-24, with L the length of date_vector.

required

Returns:

Type Description
array

Delivery matrix with adjusted delivery hours.

DeliveryTypeSet Class

This is the manager object of the DeliveryType class. This class loads the set of all available delivery types for a commodity. For example, delivery type can be base and peakload.

Examples:

>>> from kyoslib_py.settings import DeliveryTypeSet
>>> delivery_types = DeliveryTypeSet.from_xml(xml_node=commodity_node, calendar_set=calendar_set)
>>> baseload = delivery_types.get_delivery_type(1)