Skip to content

Commit

Permalink
Merge pull request #121 from developmentseed/develop
Browse files Browse the repository at this point in the history
version 0.9.0
  • Loading branch information
Scisco committed Oct 23, 2015
2 parents 4589a10 + 2355ff0 commit 004611e
Show file tree
Hide file tree
Showing 27 changed files with 1,643 additions and 389 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ deploy:
password:
secure: WtawFW/999XYszmZfj1Qk82l00OSyP2JBVOOGCERrW1gVO7MYtYsgP31HKRSzNTCTHJNVDpdK4WZWY6zPQqC3l2UfWYYsvRn0hCoI8AJxE5VCUEg6Ccpe6fMJuhp1pq6Zy7yrfBSZcOB9aqSHLBJsunD2o3mNlTC8WV8vNK74ck=
on:
tags: true
repo: developmentseed/landsat-util
branch: master

Expand Down
9 changes: 9 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
Changes
=======

0.9.0 (2015-10-23)
------------------
- Improved pansharpening
- Use BQA bands for cloud/snow coverage and use in color correction
- Fix a bug in NDVI process where novalues appeared in the image
- Add support for different NDVI color maps (three included)
- Add support for image clipping using the new `--clip` flag
- Multiple bug fixes

0.8.0 (2015-09-22)
------------------
- Improved docs
Expand Down
10 changes: 7 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
FROM ubuntu:14.10
FROM ubuntu:14.04
RUN apt-get -y update
RUN apt-get install --yes python-pip python-numpy python-scipy libgdal-dev libatlas-base-dev gfortran libfreetype6-dev libglib2.0-dev zlib1g-dev python-pycurl
RUN pip install landsat-util
RUN apt-get install --yes python-pip python-skimage python-numpy python-scipy libgdal-dev libatlas-base-dev gfortran libfreetype6-dev libglib2.0-dev zlib1g-dev python-pycurl
ADD landsat /usr/local/lib/python2.7/dist-packages/landsat
ADD bin/landsat /usr/local/bin/
ADD . /landsat
RUN cd /landsat && pip install -r requirements/docker.txt

7 changes: 3 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,13 @@ docs:
$(MAKE) -C docs html
open docs/_build/html/index.html

docs-test:
python setup.py check --restructuredtext

test-release: clean
python setup.py sdist upload -r pypitest
python setup.py bdist_wheel upload -r pypitest

vagrant:
vagrant up
vagrant destroy

release: clean
python setup.py sdist upload
python setup.py bdist_wheel upload
Expand Down
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@ Recently Added Features
- Add more color options such as false color, true color, etc.

Change Log
+++++++++
++++++++++

See `CHANGES.txt <CHANGES.rst>`_.
See `CHANGES.txt <CHANGES.txt>`_.
130 changes: 130 additions & 0 deletions docs/commands.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
Commands
========

::

usage: landsat [-h] [--version] {search,download,process} ...

Landsat-util is a command line utility that makes it easy to
search, download, and process Landsat imagery.

Commands:
Search:
landsat.py search [-p --pathrow] [--lat] [--lon] [-l LIMIT] [-s START] [-e END] [-c CLOUD] [-h]

optional arguments:
-p, --pathrow Paths and Rows in order separated by comma. Use quotes "001,003".
Example: path,row,path,row 001,001,190,204

--lat Latitude

--lon Longitude

-l LIMIT, --limit LIMIT
Search return results limit default is 10

-s START, --start START
Start Date - Most formats are accepted e.g.
Jun 12 2014 OR 06/12/2014

-e END, --end END End Date - Most formats are accepted e.g.
Jun 12 2014 OR 06/12/2014

--latest N Returns the N latest images within the last 365 days.

-c CLOUD, --cloud CLOUD
Maximum cloud percentage. Default: 20 perct

-h, --help Show this help message and exit

Download:
landsat download sceneID [sceneID ...] [-h] [-b --bands]

positional arguments:
sceneID Provide Full sceneIDs. You can add as many sceneIDs as you wish

Example: landast download LC81660392014196LGN00

optional arguments:
-b --bands If you specify bands, landsat-util will try to download the band from S3.
If the band does not exist, an error is returned

-h, --help Show this help message and exit

-d, --dest Destination path

-p, --process Process the image after download

--pansharpen Whether to also pansharpen the processed image.
Pansharpening requires larger memory

--ndvi Calculates NDVI and produce a RGB GTiff with seperate colorbar.

--clip Clip the image with the bounding box provided. Values must be in WGS84 datum,
and with longitude and latitude units of decimal degrees separated by comma.
Example: --clip -346.06658935546875,49.93531194616915,-345.4595947265625,50.2682767372753

-u --upload Upload to S3 after the image processing completed

--key Amazon S3 Access Key (You can also be set AWS_ACCESS_KEY_ID as
Environment Variables)

--secret Amazon S3 Secret Key (You can also be set AWS_SECRET_ACCESS_KEY as
Environment Variables)

--bucket Bucket name (required if uploading to s3)

--region URL to S3 region e.g. s3-us-west-2.amazonaws.com

--force-unzip Force unzip tar file

Process:
landsat.py process path [-h] [-b --bands] [-p --pansharpen]

positional arguments:
path Path to the landsat image folder or zip file

optional arguments:
-b --bands Specify bands. The bands should be written in sequence with no spaces
Default: Natural colors (432)
Example --bands 432

--pansharpen Whether to also pansharpen the process image.
Pansharpening requires larger memory

--ndvi Calculates NDVI and produce a RGB GTiff with seperate colorbar.

--ndvigrey Calculates NDVI and produce a greyscale GTiff.

--clip Clip the image with the bounding box provided. Values must be in WGS84 datum,
and with longitude and latitude units of decimal degrees separated by comma.
Example: --clip -346.06658935546875,49.93531194616915,-345.4595947265625,50.2682767372753

-v, --verbose Show verbose output

-h, --help Show this help message and exit

-u --upload Upload to S3 after the image processing completed

--key Amazon S3 Access Key (You can also be set AWS_ACCESS_KEY_ID as
Environment Variables)

--secret Amazon S3 Secret Key (You can also be set AWS_SECRET_ACCESS_KEY as
Environment Variables)

--bucket Bucket name (required if uploading to s3)

--region URL to S3 region e.g. s3-us-west-2.amazonaws.com

--force-unzip Force unzip tar file

positional arguments:
{search,download,process}
Landsat Utility
search Search Landsat metdata
download Download images from Google Storage
process Process Landsat imagery

optional arguments:
-h, --help show this help message and exit
--version show program's version number and exit
3 changes: 2 additions & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
landsat-util
==============
============

.. image:: https://travis-ci.org/developmentseed/landsat-util.svg?branch=v0.5
:target: https://travis-ci.org/developmentseed/landsat-util
Expand Down Expand Up @@ -30,6 +30,7 @@ You can also run your own API and connect it to this tool.

installation
overview
commands
todo
api
notes
Expand Down
94 changes: 94 additions & 0 deletions docs/landsat.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
landsat package
===============

Submodules
----------

landsat.decorators module
-------------------------

.. automodule:: landsat.decorators
:members:
:undoc-members:
:show-inheritance:

landsat.downloader module
-------------------------

.. automodule:: landsat.downloader
:members:
:undoc-members:
:show-inheritance:

landsat.image module
--------------------

.. automodule:: landsat.image
:members:
:undoc-members:
:show-inheritance:

landsat.landsat module
----------------------

.. automodule:: landsat.landsat
:members:
:undoc-members:
:show-inheritance:

landsat.mixins module
---------------------

.. automodule:: landsat.mixins
:members:
:undoc-members:
:show-inheritance:

landsat.ndvi module
-------------------

.. automodule:: landsat.ndvi
:members:
:undoc-members:
:show-inheritance:

landsat.search module
---------------------

.. automodule:: landsat.search
:members:
:undoc-members:
:show-inheritance:

landsat.settings module
-----------------------

.. automodule:: landsat.settings
:members:
:undoc-members:
:show-inheritance:

landsat.uploader module
-----------------------

.. automodule:: landsat.uploader
:members:
:undoc-members:
:show-inheritance:

landsat.utils module
--------------------

.. automodule:: landsat.utils
:members:
:undoc-members:
:show-inheritance:


Module contents
---------------

.. automodule:: landsat
:members:
:undoc-members:
:show-inheritance:
7 changes: 7 additions & 0 deletions docs/modules.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
landsat
=======

.. toctree::
:maxdepth: 4

landsat
6 changes: 6 additions & 0 deletions docs/overview.rst
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,12 @@ Process *and* pansharpen a downloaded image::

$: landsat process path/to/LC80090452014008LGN00.tar.bz --pansharpen

Clip an image before processing (The coordinates shows below show Prague)::

$: landsat process path/to/LC81920252015157LGN00.tar.bz --pansharpen --clip=-346.06658935546875,49.93531194616915,-345.4595947265625,50.2682767372753

Note: Values must be in WGS84 datum, and with longitude and latitude units of decimal degrees separated by comma.

A note on returned products
++++++++++++++++

Expand Down
2 changes: 1 addition & 1 deletion landsat/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.8.0'
__version__ = '0.9.0'
15 changes: 10 additions & 5 deletions landsat/downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,21 @@ def download(self, scenes, bands=None):

for scene in scenes:
# If bands are provided the image is from 2015 or later use Amazon
self.scene_interpreter(scene)

if (bands and int(scene[12]) > 4):
if isinstance(bands, list):
# Create a folder to download the specific bands into
path = check_create_folder(join(self.download_dir, scene))
try:
# Always grab MTL.txt if bands are specified
bands_plus = bands
bands_plus.append('MTL')
for band in bands_plus:
if 'BQA' not in bands:
bands.append('QA')

if 'MTL' not in bands:
bands.append('MTL')

for band in bands:
self.amazon_s3(scene, band, path)
output[scene] = 'aws'
except RemoteFileDoesntExist:
Expand Down Expand Up @@ -278,5 +284,4 @@ def scene_interpreter(self, scene):

d = Downloader()

# d.download(['LC81990242015046LGN00', 'LC80030172015001LGN00'])
d.download(['LC80030172015001LGN00'], bands=[5, 4])
# d.download(['LC81990242015046LGN00', 'LC80030172015001LGN00'])
Loading

0 comments on commit 004611e

Please sign in to comment.