1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118
|
Migration from DataPoint
========================
The new APIs the Met Office provide via DataHub are very different in behaviour
to the old APIs which were provided via DataPoint. As such this library has
changed greatly.
The main changes are below.
No concept of 'sites'
---------------------
There is no concept of retrieving a site id for a location before requesting a
forecast. Now a latitude and longitude are provided to the library directly.
No observations
---------------
The new API does not provide 'observations' like DataPoint. However, the current
state of the weather is returned as part of the forecast responses. As such,
this library no longer provides separate 'observations'.
Simplified object hierarchy
---------------------------
Python dicts are used instead of classes to allow more flexibility with handling
data returned from the MetOffice API, and because new MetOffice API provides
data with a more convenient structure. The concept of 'Days' has also been
removed from the library and instead all time steps are provided in one list.
The data structure for a single time step is::
{
'time': datetime.datetime(2024, 2, 19, 13, 0, tzinfo=datetime.timezone.utc),
'screenTemperature': {
'value': 10.09,
'description': 'Screen Air Temperature',
'unit_name': 'degrees Celsius',
'unit_symbol': 'Cel'
},
'screenDewPointTemperature': {
'value': 8.08,
'description': 'Screen Dew Point Temperature',
'unit_name': 'degrees Celsius',
'unit_symbol': 'Cel'
},
'feelsLikeTemperature': {
'value': 6.85,
'description': 'Feels Like Temperature',
'unit_name': 'degrees Celsius',
'unit_symbol': 'Cel'
},
'windSpeed10m': {
'value': 7.57,
'description': '10m Wind Speed',
'unit_name': 'metres per second',
'unit_symbol': 'm/s'
},
'windDirectionFrom10m': {
'value': 263,
'description': '10m Wind From Direction',
'unit_name': 'degrees',
'unit_symbol': 'deg'
},
'windGustSpeed10m': {
'value': 12.31,
'description': '10m Wind Gust Speed',
'unit_name': 'metres per second',
'unit_symbol': 'm/s'
},
'visibility': {
'value': 21201,
'description': 'Visibility',
'unit_name': 'metres',
'unit_symbol': 'm'
},
'screenRelativeHumidity': {
'value': 87.81,
'description': 'Screen Relative Humidity',
'unit_name': 'percentage',
'unit_symbol': '%'
},
'mslp': {
'value': 103080,
'description': 'Mean Sea Level Pressure',
'unit_name': 'pascals',
'unit_symbol': 'Pa'
},
'uvIndex': {
'value': 1,
'description': 'UV Index',
'unit_name': 'dimensionless',
'unit_symbol': '1'
},
'significantWeatherCode': {
'value': 'Cloudy',
'description': 'Significant Weather Code',
'unit_name': 'dimensionless',
'unit_symbol': '1'
},
'precipitationRate': {
'value': 0.0,
'description': 'Precipitation Rate',
'unit_name': 'millimetres per hour',
'unit_symbol': 'mm/h'
},
'probOfPrecipitation': {
'value': 21,
'description': 'Probability of Precipitation',
'unit_name': 'percentage',
'unit_symbol': '%'
}
}
Different data provided
-----------------------
There are some differences in what data are provided in each weather forecast
compared to the old DataPoint API, and in the names of the features.
|