cities

cities - Imports GNU miscfiles cities data files.

class upoints.cities.Cities(data=None)[source]

Bases: upoints.point.Points

Class for representing a group of City objects.

New in version 0.5.1.

Initialise a new Cities object.

import_locations(data)[source]

Parse GNU miscfiles cities data files.

import_locations() returns a list containing City objects.

It expects data files in the same format that GNU miscfiles provides, that is:

ID          : 1
Type        : City
Population  : 210700
Size        :
Name        : Aberdeen
 Country    : UK
 Region     : Scotland
Location    : Earth
 Longitude  : -2.083
 Latitude   :   57.150
 Elevation  :
Date        : 19961206
Entered-By  : Rob.Hooft@EMBL-Heidelberg.DE
//
ID          : 2
Type        : City
Population  : 1950000
Size        :
Name        : Abidjan
 Country    : Ivory Coast
 Region     :
Location    : Earth
 Longitude  : -3.867
 Latitude   :    5.333
 Elevation  :
Date        : 19961206
Entered-By  : Rob.Hooft@EMBL-Heidelberg.DE

When processed by import_locations() will return list object in the following style:

[City(1, "City", 210700, None, "Aberdeen", "UK", "Scotland",
      "Earth", -2.083, 57.15, None, (1996, 12, 6, 0, 0, 0, 4,
      341, -1), "Rob.Hooft@EMBL-Heidelberg.DE"),
 City(2, "City", 1950000, None, "Abidjan", "Ivory Coast", "",
      "Earth", -3.867, 5.333, None, (1996, 12, 6, 0, 0, 0, 4,
      341, -1), "Rob.Hooft@EMBL-Heidelberg.DE")])
Parameters:data (iter) – NOAA station data to read
Returns:Places as City objects
Return type:list
Raises:TypeError – Invalid value for data
class upoints.cities.City(identifier, name, ptype, region, country, location, population, size, latitude, longitude, altitude, date, entered)[source]

Bases: upoints.trigpoints.Trigpoint

Class for representing an entry from the GNU miscfiles cities data file.

New in version 0.2.0.

Initialise a new City object.

Parameters:
  • identifier (int) – Numeric identifier for object
  • name (str) – Place name
  • ptype (str) – Type of place
  • region (str) – Region place can be found
  • country (str) – Country name place can be found
  • location (str) – Body place can be found
  • population (int) – Place’s population
  • size (int) – Place’s area
  • latitude (float) – Station’s latitude
  • longitude (float) – Station’s longitude
  • altitude (int) – Station’s elevation
  • date (time.struct_time) – Date the entry was added
  • entered (str) – Entry’s author
upoints.cities.TEMPLATE = 'ID : %s\nType : %s\nPopulation : %s\nSize : %s\nName : %s\n Country : %s\n Region : %s\nLocation : %s\n Longitude : %s\n Latitude : %s\n Elevation : %s\nDate : %s\nEntered-By : %s'

GNU miscfiles cities.dat template