PyMetOffice  0.4
Pythonic access to UK Met Office DataPoint API
Public Member Functions | Private Member Functions | List of all members
pymetoffice.observation.ObservationModel Class Reference

This is the analogue of the ForecastModel class At present, the DataPoint API appears not to support the 'nearestlatlon' form of location specifier. More...

Inheritance diagram for pymetoffice.observation.ObservationModel:
pymetoffice.base.baseModel pymetoffice.Model pymetoffice.pymetoffice.Model

Public Member Functions

def getObservationsPlace
 For now, this method is not supported by the DataPoint API (apparently).
 
def getObservationsId
 This, on the other hand, works fine given a valid location Id.
 
- Public Member Functions inherited from pymetoffice.base.baseModel
def __init__
 Constructor.
 

Private Member Functions

def _getRawJsonObsData
 Get the raw data (Json format).
 
def _getRawXMLObsData
 Get XML data as a minidom object.
 
def _makeDecoder
 Construct a dictionary for decoding abbreviations into user-friendly forms.
 

Additional Inherited Members

- Properties inherited from pymetoffice.base.baseModel
 Cached property(_getCached)
 
 ObservationSitelist property(_getObList)
 This provides the list of observation sites.
 
 ForecastSitelist property(_getFcList)
 This provides the list of forecast sites.
 

Detailed Description

This is the analogue of the ForecastModel class At present, the DataPoint API appears not to support the 'nearestlatlon' form of location specifier.

This is inconvenient, to say the least!

Definition at line 13 of file observation.py.

Member Function Documentation

def pymetoffice.observation.ObservationModel._getRawJsonObsData (   self,
  period,
  site,
  extra 
)
private

Get the raw data (Json format).

Use as you please but the library increasingly uses the XML methods.

Parameters
periodCurrently this must be 'hourly'. May change in the future.
siteMost likely to be a site Id, eg '3772' gets you the data for Heathrow Airport.
extraUsually {}.
Returns
Decoded JSON dictionary.

Definition at line 23 of file observation.py.

def pymetoffice.observation.ObservationModel._getRawXMLObsData (   self,
  period,
  site,
  extra 
)
private

Get XML data as a minidom object.

Parameters
periodCurrently this must be 'hourly'. May change in the future.
siteMost likely to be a site Id, eg '3772' gets you the data for Heathrow Airport.
extraUsually {}.
Returns
Decoded JSON dictionary.

Definition at line 42 of file observation.py.

def pymetoffice.observation.ObservationModel._makeDecoder (   self,
  doc 
)
private

Construct a dictionary for decoding abbreviations into user-friendly forms.

Deals with a couple of current special cases.

Parameters
docAn XML document as returned from getRawXmlObsData.

Definition at line 59 of file observation.py.

def pymetoffice.observation.ObservationModel.getObservationsId (   self,
  id 
)

This, on the other hand, works fine given a valid location Id.

I have chosen not to provide a mechanism for specifying a specific time (which would have to be in the last 24 hours). It is simpler to get all the data (24 observations) and extract the one that you want.

Definition at line 95 of file observation.py.

def pymetoffice.observation.ObservationModel.getObservationsPlace (   self,
  location 
)

For now, this method is not supported by the DataPoint API (apparently).

It always returns an empty list of Observation objects. However, it does not throw an exception because the API returns just the parameter decoding information. One day we may be able to use it.

Definition at line 81 of file observation.py.


The documentation for this class was generated from the following file: