{ "info": { "author": "Stephen B. Murray", "author_email": "sbm199@gmail.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: GNU Lesser General Public License v3 or later (LGPLv3+)", "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "================\n metoffer v.2.0\n================\n\nmetoffer is a simple wrapper for the API provided by the British\n`Met Office `_ known as DataPoint. It\ncan be used to retrieve weather observations and forecasts. At its\nheart is the ``MetOffer`` class which has methods to retrieve data\navailable through the API and make them available as Python objects.\nAlso included are a couple of functions and classes useful for\ninterpretting the data.\n\nThis project is now maintained at ``_.\n\nExample\n-------\n\nGet forecast for Met Office site closest to supplied latitude and\nlongitude, the forecast to be given in three-hourly intervals::\n\n\t>>> import metoffer\n\t>>> api_key = '01234567-89ab-cdef-0123-456789abcdef'\n\t>>> M = metoffer.MetOffer(api_key)\n\t>>> x = M.nearest_loc_forecast(51.4033, -0.3375, metoffer.THREE_HOURLY)\n\n*It's worth noting here that, if you expect many requests for forecast data\nto be made, it is probably better to use the functions called by this\nconvenience function so that data that does not change often (e.g. data\nabout Met Office sites) may be cached.*\n\nParse this data into a ``metoffer.Weather`` instance::\n\n\t>>> y = metoffer.Weather(x)\n\t>>> y.name\n\t'HAMPTON COURT PALACE'\n\t>>> y.country\n\t'ENGLAND'\n\t>>> y.continent\n\t'EUROPE'\n\t>>> y.lat\n\t51.4007\n\t>>> y.lon\n\t-0.3337\n\t>>> y.elevation\n\t4.0\n\t>>> y.ident # The Met Office site ident\n\t'351747'\n\t>>> y.data_date\n\t'2014-06-14T23:00:00Z'\n\t>>> y.dtype\n\t'Forecast'\n\t>>> import pprint\n\t>>> pprint.pprint(y.data)\n\t[{'Feels Like Temperature': (17, 'C', 'F'),\n\t 'Max UV Index': (1, '', 'U'),\n\t 'Precipitation Probability': (7, '%', 'Pp'),\n\t 'Screen Relative Humidity': (63, '%', 'H'),\n\t 'Temperature': (19, 'C', 'T'),\n\t 'Visibility': ('VG', '', 'V'),\n\t 'Weather Type': (7, '', 'W'),\n\t 'Wind Direction': ('NNE', 'compass', 'D'),\n\t 'Wind Gust': (18, 'mph', 'G'),\n\t 'Wind Speed': (11, 'mph', 'S'),\n\t 'timestamp': (datetime.datetime(2014, 6, 14, 18, 0), '')},\n\t {'Feels Like Temperature': (15, 'C', 'F'),\n\t 'Max UV Index': (0, '', 'U'),\n\t 'Precipitation Probability': (0, '%', 'Pp'),\n\t 'Screen Relative Humidity': (72, '%', 'H'),\n\t 'Temperature': (16, 'C', 'T'),\n\t 'Visibility': ('VG', '', 'V'),\n\t 'Weather Type': (0, '', 'W'),\n\t 'Wind Direction': ('NNE', 'compass', 'D'),\n\t 'Wind Gust': (18, 'mph', 'G'),\n\t 'Wind Speed': (9, 'mph', 'S'),\n\t 'timestamp': (datetime.datetime(2014, 6, 14, 21, 0), '')},\n\n\t [...]\n\n\t {'Feels Like Temperature': (16, 'C', 'F'),\n\t 'Max UV Index': (0, '', 'U'),\n\t 'Precipitation Probability': (2, '%', 'Pp'),\n\t 'Screen Relative Humidity': (66, '%', 'H'),\n\t 'Temperature': (16, 'C', 'T'),\n\t 'Visibility': ('VG', '', 'V'),\n\t 'Weather Type': (0, '', 'W'),\n\t 'Wind Direction': ('NNE', 'compass', 'D'),\n\t 'Wind Gust': (13, 'mph', 'G'),\n\t 'Wind Speed': (7, 'mph', 'S'),\n\t 'timestamp': (datetime.datetime(2014, 6, 18, 21, 0), '')}]\n\nInterpret the data further::\n\n\t>>> for i in y.data:\n\t... print(\"{} - {}\".format(i[\"timestamp\"][0].strftime(\"%d %b, %H:%M\"), metoffer.WEATHER_CODES[i[\"Weather Type\"][0]]))\n\t... \n\t14 Jun, 18:00 - Cloudy\n\t14 Jun, 21:00 - Clear night\n\t15 Jun, 00:00 - Clear night\n\t15 Jun, 03:00 - Cloudy\n\n\t [...]\n\n\t18 Jun, 09:00 - Partly cloudy (day)\n\t18 Jun, 12:00 - Partly cloudy (day)\n\t18 Jun, 15:00 - Cloudy\n\t18 Jun, 18:00 - Cloudy\n\t18 Jun, 21:00 - Clear night\n\t>>> metoffer.VISIBILITY[y.data[0][\"Visibility\"][0]]\n\t'Very good - Between 20-40 km'\n\t>>> metoffer.guidance_UV(y.data[0][\"Max UV Index\"][0])\n\t'Low exposure. No protection required. You can safely stay outside'\n\nThe MetOffer Class\n------------------\n\nAvailable methods:\n\n* ``loc_forecast``. Return location-specific forecast data (including lists of\n available sites and time capabilities) for given time step.\n\n* ``nearest_loc_forecast``. Work out nearest possible site to lat & lon\n coordinates and return its forecast data for the given time step.\n\n* ``loc_observations``. Return location-specific observation data, including a\n list of available sites (time step will be HOURLY).\n\n* ``nearest_loc_obs``. Work out nearest possible site to lat & lon coordinates\n and return observation data for it.\n\n* ``text_forecast``. Return textual forecast data for regions, national parks\n or mountain areas.\n\n* ``text_uk_extremes``. Return textual data of UK extremes.\n\n* ``stand_alone_imagery``. Returns capabilities data for stand alone imagery and\n includes URIs for the images.\n\n* ``map_overlay_forecast``. Returns capabilities data for forecast map overlays.\n\n* ``map_overlay_obs``. Returns capabilities data for observation map overlays.\n\nThe Site Class\n--------------\n\nDescribes object to hold site metadata. Also describes method\n(``distance_to_coords``) to return a Site instance's 'distance' from any given\nlat & lon coordinates. This 'distance' is a value which is used to guide\n``MetOffer.nearest_loc_forecast`` and ``MetOffer.nearest_loc_obs``. It simply\ncalculates the difference between the two sets of coordinates and arrives at a\nvalue through Pythagorean theorem.\n\nThe Weather Class\n-----------------\n\nA hold-all for returned weather data, including associated metadata. It parses\nreturned dict of MetOffer location-specific data into a Weather instance.\nWorks with single or multiple time steps. There are a couple of points to\nnote:\n\n* All dict keys have a tuple, even where there is no obvious need, such as\n with 'timestamp' and 'Weather Type'. 'timestamp' is a 2-tuple, all else\n is a 3-tuple. This is a feature.\n\n* When the Met Office does not have a recorded observation against a category,\n metoffer will return None.\n\n* For parsed DAILY forecasts, the hours and minutes of the 'timestamp'\n datetime.datetime object are superfluous. In fact, it would be misleading\n to follow them. Rather, this time there is a sensible entry in the second\n part of the tuple. This alternates between 'Day' and 'Night' with each\n successive dict. The categories are often specific to the time of day.\n This is how the API provides it. Take note as it may catch you out.\n\nThe TextForecast Class\n----------------------\n\nA hold-all for returned textual regional forecasts, including associated meta-\ndata, created by parsing the data returned by ``MetOffer.text_forecast``.\n\nUseful Functions\n----------------\n\n* ``parse_sitelist``. Return list of Site instances from retrieved sitelist data.\n\n* ``get_nearest_site``. Return a list of strings (site IDs) which can be used\n as 'request' in calls to ``loc_forecast`` and ``loc_observations``.\n\n* ``guidance_UV``. Return Met Office guidance regarding UV exposure based on UV\n index.\n\n* ``extract_data_key``. Returns a dict that maps measurement type to its description\n and measurement unit.\n\nFeedback & Bug Reports\n----------------------\n\nGet in touch:\n\nStephen B Murray \n@sludgedesk\n\nLegal\n-----\n\nCopyright 2012-2014, 2018 Stephen B Murray\n\nDistributed under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or (at your\noption) any later version.\n\nYou should have received a copy of the GNU General Public License along with\nthis package. If not, see \n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/sludgedesk/metoffer", "keywords": "", "license": "LGPLv3+", "maintainer": "", "maintainer_email": "", "name": "MetOffer", "package_url": "https://pypi.org/project/MetOffer/", "platform": "", "project_url": "https://pypi.org/project/MetOffer/", "project_urls": { "Homepage": "https://github.com/sludgedesk/metoffer" }, "release_url": "https://pypi.org/project/MetOffer/2.0/", "requires_dist": null, "requires_python": "", "summary": "Simple wrapper for the Met Office DataPoint API.", "version": "2.0" }, "last_serial": 3907067, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "b156244351e54af72712ff7ff09853af", "sha256": "546a97c0c3d1cff249012405146240396a1c0b64b63fc9aa386bc11a6b98fc63" }, "downloads": -1, "filename": "MetOffer-0.1.zip", "has_sig": false, "md5_digest": "b156244351e54af72712ff7ff09853af", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 22707, "upload_time": "2012-11-03T22:58:24", "url": "https://files.pythonhosted.org/packages/8c/fc/8fc8e5bfa461bdabb7d7cb8b216ae8627ad0805045a38feda166812bb830/MetOffer-0.1.zip" } ], "1.0": [ { "comment_text": "", "digests": { "md5": "e3b6601dfc3b18d76c98efe9f067edff", "sha256": "ba570dcf600ca8cab9bc026dc8a7d6f50f89d293091c288e24345cedaffcede4" }, "downloads": -1, "filename": "MetOffer-1.0.tar.gz", "has_sig": false, "md5_digest": "e3b6601dfc3b18d76c98efe9f067edff", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7532, "upload_time": "2013-05-19T08:19:14", "url": "https://files.pythonhosted.org/packages/0e/53/4b82c9ecba30135d2a5c4a7c64203ea6c3504bd9e12078aedb3c63ece2da/MetOffer-1.0.tar.gz" } ], "1.1": [ { "comment_text": "", "digests": { "md5": "04b85a3758c73562870a89083bd99d37", "sha256": "394f6913b15d49863171b99c8a9e3b79e68e87a05f123670d8a6713c8f085b81" }, "downloads": -1, "filename": "MetOffer-1.1.tar.gz", "has_sig": false, "md5_digest": "04b85a3758c73562870a89083bd99d37", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 20493, "upload_time": "2013-08-12T19:54:58", "url": "https://files.pythonhosted.org/packages/8c/0e/0fd1bb262dd9ceb2e884fc1087a2543100799f3c8afb9720628cd6aaada9/MetOffer-1.1.tar.gz" } ], "1.2": [ { "comment_text": "", "digests": { "md5": "10bcbe19b11ad9668ccb47ad8fe061e3", "sha256": "b8a958782f229fd8a04d68ecf8a244000d28cc2a7beba5786ab42de900b30e0e" }, "downloads": -1, "filename": "MetOffer-1.2.tar.gz", "has_sig": true, "md5_digest": "10bcbe19b11ad9668ccb47ad8fe061e3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 21604, "upload_time": "2013-12-04T22:51:30", "url": "https://files.pythonhosted.org/packages/30/bb/0ac52de6ef27fd2dc99b6d71283dc295f04f21a411da4e8d71684ad4de39/MetOffer-1.2.tar.gz" } ], "1.3": [ { "comment_text": "", "digests": { "md5": "4ddbe51b6ba296cb8990413fa283652d", "sha256": "4eb4e0becc39b0da669465b87a410ebd73dd6325fa0fe8420d296cfdc7d27dcb" }, "downloads": -1, "filename": "MetOffer-1.3.tar.gz", "has_sig": true, "md5_digest": "4ddbe51b6ba296cb8990413fa283652d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8040, "upload_time": "2014-06-15T01:10:16", "url": "https://files.pythonhosted.org/packages/13/30/7c4f207c5987d122ed3c3b6c193e3d71d0a4a617d19998bdf3f27811894b/MetOffer-1.3.tar.gz" } ], "1.3.1": [ { "comment_text": "", "digests": { "md5": "3857bc541b1b25935bde628aed92174f", "sha256": "e00f4da5e386fe9b904454e5b3d351fa246666e761d046e445375ae25f2f6176" }, "downloads": -1, "filename": "MetOffer-1.3.1.tar.gz", "has_sig": true, "md5_digest": "3857bc541b1b25935bde628aed92174f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 22269, "upload_time": "2014-06-15T13:05:13", "url": "https://files.pythonhosted.org/packages/ef/59/31e4f33fc5bf2bda204727ab8fcf6368943846559267c96e96c9c5d51891/MetOffer-1.3.1.tar.gz" } ], "1.3.2": [ { "comment_text": "", "digests": { "md5": "14923dd3a6d1bbd3310696e89fae5ba1", "sha256": "4dac780516b9953887897e31bfca4af89d80efce56056a0093dd33626edfedb7" }, "downloads": -1, "filename": "MetOffer-1.3.2.tar.gz", "has_sig": true, "md5_digest": "14923dd3a6d1bbd3310696e89fae5ba1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 22307, "upload_time": "2014-06-16T20:34:53", "url": "https://files.pythonhosted.org/packages/97/d9/6c829f7dded7a3d5a4aeb2ff51abfad154b26dd2bf3e0eedc5e2561f4d1d/MetOffer-1.3.2.tar.gz" } ], "2.0": [ { "comment_text": "", "digests": { "md5": "865e221a770b761717c2bb211a7c1a96", "sha256": "8626624b11aac27dfc533dae4f94b9417315e9145acc6e4aeb2f017dd2dfc13f" }, "downloads": -1, "filename": "MetOffer-2.0-py3-none-any.whl", "has_sig": false, "md5_digest": "865e221a770b761717c2bb211a7c1a96", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 3936, "upload_time": "2018-05-28T22:34:09", "url": "https://files.pythonhosted.org/packages/56/c5/d4d6536dedf95de5ee90e7851a0ba4e83e39eec47de31f922e2665a483c8/MetOffer-2.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "cb65637482bd9abaea3f2f8476e6ea3e", "sha256": "fa5762fcc92ba4540a8d6513fde11a9b3e5fc7560cd73e92f72133e48b6ef46c" }, "downloads": -1, "filename": "MetOffer-2.0.tar.gz", "has_sig": false, "md5_digest": "cb65637482bd9abaea3f2f8476e6ea3e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4795, "upload_time": "2018-05-28T22:34:10", "url": "https://files.pythonhosted.org/packages/c0/de/1968d11ffd4102a95372f028e932cef27c535574ad6eeef739e60912a6f1/MetOffer-2.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "865e221a770b761717c2bb211a7c1a96", "sha256": "8626624b11aac27dfc533dae4f94b9417315e9145acc6e4aeb2f017dd2dfc13f" }, "downloads": -1, "filename": "MetOffer-2.0-py3-none-any.whl", "has_sig": false, "md5_digest": "865e221a770b761717c2bb211a7c1a96", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 3936, "upload_time": "2018-05-28T22:34:09", "url": "https://files.pythonhosted.org/packages/56/c5/d4d6536dedf95de5ee90e7851a0ba4e83e39eec47de31f922e2665a483c8/MetOffer-2.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "cb65637482bd9abaea3f2f8476e6ea3e", "sha256": "fa5762fcc92ba4540a8d6513fde11a9b3e5fc7560cd73e92f72133e48b6ef46c" }, "downloads": -1, "filename": "MetOffer-2.0.tar.gz", "has_sig": false, "md5_digest": "cb65637482bd9abaea3f2f8476e6ea3e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4795, "upload_time": "2018-05-28T22:34:10", "url": "https://files.pythonhosted.org/packages/c0/de/1968d11ffd4102a95372f028e932cef27c535574ad6eeef739e60912a6f1/MetOffer-2.0.tar.gz" } ] }