{ "info": { "author": "Julien Lerat", "author_email": "julien.lerat@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 2.6" ], "description": "faodata\n=======\n\nA simple python interface to download data from the Food and Agriculture Organisation (FAO).\n\nWhat is faodata?\n~~~~~~~~~~~~~~~~\n\n- faodata is a simple python interface to find and request data from\n the Food and Agriculture organization of the United Nations\n (`FAO `__).\n- The package uses the `FAO API `__.\n- Country boundaries that are used to plot data are from `Natural Earth\n (1:110m\n resolution) `__\n\nInstallation\n~~~~~~~~~~~~\n\n``pip install faodata`` or download the `source\ncode `__ and\n``python setup.py install``\n\nBasic use\n~~~~~~~~~\n\nTo download data, the id of the database, dataset and fields are\nrequired:\n\n- To get the list of FAO databases:\n\n .. code:: Python\n\n from faodata import faodownload\n databases = faodownload.get_databases()\n\n- To get the list of FAO datasets in a given database (e.g. faostat):\n\n .. code:: python\n\n database_id = 'faostat'\n datasets = faodownload.get_datasets(database_id)\n\n- To get the list of FAO fields in a given dataset (e.g. live-prod):\n\n .. code:: python\n\n database_id = 'faostat'\n dataset_id = 'live-prod'\n fields = faodownload.get_fields(database_id, dataset_id)\n\nWhen all the previous elements are known, the download procedure is\n\n.. code:: python\n\n database_id = 'faostat'\n dataset_id = 'live-prod'\n field_id = 'm5111'\n\n # Define the year (if None, all years are retrieved)\n year = 2010\n\n # Define country (if None, all countries are retrieved)\n # The country id is the ISO3 code\n # see https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3 \n country_id = None\n\n # Get data\n data = faodownload.get_data(database_id, dataset_id, field_id, country=country_id, year=year)\n\nWhen data is downloaded, it can be displayed on a world map\n\n.. code:: Python\n\n import numpy as np\n import matplotlib.pyplot as plt\n from mpl_toolkits import basemap\n from faodata import faodownload, faomap\n\n # Download data\n database_id = 'faostat'\n dataset_id = 'live-prod'\n field_id = 'm5111'\n year = 2013\n data = faodownload.get_data(database_id, dataset_id, field_id, year=year)\n\n # Select data\n item = 'Cattle'\n idx = data['Item'] == item\n data = data.loc[idx, ['country', 'value']]\n\n # Instantiate matplotlib and basemap objects\n plt.close('all')\n fig, ax = plt.subplots()\n map = basemap.Basemap(projection='robin', \\\n lon_0=10, lat_0=50, ax = ax)\n\n map.drawcoastlines(color='grey')\n map.drawcountries(color='grey')\n\n # Categorize data according to percentiles\n cat = [np.percentile(data['value'], pp) \\\n for pp in range(10, 100, 10)]\n\n # Draw plot\n faomap.plot(map, data, cat, ndigits=0)\n\n map.ax.legend(loc=3)\n ax.set_title('%s population, %d' % (item, year),\n fontsize=15)\n\n # Add a footer to the figure to \n # indicate data source\n faomap.mapfooter(fig, database_id, dataset_id, field_id)\n\nMore examples in the `example folder `__ directory.", "description_content_type": null, "docs_url": null, "download_url": "https://bitbucket.org/jlerat/faodata/downloads", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://bitbucket.org/jlerat/faodata", "keywords": "FAO,Web Service,GIS", "license": "MIT", "maintainer": null, "maintainer_email": null, "name": "faodata", "package_url": "https://pypi.org/project/faodata/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/faodata/", "project_urls": { "Download": "https://bitbucket.org/jlerat/faodata/downloads", "Homepage": "https://bitbucket.org/jlerat/faodata" }, "release_url": "https://pypi.org/project/faodata/1.1/", "requires_dist": null, "requires_python": null, "summary": "Download data from the Food and Agriculture Organisation (FAO)", "version": "1.1" }, "last_serial": 1788235, "releases": { "1.0": [ { "comment_text": "", "digests": { "md5": "a732f64d72ddb4e0e9a683e763768755", "sha256": "1e99f2c553a705edeee1fbab06b37c8783bd9d2aaeb53b3f20ab1548d191451b" }, "downloads": -1, "filename": "faodata-1.0.tar.gz", "has_sig": false, "md5_digest": "a732f64d72ddb4e0e9a683e763768755", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 189942, "upload_time": "2015-09-30T12:18:48", "url": "https://files.pythonhosted.org/packages/05/af/0fbab378b06a9632b6865316a29ede5791ca8d7629953b0c72df79663474/faodata-1.0.tar.gz" } ], "1.1": [ { "comment_text": "", "digests": { "md5": "af5ab0ed143b1b60eb2ab0611c1e7215", "sha256": "2504299183914ebfa6804e80bb5ea6420a5fe2e16611c248af5a83d99ef62374" }, "downloads": -1, "filename": "faodata-1.1.tar.gz", "has_sig": false, "md5_digest": "af5ab0ed143b1b60eb2ab0611c1e7215", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 193790, "upload_time": "2015-10-27T11:24:07", "url": "https://files.pythonhosted.org/packages/86/62/4ba2f278aab1835a4f517f539c3962749a82092f94210b02dc1bafff3081/faodata-1.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "af5ab0ed143b1b60eb2ab0611c1e7215", "sha256": "2504299183914ebfa6804e80bb5ea6420a5fe2e16611c248af5a83d99ef62374" }, "downloads": -1, "filename": "faodata-1.1.tar.gz", "has_sig": false, "md5_digest": "af5ab0ed143b1b60eb2ab0611c1e7215", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 193790, "upload_time": "2015-10-27T11:24:07", "url": "https://files.pythonhosted.org/packages/86/62/4ba2f278aab1835a4f517f539c3962749a82092f94210b02dc1bafff3081/faodata-1.1.tar.gz" } ] }