{ "info": { "author": "Yann Forget", "author_email": "yannforget@mailbox.org", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "Intended Audience :: Science/Research", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Topic :: Scientific/Engineering :: GIS" ], "description": "# Description\n\n**pylandsat** is a Python package that allows you to search and download\nLandsat scenes from the public dataset hosted on\n[Google Cloud](https://cloud.google.com/storage/docs/public-datasets/landsat).\nAdditionally, it includes a set of classes and methods to access and\npreprocess the downloaded scenes.\n\nOnly Landsat [Collection 1](https://landsat.usgs.gov/landsat-collections) is supported, i.e. level-1 data products from the following sensors and satellite missions:\n\n* Landsat 8 OLI/TIRS\n* Landsat 7 ETM+\n* Landsat 4-5 TM\n* Landsat 1-5 MSS\n\n# Installation\n\n`pip install pylandsat`\n\n# Command-line interface\n\n## Download one or multiple scenes\n\n### Usage\n\n```bash\nUsage: pylandsat download [OPTIONS] [PRODUCTS]...\n\n Download a Landsat product according to its identifier.\n\nOptions:\n -d, --output-dir PATH Output directory.\n -f, --files TEXT Comma-separated list of files to download.\n --help Show this message and exit.\n```\n\n### Examples\n\n```bash\n# Download an entire product in the current directory\npylandsat download LE07_L1TP_205050_19991104_20170216_01_T1\n\n# Download multiple products\npylandsat download \\\n LE07_L1TP_205050_19991104_20170216_01_T1 \\\n LE07_L1TP_206050_19991111_20170216_01_T1\n\n# Download only the blue, green and red bands\npylandsat download --files B1.TIF,B2.TIF,B3.TIF \\\n LE07_L1TP_205050_19991104_20170216_01_T1\n\n# Download only quality band\npylandsat download --files BQA.TIF \\\n LE07_L1TP_205050_19991104_20170216_01_T1\n```\n\n## Search for scenes\n\nTo allow large and fast queries, **pylandsat** works with a local dump of the Landsat catalog hosted on Google Cloud. As such, an initial sync is required :\n\n```bash\n# Sync local Landsat catalog\npylandsat sync-database\n\n# Force update\npylandsat -f sync-database\n```\n\nThe database is stored in a local directory that can be displayed using the following command :\n\n```bash\npylandsat print-datadir\n```\n\nOnce the database has been created, the local catalog can be queried.\n\n### Usage\n\n```bash\nUsage: pylandsat search [OPTIONS]\n\n Search for scenes in the Google Landsat Public Dataset catalog.\n\nOptions:\n -b, --begin TEXT Begin search date (YYYY-MM-DD).\n -e, --end TEXT End search date (YYYY-MM-DD).\n -g, --geojson PATH Area of interest (GeoJSON file).\n -l, --latlon FLOAT... Point of interest (decimal lat/lon).\n -p, --path INTEGER WRS2 path.\n -r, --row INTEGER WRS2 row.\n -c, --clouds FLOAT Max. cloud cover percentage.\n -s, --sensors TEXT Comma-separated list of possible sensors.\n -t, --tiers TEXT Comma-separated list of possible collection tiers.\n --slcoff Include SLC-off LE7 scenes.\n -o, --output PATH Output CSV file.\n --help Show this message and exit.\n```\n\nAt least three options must be provided: `--begin` and `--end` (i.e. the period of interest), and a geographic extent (`--path` and `--row`, `--latlon`, `--address` or `--geojson`). By default, **pylandsat** lists all the product IDs matching the query. The full response can be exported to a CSV file using the `--output` option. Note that is the spatial extent is provided as a GeoJSON file, only the first feature will be considered.\n\n### Examples\n\n```bash\n# If only the year is provided, date is set to January 1st\npylandsat search \\\n --begin 1999 --end 2000 \\\n --path 206 --row 50 \\\n --clouds 0\n\n# Using latitude and longitude\npylandsat search \\\n --begin 2000 --end 2010 \\\n --latlon 50.85 4.34\n\n# Using a polygon in a GeoJSON file\npylandsat search \\\n --begin 2000 --end 2010 \\\n --geojson brussels.geojson\n\n# Using an address that will be geocoded\npylandsat search \\\n --begin 2000 --end 2010 \\\n --address 'Brussels, Belgium'\n\n# Limit to TM and ETM sensors\npylandsat search \\\n --begin 1990 --end 2010 \\\n --address 'Brussels, Belgium' \\\n --sensors LT04,LT05,LE07\n\n# Export results into a CSV file\npylandsat search \\\n --begin 1990 --end 2010 \\\n --address 'Brussels, Belgium' \\\n --sensors LT04,LT05,LE07 \\\n --output scenes.csv\n```\n\n```bash\n# List available sensors, i.e. possible values\n# for the `--sensors` option\npylandsat list-sensors\n\n# List available files for a given sensor\npylandsat list-available-files LT05\n```\n\n# Python API\n\n## Search the catalog\n\n``` python\nfrom datetime import datetime\n\nimport pandas as pd\nfrom shapely.geometry import Point\nfrom pylandsat import Catalog, Product\n\ncatalog = Catalog()\n\nbegin = datetime(2000, 1, 1)\nend = datetime(2010, 1, 1)\ngeom = Point(4.34, 50.85)\n\n# Results are returned as a pandas dataframe\nscenes = catalog.search(\n begin=begin,\n end=end,\n geom=geom,\n sensors=['ETM', 'LC08']\n)\n\n# Get the product ID of the scene with the lowest cloud cover\nscenes = scenes.sort_values(by='cloud_cover', ascending=True)\nproduct_id = scenes.index[0]\n\n# Download the scene\nproduct = Product(product_id)\nproduct.download(out_dir='data')\n```\n\n## Load and preprocess data\n\n``` python\nimport numpy as np\nimport rasterio\nimport matplotlib.pyplot as plt\nfrom pylandsat import Scene\n\n# Access data\nscene = Scene('data/LE07_L1TP_205050_19991104_20170216_01_T1')\nprint(scene.available_bands())\nprint(scene.product_id)\nprint(scene.sensor)\nprint(scene.date)\n\n# Access MTL metadata\nprint(scene.mtl['IMAGE_ATTRIBUTES']['CLOUD_COVER_LAND'])\n\n# Quality band\nplt.imshow(scene.quality.read())\n\n# Access band data\nnir = scene.nir.read(1)\nred = scene.red.read(1)\nndvi = (nir + red) / (nir - red)\n\n# Access band metadata\nprint(scene.nir.bname)\nprint(scene.nir.fname)\nprint(scene.nir.profile)\nprint(scene.nir.width, scene.nir.height)\nprint(scene.nir.crs)\n\n# Use reflectance values instead of DN\nnir = scene.nir.to_reflectance()\n\n# ..or brightness temperature\ntirs = scene.tirs.to_brightness_temperature()\n\n# Save file to disk\nwith rasterio.open('temperature.tif', 'w', **scene.tirs.profile) as dst:\n dst.write(tirs, 1)\n```\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/yannforget/pylandsat", "keywords": "earth observation,gis,remote sensing,landsat", "license": "", "maintainer": "", "maintainer_email": "", "name": "pylandsat", "package_url": "https://pypi.org/project/pylandsat/", "platform": "", "project_url": "https://pypi.org/project/pylandsat/", "project_urls": { "Homepage": "https://github.com/yannforget/pylandsat" }, "release_url": "https://pypi.org/project/pylandsat/0.2/", "requires_dist": [ "click", "appdirs", "requests", "fiona", "shapely", "pandas", "tqdm", "numpy", "rasterio", "geopy" ], "requires_python": "", "summary": "Search, download and preprocess Landsat imagery", "version": "0.2" }, "last_serial": 4424974, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "57524144131c9f20d3ce358af15aa65f", "sha256": "ec94f37eb8450a866e8da7365a4179c2afa7742f37072fa38bb374a26b5495c7" }, "downloads": -1, "filename": "pylandsat-0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "57524144131c9f20d3ce358af15aa65f", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 18215, "upload_time": "2018-10-25T11:28:06", "url": "https://files.pythonhosted.org/packages/59/12/b2f0a7a3b1a4a150cf6449ca91ddcc578786aaa28ab15be5404d62fcf2ca/pylandsat-0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f5d8404f5372760bdb8b99fd93705e09", "sha256": "18cbfe24464b055676107dc16cb4c0d39406b42f398d86b87bb915df5a31b919" }, "downloads": -1, "filename": "pylandsat-0.1.tar.gz", "has_sig": false, "md5_digest": "f5d8404f5372760bdb8b99fd93705e09", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18134, "upload_time": "2018-10-25T11:28:07", "url": "https://files.pythonhosted.org/packages/d0/44/483947e056dccdb52d13527751b9d9a2677c4622c1617d3f2018bf4ad204/pylandsat-0.1.tar.gz" } ], "0.2": [ { "comment_text": "", "digests": { "md5": "2373793249ea3cdd702fbc6f9f3ef9cd", "sha256": "4d5d56ca11cda680e5cc3439aeff28ced7215f158a12c276e4192d8145a7e9ca" }, "downloads": -1, "filename": "pylandsat-0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "2373793249ea3cdd702fbc6f9f3ef9cd", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 18289, "upload_time": "2018-10-28T18:29:12", "url": "https://files.pythonhosted.org/packages/e6/05/e8a0bdc339beb2af052bb7b6dd9b8f91f805ca42715f033d9316c53c6492/pylandsat-0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "447eb5c6d78c0d054ceaaf857ea0281a", "sha256": "b24cbb37074b4a8f979f74794bb529d22c630c10794e0ba576039fd460265a38" }, "downloads": -1, "filename": "pylandsat-0.2.tar.gz", "has_sig": false, "md5_digest": "447eb5c6d78c0d054ceaaf857ea0281a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18205, "upload_time": "2018-10-28T18:29:13", "url": "https://files.pythonhosted.org/packages/c6/73/a182f780e49bd9e2962a5b14f3f6f06e73a60898d2854a5f396a798fede5/pylandsat-0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "2373793249ea3cdd702fbc6f9f3ef9cd", "sha256": "4d5d56ca11cda680e5cc3439aeff28ced7215f158a12c276e4192d8145a7e9ca" }, "downloads": -1, "filename": "pylandsat-0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "2373793249ea3cdd702fbc6f9f3ef9cd", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 18289, "upload_time": "2018-10-28T18:29:12", "url": "https://files.pythonhosted.org/packages/e6/05/e8a0bdc339beb2af052bb7b6dd9b8f91f805ca42715f033d9316c53c6492/pylandsat-0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "447eb5c6d78c0d054ceaaf857ea0281a", "sha256": "b24cbb37074b4a8f979f74794bb529d22c630c10794e0ba576039fd460265a38" }, "downloads": -1, "filename": "pylandsat-0.2.tar.gz", "has_sig": false, "md5_digest": "447eb5c6d78c0d054ceaaf857ea0281a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18205, "upload_time": "2018-10-28T18:29:13", "url": "https://files.pythonhosted.org/packages/c6/73/a182f780e49bd9e2962a5b14f3f6f06e73a60898d2854a5f396a798fede5/pylandsat-0.2.tar.gz" } ] }