pyowm.pollutionapi30 package

Subpackages

Submodules

pyowm.pollutionapi30.airpollution_client module

pyowm.pollutionapi30.coindex module

Carbon Monoxide classes and data structures.

class pyowm.pollutionapi30.coindex.COIndex(reference_time, location, interval, co_samples, reception_time)[source]

Bases: object

A class representing the Carbon monOxide Index observed in a certain location in the world. The index is made up of several measurements, each one at a different atmospheric pressure. The location is represented by the encapsulated Location object.

Parameters:
  • reference_time (int) – GMT UNIXtime telling when the CO data has been measured
  • location (Location) – the Location relative to this CO observation
  • interval (str) – the time granularity of the CO observation
  • co_samples (list of dicts) – the CO samples
  • reception_time (int) – GMT UNIXtime telling when the CO observation has been received from the OWM Weather API
Returns:

an COIndex instance

Raises:

ValueError when negative values are provided as reception time, CO samples are not provided in a list

get_co_sample_with_highest_vmr()[source]

Returns the CO sample with the highest Volume Mixing Ratio value :return: dict

get_co_sample_with_lowest_vmr()[source]

Returns the CO sample with the lowest Volume Mixing Ratio value :return: dict

get_co_samples()[source]

Returns the CO samples for this index

Returns:list of dicts
get_interval()[source]

Returns the time granularity interval for this CO index measurement

Returns:str
get_location()[source]

Returns the Location object for this CO index measurement

Returns:the Location object
get_reception_time(timeformat='unix')[source]

Returns the GMT time telling when the CO observation has been received from the OWM Weather API

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+00date for datetime.datetime object instance
Returns:an int or a str
Raises:ValueError when negative values are provided
get_reference_time(timeformat='unix')[source]

Returns the GMT time telling when the CO samples have been measured

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+00date for datetime.datetime object instance
Returns:an int or a str
Raises:ValueError when negative values are provided
is_forecast()[source]

Tells if the current CO observation refers to the future with respect to the current date :return: bool

to_JSON()[source]

Dumps object fields into a JSON formatted string

Returns:the JSON string
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

pyowm.pollutionapi30.ozone module

class pyowm.pollutionapi30.ozone.Ozone(reference_time, location, interval, du_value, reception_time)[source]

Bases: object

A class representing the Ozone (O3) data observed in a certain location in the world. The location is represented by the encapsulated Location object.

Parameters:
  • reference_time (int) – GMT UNIXtime telling when the O3 data have been measured
  • location (Location) – the Location relative to this O3 observation
  • du_value (float) – the observed O3 Dobson Units value (reference: http://www.theozonehole.com/dobsonunit.htm)
  • interval (str) – the time granularity of the O3 observation
  • reception_time (int) – GMT UNIXtime telling when the observation has been received from the OWM Weather API
Returns:

an Ozone instance

Raises:

ValueError when negative values are provided as reception time or du_value

get_du_value()[source]

Returns the O3 Dobson Unit of this observation

Returns:float
get_interval()[source]

Returns the time granularity interval for this O3 observation

Returns:str
get_location()[source]

Returns the Location object for this O3 observation

Returns:the Location object
get_reception_time(timeformat='unix')[source]

Returns the GMT time telling when the O3 observation has been received from the OWM Weather API

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+00date for datetime.datetime object instance
Returns:an int or a str
Raises:ValueError when negative values are provided
get_reference_time(timeformat='unix')[source]

Returns the GMT time telling when the O3 data have been measured

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+00date for datetime.datetime object instance
Returns:an int or a str
Raises:ValueError when negative values are provided
is_forecast()[source]

Tells if the current O3 observation refers to the future with respect to the current date :return: bool

to_JSON()[source]

Dumps object fields into a JSON formatted string

Returns:the JSON string
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

pyowm.pollutionapi30.no2index module

Nitrogen Dioxide classes and data structures.

class pyowm.pollutionapi30.no2index.NO2Index(reference_time, location, interval, no2_samples, reception_time)[source]

Bases: object

A class representing the Nitrogen DiOxide Index observed in a certain location in the world. The index is made up of several measurements, each one at a different atmospheric levels. The location is represented by the encapsulated Location object.

Parameters:
  • reference_time (int) – GMT UNIXtime telling when the NO2 data has been measured
  • location (Location) – the Location relative to this NO2 observation
  • interval (str) – the time granularity of the NO2 observation
  • no2_samples (list of dicts) – the NO2 samples
  • reception_time (int) – GMT UNIXtime telling when the NO2 observation has been received from the OWM Weather API
Returns:

a NO2Index instance

Raises:

ValueError when negative values are provided as reception time, NO2 samples are not provided in a list

get_interval()[source]

Returns the time granularity interval for this NO2 index measurement

Returns:str
get_location()[source]

Returns the Location object for this NO2 index measurement

Returns:the Location object
get_no2_samples()[source]

Returns the NO2 samples for this index

Returns:list of dicts
get_reception_time(timeformat='unix')[source]

Returns the GMT time telling when the NO2 observation has been received from the OWM Weather API

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+00date for datetime.datetime object instance
Returns:an int or a str
Raises:ValueError when negative values are provided
get_reference_time(timeformat='unix')[source]

Returns the GMT time telling when the NO2 samples have been measured

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+00date for datetime.datetime object instance
Returns:an int or a str
Raises:ValueError when negative values are provided
get_sample_by_label(label)[source]

Returns the NO2 sample having the specified label or None if none is found

Parameters:label – the label for the seeked NO2 sample
Returns:dict or None
is_forecast()[source]

Tells if the current NO2 observation refers to the future with respect to the current date :return: bool

to_JSON()[source]

Dumps object fields into a JSON formatted string

Returns:the JSON string
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

pyowm.pollutionapi30.so2index module

Sulphur Dioxide classes and data structures.

class pyowm.pollutionapi30.so2index.SO2Index(reference_time, location, interval, so2_samples, reception_time)[source]

Bases: object

A class representing the Sulphur Dioxide Index observed in a certain location in the world. The index is made up of several measurements, each one at a different atmospheric pressure. The location is represented by the encapsulated Location object.

Parameters:
  • reference_time (int) – GMT UNIXtime telling when the SO2 data has been measured
  • location (Location) – the Location relative to this SO2 observation
  • interval (str) – the time granularity of the SO2 observation
  • so2_samples (list of dicts) – the SO2 samples
  • reception_time (int) – GMT UNIXtime telling when the SO2 observation has been received from the OWM Weather API
Returns:

an SOIndex instance

Raises:

ValueError when negative values are provided as reception time, SO2 samples are not provided in a list

get_interval()[source]

Returns the time granularity interval for this SO2 index measurement

Returns:str
get_location()[source]

Returns the Location object for this SO2 index measurement

Returns:the Location object
get_reception_time(timeformat='unix')[source]

Returns the GMT time telling when the SO2 observation has been received from the OWM Weather API

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+00date for datetime.datetime object instance
Returns:an int or a str
Raises:ValueError when negative values are provided
get_reference_time(timeformat='unix')[source]

Returns the GMT time telling when the SO2 samples have been measured

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+00date for datetime.datetime object instance
Returns:an int or a str
Raises:ValueError when negative values are provided
get_so2_samples()[source]

Returns the SO2 samples for this index

Returns:list of dicts
is_forecast()[source]

Tells if the current SO2 observation refers to the future with respect to the current date :return: bool

to_JSON()[source]

Dumps object fields into a JSON formatted string

Returns:the JSON string
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

pyowm.pollutionapi30.parsers module

Module contents