Package Documentation¶
Distances API Package.
Classes:
Name | Description |
---|---|
DistancesAPI |
Represents Signal's Distances API. |
VesselClass |
A group of vessels of similar characteristics. |
VesselClassFilter |
A filter used to find specific vessel classes. |
Port |
A maritime facility where vessels can dock. |
PortFilter |
A filter used to find specific ports. |
LoadingCondition |
The states of a vessel carrying cargo. |
RouteResponse |
A route between two points |
AlternativePath |
An alternative path for the route |
PointsOnRoute |
A point and extra properties needed for a route |
Point |
A point in latitude and longitude. |
AlternativePath
dataclass
¶
An alternative path for the route.
Attributes:
Name | Type | Description |
---|---|---|
calculated_route |
Tuple[Point, ...]
|
List of coordinates between start and end point. |
distance |
Decimal
|
The distance between the two points. |
routing_points_on_route |
Tuple[PointsOnRoute, ...]
|
|
piracy_distance |
Decimal
|
The distance between the two points when piracy is considered. |
seca_distance |
Decimal
|
The distance between the two points when SECA is considered. |
Source code in signal_ocean/distances/models.py
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
|
DistancesAPI
¶
Represents Signal's Distances API.
Source code in signal_ocean/distances/distances_api.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 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 65 66 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 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 |
|
__init__(connection=None)
¶
Initializes DistancesAPI.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
connection
|
Optional[Connection]
|
API connection configuration. If not provided, the default connection method is used. |
None
|
Source code in signal_ocean/distances/distances_api.py
20 21 22 23 24 25 26 27 |
|
get_generic_point_to_point_route(start_point, end_point, route_restrictions=None, delays_valid_at=None, get_alternatives=None)
¶
Retrieves a generic route between two points.
The method takes into consideration the provided restrictions and can also return alternative routes.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
start_point
|
Point
|
The starting point latitude and longitude. |
required |
end_point
|
Point
|
The ending point latitude and longitude. |
required |
route_restrictions
|
Optional[RouteRestrictions]
|
Restrictions to obey while calculating the route. |
None
|
delays_valid_at
|
Optional[date]
|
Date at which the route delays are valid. |
None
|
get_alternatives
|
Optional[bool]
|
Whether or not to include alternative routes. |
None
|
Returns:
Type | Description |
---|---|
RouteResponse
|
A Route between two points with distance in NM. |
Source code in signal_ocean/distances/distances_api.py
295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 |
|
get_point_to_point_distance(vessel_class, loading_condition_id, start_point, end_point)
¶
Retrieves the distance from one point to another.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
vessel_class
|
VesselClass
|
Vessel class for which the distance will be calculated. |
required |
loading_condition_id
|
int
|
Loading condition of the vessels for which the distance will be calculated. Options available: Laden and Ballast. |
required |
start_point
|
Point
|
The starting point latitude and longitude. |
required |
end_point
|
Point
|
The ending point latitude and longitude. |
required |
Returns:
Type | Description |
---|---|
Optional[Decimal]
|
A Decimal representing the distance in NM between two points. |
Source code in signal_ocean/distances/distances_api.py
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
|
get_point_to_point_route(vessel_class, loading_condition_id, start_point, end_point)
¶
Retrieves the route from one point to another.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
vessel_class
|
VesselClass
|
Vessel class for which the distance will be calculated. |
required |
loading_condition_id
|
int
|
Loading condition of the vessels for which the distance will be calculated. Options available: Laden and Ballast. |
required |
start_point
|
Point
|
The starting point latitude and longitude. |
required |
end_point
|
Point
|
The ending point latitude and longitude. |
required |
Returns:
Type | Description |
---|---|
RouteResponse
|
A Route between two points with distance in NM. |
Source code in signal_ocean/distances/distances_api.py
184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 |
|
get_point_to_port_distance(vessel_class, loading_condition_id, point, port)
¶
Retrieves the distance from one point to another.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
vessel_class
|
VesselClass
|
Vessel class for which the distance will be calculated. |
required |
loading_condition_id
|
int
|
Loading condition of the vessels for which the distance will be calculated. Options available: Laden and Ballast. |
required |
point
|
Point
|
The starting point latitude and longitude. |
required |
port
|
Port
|
The target port. |
required |
Returns:
Type | Description |
---|---|
Optional[Decimal]
|
A Decimal representing the distance in NM between a point and a port. |
Source code in signal_ocean/distances/distances_api.py
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 |
|
get_point_to_port_route(vessel_class, loading_condition_id, point, port)
¶
Retrieves the route from one point to another.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
vessel_class
|
VesselClass
|
Vessel class for which the distance will be calculated. |
required |
loading_condition_id
|
int
|
Loading condition of the vessels for which the distance will be calculated. Options available: Laden and Ballast. |
required |
point
|
Point
|
The starting point latitude and longitude. |
required |
port
|
Port
|
The ending port for the distance route calculation. |
required |
Returns:
Type | Description |
---|---|
RouteResponse
|
A Route between a point and a port with distance in NM. |
Source code in signal_ocean/distances/distances_api.py
221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 |
|
get_port_to_port_distance(vessel_class, loading_condition_id, port_from, port_to)
¶
Retrieves the distance from one point to another.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
vessel_class
|
VesselClass
|
Vessel class for which the distance will be calculated. |
required |
loading_condition_id
|
int
|
Loading condition of the vessels for which the distance will be calculated. Options available: Laden and Ballast. |
required |
port_from
|
Port
|
The starting port for the distance route calculation. |
required |
port_to
|
Port
|
The ending port for the distance route calculation. |
required |
Returns:
Type | Description |
---|---|
Optional[Decimal]
|
A Decimal representing the distance in NM between two ports. |
Source code in signal_ocean/distances/distances_api.py
147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 |
|
get_port_to_port_route(vessel_class, loading_condition_id, port_from, port_to)
¶
Retrieves the route from one point to another.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
vessel_class
|
VesselClass
|
Vessel class for which the distance will be calculated. |
required |
loading_condition_id
|
int
|
Loading condition of the vessels for which the distance will be calculated. Options available: Laden and Ballast. |
required |
port_from
|
Port
|
The starting port for the distance route calculation. |
required |
port_to
|
Port
|
The ending port for the distance route calculation. |
required |
Returns:
Type | Description |
---|---|
RouteResponse
|
A Route between two ports with distance in NM. |
Source code in signal_ocean/distances/distances_api.py
258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 |
|
get_ports(port_filter=None)
¶
Retrieves available ports.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
port_filter
|
Optional[PortFilter]
|
A filter used to find specific ports. If not specified, returns all available ports. |
None
|
Returns:
Type | Description |
---|---|
Tuple[Port, ...]
|
A tuple of available ports that match the filter. |
Source code in signal_ocean/distances/distances_api.py
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
|
get_vessel_classes(class_filter=None)
¶
Retrieves available vessel classes.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
class_filter
|
Optional[VesselClassFilter]
|
A filter used to find specific vessel classes. If not specified, returns all available vessel classes. |
None
|
Returns:
Type | Description |
---|---|
Tuple[VesselClass, ...]
|
A tuple of available vessel classes that match the filter. |
Source code in signal_ocean/distances/distances_api.py
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
|
LoadingCondition
¶
Contains constants for available loading conditions.
Source code in signal_ocean/distances/loading_condition.py
6 7 8 9 10 11 12 13 14 15 |
|
Point
dataclass
¶
A point on the surface of Earth.
Attributes:
Name | Type | Description |
---|---|---|
lat |
Decimal
|
The latitude of the point. |
lon |
Decimal
|
The longitude of the point. |
Source code in signal_ocean/distances/models.py
8 9 10 11 12 13 14 15 16 17 18 |
|
PointsOnRoute
dataclass
¶
A point and extra properties needed for a route.
Attributes:
Name | Type | Description |
---|---|---|
is_hra |
bool
|
Is the point in a high-risk area. |
is_seca |
bool
|
Is the point in a Sulfur Emission Control Area. |
distance |
Decimal
|
The distance between the two points. |
distance_to_enter |
Decimal
|
|
heading |
int
|
The point on route heading. |
editable |
bool
|
If the point on route is editable. |
name |
str
|
The point on route name. |
is_shown |
bool
|
If the point on route is shown. |
delay_mins |
int
|
The delay in minutes. |
center_point |
Point
|
The center point of route. |
Source code in signal_ocean/distances/models.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
|
Port
dataclass
¶
A maritime facility where vessels can dock.
Attributes:
Name | Type | Description |
---|---|---|
id |
int
|
The ID of the port. |
name |
str
|
The name of the port. |
Source code in signal_ocean/distances/port.py
6 7 8 9 10 11 12 13 14 15 |
|
PortFilter
dataclass
¶
A filter used to find specific ports.
Attributes:
Name | Type | Description |
---|---|---|
name_like |
Optional[str]
|
Used to find ports by name. When specified, ports whose names partially match (contain) the attribute's value will be returned. Matching is case-insensitive. |
Source code in signal_ocean/distances/port_filter.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
|
RouteResponse
dataclass
¶
A route between two points.
Attributes:
Name | Type | Description |
---|---|---|
id |
int
|
The id of the route response. |
start_point |
Point
|
Start point coordinates. |
end_point |
Point
|
End point coordinates. |
calculated_route |
Tuple[Point, ...]
|
List of coordinates between start and end point. |
routing_points_on_route |
Tuple[PointsOnRoute, ...]
|
List of points on a route. |
distance |
Decimal
|
The distance between the two points. |
piracy_distance |
Decimal
|
The distance between the two points when piracy is considered. |
seca_distance |
Decimal
|
The distance between the two points when seca is considered. |
alternative_paths |
Tuple[AlternativePath, ...]
|
List of alternative paths between the two points. |
is_empty |
bool
|
If the response is empty. |
bbox |
Optional[Tuple[Decimal, ...]]
|
The bounding box of the route. |
Source code in signal_ocean/distances/models.py
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
|
RouteRestrictions
dataclass
¶
Restrictions that can be placed upon a route.
Attributes:
Name | Type | Description |
---|---|---|
is_suez_open |
Optional[bool]
|
Determines whether or not to route through the Suez Canal. |
is_panama_open |
Optional[bool]
|
Determines whether or not to route through the Panama Canal. |
is_messina_open |
Optional[bool]
|
Determines whether or not to route through the Strait of Messina. |
is_oresund_open |
Optional[bool]
|
Determines whether or not to route through the Øresund Strait. |
is_suez_open_only_northbound |
Optional[bool]
|
Determines whether or not to route through the Suez Canal only when northbound. |
is_piracy_considered |
Optional[bool]
|
Determines whether or not to route through areas where a piracy threat exists. |
minimize_seca |
Optional[bool]
|
Determines whether or not to minimize distance travelled through SECA areas. |
Source code in signal_ocean/distances/models.py
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 |
|
VesselClass
dataclass
¶
A group of vessels of similar characteristics, i.e. Aframax, Panamax, etc.
Attributes:
Name | Type | Description |
---|---|---|
id |
int
|
The vessel class ID. |
name |
str
|
The vessel class name. |
Source code in signal_ocean/distances/vessel_class.py
6 7 8 9 10 11 12 13 14 15 |
|
VesselClassFilter
dataclass
¶
A filter used to find specific vessel classes.
Attributes:
Name | Type | Description |
---|---|---|
name_like |
Optional[str]
|
Used to find vessel classes by name. When specified, vessel classes whose names partially match (contain) the attribute's value will be returned. Matching is case-insensitive. |
Source code in signal_ocean/distances/vessel_class_filter.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
|