Skip to content

Commit 14f14ec

Browse files
author
Scisco
committed
Merge pull request #156 from developmentseed/develop
0.12.1
2 parents a1375e5 + ede7714 commit 14f14ec

File tree

3 files changed

+18
-16
lines changed

3 files changed

+18
-16
lines changed

landsat/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '0.12.0'
1+
__version__ = '0.12.1'

landsat/image.py

+16-11
Original file line numberDiff line numberDiff line change
@@ -184,9 +184,10 @@ def _get_full_filename(self, band):
184184

185185
def _check_if_zipped(self, path):
186186
""" Checks if the filename shows a tar/zip file """
187+
187188
filename = get_file(path).split('.')
188189

189-
if filename[-1] in ['bz', 'bz2']:
190+
if filename[-1] in ['bz', 'bz2', 'gz']:
190191
return True
191192

192193
return False
@@ -260,22 +261,26 @@ def _write_to_file(self, new_bands, **kwargs):
260261
# Color Correction
261262
band = self._color_correction(band, self.bands[i], 0, coverage)
262263

263-
output.write_band(i+1, img_as_ubyte(band))
264+
output.write_band(i + 1, img_as_ubyte(band))
264265

265266
new_bands[i] = None
266267
self.output("Writing to file", normal=True, color='green', indent=1)
267268

268269
return output_file
269270

270271
def _color_correction(self, band, band_id, low, coverage):
271-
self.output("Color correcting band %s" % band_id, normal=True, color='green', indent=1)
272-
p_low, cloud_cut_low = self._percent_cut(band, low, 100 - (coverage * 3 / 4))
273-
temp = numpy.zeros(numpy.shape(band), dtype=numpy.uint16)
274-
cloud_divide = 65000 - coverage * 100
275-
mask = numpy.logical_and(band < cloud_cut_low, band > 0)
276-
temp[mask] = rescale_intensity(band[mask], in_range=(p_low, cloud_cut_low), out_range=(256, cloud_divide))
277-
temp[band >= cloud_cut_low] = rescale_intensity(band[band >= cloud_cut_low], out_range=(cloud_divide, 65535))
278-
return temp
272+
if self.bands == [4, 5]:
273+
return band
274+
else:
275+
self.output("Color correcting band %s" % band_id, normal=True, color='green', indent=1)
276+
p_low, cloud_cut_low = self._percent_cut(band, low, 100 - (coverage * 3 / 4))
277+
temp = numpy.zeros(numpy.shape(band), dtype=numpy.uint16)
278+
cloud_divide = 65000 - coverage * 100
279+
mask = numpy.logical_and(band < cloud_cut_low, band > 0)
280+
temp[mask] = rescale_intensity(band[mask], in_range=(p_low, cloud_cut_low), out_range=(256, cloud_divide))
281+
temp[band >= cloud_cut_low] = rescale_intensity(band[band >= cloud_cut_low],
282+
out_range=(cloud_divide, 65535))
283+
return temp
279284

280285
def _percent_cut(self, color, low, high):
281286
return numpy.percentile(color[numpy.logical_and(color > 0, color < 65535)], (low, high))
@@ -492,7 +497,7 @@ def _write_to_file(self, new_bands, pan, **kwargs):
492497
band = numpy.multiply(band, pan)
493498
band = self._color_correction(band, self.bands[i], 0, coverage)
494499

495-
output.write_band(i+1, img_as_ubyte(band))
500+
output.write_band(i + 1, img_as_ubyte(band))
496501

497502
new_bands[i] = None
498503

setup.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def readme():
3535
license='CCO',
3636
platforms='Posix; MacOS X; Windows',
3737
install_requires=[
38-
'usgs==0.1.9',
38+
'usgs2==0.2.0',
3939
'requests==2.7.0',
4040
'python-dateutil>=2.4.2',
4141
'numpy>=1.9.3',
@@ -49,9 +49,6 @@ def readme():
4949
'polyline==1.1',
5050
'geocoder>=1.5.1'
5151
],
52-
dependency_links=[
53-
"git+https://github.com/developmentseed/usgs@develop#egg=usgs-0.1.9"
54-
],
5552
test_suite='nose.collector',
5653
tests_require=test_requirements
5754
)

0 commit comments

Comments
 (0)