Skip to content

Commit

Permalink
i.cva: write color table and legend
Browse files Browse the repository at this point in the history
  • Loading branch information
neteler committed Jan 14, 2020
1 parent f43c60d commit a3feeb3
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions grass7/imagery/i.cva/i.cva.py
Expand Up @@ -2,10 +2,10 @@
#
############################################################################
#
# MODULE: i.cva
# MODULE: i.cva
# AUTHOR(S): Anna Zanchetta
#
# PURPOSE: Performs Change Vector Analysis (CVA) in two dimensions
# PURPOSE: Performs Change Vector Analysis (CVA) in two dimensions
#
# COPYRIGHT: (C) 2016 by Anna Zanchetta and the GRASS Development Team
#
Expand Down Expand Up @@ -185,6 +185,20 @@ def main():
else:
grass.message(_("No threshold given, only angle and magnitude maps have been created"))

# anglemap_class: set colors
iva_colors = '1 217 255 0\n2 10 214 10\n3 75 173 255\n4 139 105 20\nnv 255 255 255\ndefault 255 255 255'
p = grass.feed_command('r.colors', map=anglemap_class, rules='-')
p.stdin.write(iva_colors.encode())
p.stdin.close()

# anglemap_class: set categories
rules = ['1:moisture reduction',
'2:chlorophyll increase',
'3:moisture increase',
'4:bare soil increase']
p = grass.feed_command('r.category', map=anglemap_class, rules='-', separator=':')
p.stdin.write(('\n'.join(rules)).encode())
p.stdin.close()

return 0

Expand Down

0 comments on commit a3feeb3

Please sign in to comment.