Skip to content

Commit

Permalink
fixed ags issue #36 and changelog update
Browse files Browse the repository at this point in the history
  • Loading branch information
ircwaves committed Feb 21, 2016
1 parent f1afe13 commit cf039f9
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 10 deletions.
7 changes: 6 additions & 1 deletion CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,12 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>
################################################################################
v0.8.2
- landsat assets now tagged as 'DN' and 'SR' for USGS downloaded surface reflectance.
- landsat assets now tagged as 'DN' and 'SR' for USGS downloaded surface
reflectance.
- added landsat 'bqashadow' product that uses `gippy.algorithms.AddShadowMask`
to catch shadows of BQA detected clouds via shadow smear.
- enabled `--sensors` filter for landsat.
- fixed: `gips.tiles.Tiles.pprint` TypeError when `colors` is None

v0.8.1
- added support for `alltouch` paramter in CookieCutter (gippy==0.3.6)
Expand Down
26 changes: 17 additions & 9 deletions gips/tiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,29 +141,37 @@ def pprint_asset_header(self):
""" Print asset header """
self.dataclass.pprint_asset_header()

def _colorize_product(self, prod, colors=None):
color = ['', '']
if colors is not None:
s = self.which_sensor(prod)
if s is not None:
color = [colors[s], Colors.OFF]
return color[0] + prod + color[1]


def pprint(self, dformat='%j', colors=None):
""" Print coverage for each and every asset """
#assets = [a for a in self.dataclass.Asset._assets]
sys.stdout.write('{:^12}'.format(self.date.strftime(dformat)))
asset_coverage = self.asset_coverage()
for a in sorted(asset_coverage):
color = ['', '']
if colors is not None:
s = self.which_sensor(a)
if s is not None:
color = [colors[s], Colors.OFF]
cov = asset_coverage[a]
if cov > 0:
sys.stdout.write(color[0] + ' {:>4.1f}% '.format(cov) + color[1])
text = self._colorize_product(
' {:>4.1f}% '.format(cov), colors
)
else:
sys.stdout.write(' ')
text = ' '
sys.stdout.write(text)

products = [p for t in self.tiles for p in self.tiles[t].products]
# Check product is available for all tiles before reporting as processed
prods = []
for p in set(products):
if products.count(p) == len(self.tiles):
prods.append(p)
for p in sorted(set(prods)):
color = colors[self.which_sensor(p)]
sys.stdout.write(' ' + color + p + Colors.OFF)
text = self._colorize_product(p, colors)
sys.stdout.write(' ' + text)
sys.stdout.write('\n')

0 comments on commit cf039f9

Please sign in to comment.