tracktable.info.ports module¶
Module contents¶
- class tracktable.info.ports.Port[source]¶
Bases:
objectInformation about a single port
- world_port_index_number¶
Arbitrary index number of the given port
- Type:
str
- region¶
WPI specified region of port
- Type:
str
- name¶
Human-readable port name
- Type:
str
- alternate_name¶
Alternate human-readable port name, i.e. a different name for given port
- Type:
str
- un_locode¶
UN/LOCODE of port
- Type:
str
- country¶
Country where port is located
- Type:
str
- water_body¶
Body of water where the port is located
- Type:
str
- position¶
(longitude, latitude) position of port
- Type:
tuple
- attributes¶
All other misc attributes of the given port, see ports.csv for all other attributes
- Type:
int
- tracktable.info.ports.all_ports()[source]¶
Return all the port records we have.
- Returns:
Unsorted list of port objects.
- tracktable.info.ports.all_ports_by_country(country)[source]¶
Return all the port records we have for a given country.
- Parameters:
country (str) – Country to return all ports from.
- Returns:
Dictionary of ports from the given country.
- tracktable.info.ports.all_ports_by_water_body(water_body)[source]¶
Return all the port records we have from a given water body.
- Parameters:
water_body (str) – Water body to return all ports from.
- Returns:
Dictionary of ports from the given water body.
- tracktable.info.ports.all_ports_by_wpi_region(wpi_region)[source]¶
Return all the port records we have from a given wpi region.
- Parameters:
wpi_region (str or int) – WPI region and/or accompanying numeric value to return all ports from. For example, wpi_region can be of the format
Australia -- 53290(str) ORAustralia(str) OR53290(int).- Returns:
Dictionary of ports from the given wpi region.
- tracktable.info.ports.all_ports_within_bounding_box(bounding_box)[source]¶
Return all the port records we have from a given bounding box.
- Parameters:
bounding_box (Bounding Box) – Bounding box to return all ports from.
- Returns:
Dictionary of ports from the given bounding box.
- tracktable.info.ports.build_port_dict()[source]¶
Assemble the port dictionary on first access
This function is called whenever the user tries to look up an port. It checks to make sure the table has been populated and, if not, loads it from disk.
- Returns:
None
- Side Effects:
Port data will be loaded if not already in memory
- tracktable.info.ports.port_information(port_info, country=None)[source]¶
Look up information about an port
- Parameters:
port_info (str or int) – Name (str), Alternate Name (str) or World Port Index Number (int) of port
- Keyword Arguments:
country (string) – Country containing the desired port. (Default: None)
- Returns:
Port object containing requested information or list of ports if there are multiple matching port names.
- Raises:
KeyError – no such port