Skip to content

Scenario data

This script provides dataclasses that represent a global information of scenarios.

FlightsCount dataclass

Bases: Scenario

Counters of flights in a given scenario.

Parameters:

NameTypeDescriptionDefault
pastint

Number of flights departed at current date

required
liveint

Number of flights on sale at current date

required
pendingint

Number of flights not departed and not yet on sale at current date

required
totalint

Total number of flights (schedules)

field(init=False)
Source code in src/rmlab/data/scenario.py
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
@dataclass
class FlightsCount(Scenario):
    """Counters of flights in a given scenario.

    Args:
        past (int): Number of flights departed at current date
        live (int): Number of flights on sale at current date
        pending (int): Number of flights not departed and not yet on sale at current date
        total (int): Total number of flights (schedules)
    """

    past: int
    live: int
    pending: int
    total: int = field(init=False)

    def __post_init__(self):
        self.total = self.past + self.live + self.pending

ItemsCount dataclass

Bases: Scenario

Counters of items of bounded categories.

Parameters:

NameTypeDescriptionDefault
aircraftint

Number of referenced aircrafts in scenario

required
airlineint

Number of referenced airlines in scenario

required
airportint

Number of referenced airports in scenario

required
cityint

Number of referenced cities in scenario

required
countryint

Number of referenced countries in scenario

required
cityrouteint

Number of cityroutes in scenario

required
citysectorint

Number of citysectors in scenario

required
routeint

Number of routes in scenario

required
sectorint

Number of sectors in scenario

required
pmodelint

Number of parametric models in scenario

required
Source code in src/rmlab/data/scenario.py
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
@dataclass
class ItemsCount(Scenario):
    """Counters of items of bounded categories.

    Args:
        aircraft (int): Number of referenced aircrafts in scenario
        airline (int): Number of referenced airlines in scenario
        airport (int): Number of referenced airports in scenario
        city (int): Number of referenced cities in scenario
        country (int): Number of referenced countries in scenario
        cityroute (int): Number of cityroutes in scenario
        citysector (int): Number of citysectors in scenario
        route (int): Number of routes in scenario
        sector (int): Number of sectors in scenario
        pmodel (int): Number of parametric models in scenario
    """

    aircraft: int
    airline: int
    airport: int
    city: int
    cityroute: int
    citysector: int
    country: int
    pmodel: int
    route: int
    sector: int

Scenario dataclass

Base class for dataclasses holding per-scenario information.

Parameters:

NameTypeDescriptionDefault
idint

Scenario identifier

required
Source code in src/rmlab/data/scenario.py
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
@dataclass
class Scenario:
    """Base class for dataclasses holding per-scenario information.

    Args:
        id (int): Scenario identifier

    """

    id: int

    def __post_init__(self):
        self.id = int(self.id)

    def __repr__(self) -> str:
        return self.__dict__

ScenarioDates dataclass

Bases: Scenario

Set of dates and status characteristic to a scenario.

Parameters:

NameTypeDescriptionDefault
day_statusScenarioDayStatus

Intra day scenario status

required
currentdatetime

Current date upto days (year-month-day)

required
nextdatetime

Date at which simulation would stop, upto days (year-month-day)

required
first_flight_loaddatetime

Date at which the first flight is put on sale, upto days (year-month-day)

required
last_flight_departuredatetime

Date at which the last flight departs, upto days (year-month-day)

required
checkpointsdatetime

List of dates at which simulation would stop, upto days (year-month-day)

required
stateScenarioState

Global state of scenario

required
Source code in src/rmlab/data/scenario.py
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
@dataclass
class ScenarioDates(Scenario):
    """Set of dates and status characteristic to a scenario.

    Args:
        day_status (ScenarioDayStatus): Intra day scenario status
        current (datetime): Current date upto days (year-month-day)
        next (datetime): Date at which simulation would stop, upto days (year-month-day)
        first_flight_load (datetime): Date at which the first flight is put on sale, upto days (year-month-day)
        last_flight_departure (datetime): Date at which the last flight departs, upto days (year-month-day)
        checkpoints (datetime): List of dates at which simulation would stop, upto days (year-month-day)
        state (ScenarioState): Global state of scenario
    """

    day_status: ScenarioDayStatus
    current: datetime
    next: datetime
    first_flight_load: datetime
    last_flight_departure: datetime
    checkpoints: List[datetime]
    upload_time: datetime
    state: ScenarioState

    def __post_init__(self):

        self.day_status = ScenarioDayStatus.str_to_enum_value(self.day_status)
        self.current = datetime.strptime(self.current, DateFormat).replace(tzinfo=timezone.utc)
        self.next = datetime.strptime(self.next, DateFormat).replace(tzinfo=timezone.utc)
        self.first_flight_load = datetime.strptime(self.first_flight_load, DateFormat).replace(tzinfo=timezone.utc)
        self.last_flight_departure = datetime.strptime(self.last_flight_departure, DateFormat).replace(tzinfo=timezone.utc)
        self.checkpoints = [
            datetime.strptime(chp, DateFormat).replace(tzinfo=timezone.utc) for chp in self.checkpoints
        ]
        self.upload_time = datetime.strptime(self.upload_time, DateTimeSecFormat).replace(tzinfo=timezone.utc)

SchedulesCount dataclass

Bases: Scenario

Counters of flights schedules in a given scenario.

Parameters:

NameTypeDescriptionDefault
pastint

Number of schedules with all flights departed at current date

required
liveint

Number of schedules with flights on sale at current date

required
pendingint

Number of schedules with all flights not yet on sale at current date

required
totalint

Total number of schedules

field(init=False)
Source code in src/rmlab/data/scenario.py
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
@dataclass
class SchedulesCount(Scenario):
    """Counters of flights schedules in a given scenario.

    Args:
        past (int): Number of schedules with all flights departed at current date
        live (int): Number of schedules with flights on sale at current date
        pending (int): Number of schedules with all flights not yet on sale at current date
        total (int): Total number of schedules
    """

    past: int
    live: int
    pending: int
    total: int = field(init=False)

    def __post_init__(self):
        self.total = self.past + self.live + self.pending