pyowm.stationsapi30 package¶
Subpackages¶
Submodules¶
pyowm.stationsapi30.buffer module¶
-
class
pyowm.stationsapi30.buffer.
Buffer
(station_id)[source]¶ Bases:
object
-
append
(measurement)[source]¶ Appends the specified
Measurement
object to the buffer :param measurement: ameasurement.Measurement
instance
-
append_from_dict
(the_dict)[source]¶ Creates a
measurement.Measurement
object from the supplied dict and then appends it to the buffer :param the_dict: dict
-
append_from_json
(json_string)[source]¶ Creates a
measurement.Measurement
object from the supplied JSON string and then appends it to the buffer :param json_string: the JSON formatted string
-
created_at
= None¶
-
creation_time
(timeformat='unix')[source]¶ Returns the UTC time of creation of this aggregated measurement
Parameters: timeformat (str) – the format for the time value. May be: ‘unix’ (default) for UNIX time, ‘iso’ for ISO8601-formatted string in the format YYYY-MM-DD HH:MM:SS+00
or date for adatetime.datetime
objectReturns: an int or a str or a datetime.datetime
object or NoneRaises: ValueError
-
measurements
= None¶
-
sort_reverse_chronologically
()[source]¶ Sorts the measurements of this buffer in reverse chronological order
-
station_id
= None¶
-
pyowm.stationsapi30.measurement module¶
-
class
pyowm.stationsapi30.measurement.
AggregatedMeasurement
(station_id, timestamp, aggregated_on, temp=None, humidity=None, wind=None, pressure=None, precipitation=None)[source]¶ Bases:
object
A class representing an aggregation of measurements done by the Stations API on a specific time-frame. Values for the aggregation time-frame can be: ‘m’ (minute), ‘h’ (hour) or ‘d’ (day)
Parameters: - station_id (str) – unique station identifier
- timestamp (int) – reference UNIX timestamp for this measurement
- aggregated_on (string between 'm','h' and 'd') – aggregation time-frame for this measurement
- temp (dict or None) – optional dict containing temperature data
- humidity (dict or None) – optional dict containing humidity data
- wind (dict or None) – optional dict containing wind data
- pressure (dict or None) – optional dict containing pressure data
- precipitation (dict or None) – optional dict containing precipitation data
-
ALLOWED_AGGREGATION_TIME_FRAMES
= ['m', 'h', 'd']¶
-
creation_time
(timeformat='unix')[source]¶ Returns the UTC time of creation of this aggregated measurement
Parameters: timeformat (str) – the format for the time value. May be: ‘unix’ (default) for UNIX time, ‘iso’ for ISO8601-formatted string in the format YYYY-MM-DD HH:MM:SS+00
or date for adatetime.datetime
objectReturns: an int or a str or a datetime.datetime
object or NoneRaises: ValueError
-
class
pyowm.stationsapi30.measurement.
Measurement
(station_id, timestamp, temperature=None, wind_speed=None, wind_gust=None, wind_deg=None, pressure=None, humidity=None, rain_1h=None, rain_6h=None, rain_24h=None, snow_1h=None, snow_6h=None, snow_24h=None, dew_point=None, humidex=None, heat_index=None, visibility_distance=None, visibility_prefix=None, clouds_distance=None, clouds_condition=None, clouds_cumulus=None, weather_precipitation=None, weather_descriptor=None, weather_intensity=None, weather_proximity=None, weather_obscuration=None, weather_other=None)[source]¶ Bases:
object
-
creation_time
(timeformat='unix')[source]¶ Returns the UTC time of creation of this raw measurement
Parameters: timeformat (str) – the format for the time value. May be: ‘unix’ (default) for UNIX time, ‘iso’ for ISO8601-formatted string in the format YYYY-MM-DD HH:MM:SS+00
or date for adatetime.datetime
objectReturns: an int or a str or a datetime.datetime
object or NoneRaises: ValueError
-
pyowm.stationsapi30.persistence_backend module¶
Module containing asbtract classes and a few convenience implementations of raw measurements I/O
-
class
pyowm.stationsapi30.persistence_backend.
JSONPersistenceBackend
(json_file_path, station_id)[source]¶ Bases:
pyowm.stationsapi30.persistence_backend.PersistenceBackend
A PersistenceBackend loading/saving data to a JSON file. Data will be saved as a JSON list, each element being representing data of a pyowm.stationsapi30.measurement.Measurement object.
Parameters: - json_file_path (str) – path to the JSON file
- station_id (str) – unique OWM-provided ID of the station whose data is read/saved
-
class
pyowm.stationsapi30.persistence_backend.
PersistenceBackend
[source]¶ Bases:
object
A global abstract class representing an I/O manager for buffer objects containing raw measurements.
pyowm.stationsapi30.station module¶
-
class
pyowm.stationsapi30.station.
Station
(id, created_at, updated_at, external_id, name, lon, lat, alt, rank)[source]¶ Bases:
object
A class representing a meteostation in Stations API. A reference about OWM stations can be found at: http://openweathermap.org/stations
Parameters: - id (str) – unique OWM identifier for the station
- created_at (str in format %Y-%m-%dT%H:%M:%S.%fZ) – UTC timestamp marking the station registration.
- updated_at (str in format %Y-%m-%dT%H:%M:%S.%fZ) – UTC timestamp marking the last update to this station
- external_id (str) – user-given identifier for the station
- name (str) – user-given name for the station
- lon (float) – longitude of the station
- lat (float) – latitude of the station
- alt (float) – altitude of the station
- rank (int) – station rank
-
creation_time
(timeformat='unix')[source]¶ Returns the UTC time of creation of this station
Parameters: timeformat (str) – the format for the time value. May be: ‘unix’ (default) for UNIX time, ‘iso’ for ISO8601-formatted string in the format YYYY-MM-DD HH:MM:SS+00
or date for adatetime.datetime
objectReturns: an int or a str or a datetime.datetime
object or NoneRaises: ValueError
-
last_update_time
(timeformat='unix')[source]¶ Returns the UTC time of the last update on this station’s metadata
Parameters: timeformat (str) – the format for the time value. May be: ‘unix’ (default) for UNIX time, ‘iso’ for ISO8601-formatted string in the format YYYY-MM-DD HH:MM:SS+00
or date for adatetime.datetime
objectReturns: an int or a str or a datetime.datetime
object or NoneRaises: ValueError
-
to_XML
(xml_declaration=True, xmlns=True)[source]¶ Dumps object fields to an XML-formatted string. The ‘xml_declaration’ switch enables printing of a leading standard XML line containing XML version and encoding. The ‘xmlns’ switch enables printing of qualified XMLNS prefixes.
Parameters: - XML_declaration (bool) – if
True
(default) prints a leading XML declaration line - xmlns (bool) – if
True
(default) prints full XMLNS prefixes
Returns: an XML-formatted string
- XML_declaration (bool) – if