项目作者: dgketchum

项目描述 :
Python package to process images from Landsat tellites and return geographic information, cloud mask, numpy array, geotiff.
高级语言: Python
项目地址: git://github.com/dgketchum/satellite_image.git
创建时间: 2017-04-28T17:05:13Z
项目社区:https://github.com/dgketchum/satellite_image

开源协议:Apache License 2.0

下载


" class="reference-link">satellite_image

Build Status
codecov

satellite_image

Provides a class to process images from various satellites, return: geographic information,
cloud mask, reflectance, brightness temperature.

At this point, Landsat 5, 7, 8 (i.e., TM, ETM+, OLI, TIRS; a.k.a. LT5, LE7, LC8) are supported.
Use Landsat 578 to download and unzip an image based on
the date and the location, pass the directory containing the unzipped package of files,
and get an object that full attributes, a bounding feature, and methods to return ndarrays
with all the information we want from Landsat:

  • Fmask cloudmask, water mask, shadow mask, or combination mask.
  • NDVI, NDSI; Normalized difference vegetation density, snow density.
  • At-satellite brightness temperature for thermal bands.
  • Reflectance for optical bands.
  • Albedo using the method from Smith, currently working on Tasumi.
  • Save any of these arrays as a GeoTiff.

Installation:

  1. pip install SatelliteImage

Given this small section of a Landsat 7 image of the S. Flathead Lake and the
Mission Mountians in Montana, ETM+ band 5:

" class="reference-link">satellite_image

  1. import os
  2. from sat_image.image import Landsat7
  3. from sat_image.fmask import Fmask
  4. def fmask(image_dir, outdir):
  5. l7 = Landsat7(image_dir)
  6. f = Fmask(l7)
  7. cloud, shadow, water = f.cloud_mask()
  8. combo = f.cloud_mask(combined=True)
  9. f.save_array(cloud, os.path.join(outdir, 'cloud_mask_l7.tif'))
  10. f.save_array(shadow, os.path.join(outdir, 'shadow_mask_l7.tif'))
  11. f.save_array(water, os.path.join(outdir, 'water_mask_l7.tif'))
  12. f.save_array(combo, os.path.join(outdir, 'combo_mask_l7.tif'))
  13. return None
  14. if __name__ == '__main__':
  15. image_directory = os.path.join('data', 'images', 'LE70410272007125EDC00')
  16. out_directory = os.path.join('data', 'masks')
  17. fmask(image_directory, out_directory)

Gives the cloud mask:

the shadow mask:

the water mask:

or a combination of all masks, leaving 0 everywhere there is clear sky:

  1. import os
  2. import datetime
  3. from sat_image.image import Landsat7
  4. def ndvi(image_dir, outdir):
  5. l7 = Landsat7(image_dir)
  6. ndvi = l7.ndvi()
  7. date = l7.date_acquired
  8. date_str = datetime.datetime.strftime(date, '%Y%m%d')
  9. ndvi.save_array(ndvi, os.path.join(outdir, 'ndvi_l7_{}.tif'.format(date_str)))
  10. return None
  11. if __name__ == '__main__':
  12. out_directory = os.path.join('data', 'ndvi')
  13. image_directory = os.path.join('data', 'images', 'LE70410272007125EDC00')
  14. fmask(image_directory, out_directory)

Gives NDVI, or Normalized Density Vegetation Index:

and so on…

We’re currently working on atmospheric corrections based on Tasumi (2008). Please
contribute and make a pull request!