tinting orthographic images

Rebecca Scheckler rebecca at vt.edu
Tue Jun 28 17:58:45 EDT 1994


Following a shell script written by Glenn Lawson, I have been able to tint
fields on orthographic image to represent crops or HEL.  Now I am trying to
tint soils for capability class.  This involves reclassing, resampling,
rescaling and then patching the component capability classes.  When I try
this, the script seems to run correctly but I end up with the wrong colors.
Could this be caused by the categories not being continuous?  My code
follows.  I am running grass4.1 on a sparc 2 with sunos 4.1.3.  The script
is in csh.

## lets see if we can tint soil classes
#use number of soil capability classes
set numcats=8

echo "The tint map, $tint, has $numcats soil categories."

#######do fields- loop through soil categories
set catno = 1
while ($catno <= $numcats)

r.reclass in=$tint out=MASK$catno << EOF
$catno = $catno
EOF

g.copy rast=MASK$catno,MASK >/dev/null
echo "resampling capability class  $catno ....."
r.resample in=$ortho out=T_ORTHO$catno
g.remove rast=MASK,MASK$catno >/dev/null

#target range
if ($catno == 1) then
    set rangeBegin = 1
else @ rangeBegin = $catno * 40 - 39
endif

  @ rangeEnd = $catno * 40

r.rescale in=T_ORTHO$catno out=T_ORTHO$catno.1 to=$rangeBegin,$rangeEnd
@ catno += 1
end
#end loop through fields

####patching maps
set ct = 1
set pmaps =  T_ORTHO1.1
@ catno = $numcats
while($ct < $catno)
  @ ct += 1
  echo "ct = $ct "
  set pmaps=$pmaps,T_ORTHO$ct.1
end

echo "patching maps together......"
r.patch  in=$pmaps out=soilsNE

set ct = 1
while ($ct <= $numcats + 1)
g.remove rast=T_ORTHO$ct,T_ORTHO$ct.1 >/dev/null
@ ct += 1
end

### rescale background and patch to tinted fields
if (-e $LOCATION/cats/rescaleOrtho) then
  ### DO NOTHING ###
else
r.rescale in=bridgene out=rescaleOrtho to=361,400
endif

r.patch in=soilsNE,rescaleOrtho, out=nresultSoilsNE

endif

#set proper colors for soil capability classes
cat ${colorrules} | r.colors map=nresultSoilsNE co=rules

#display tinted soils/home/grass4.1data
d.rast nresultSoilsNE
d.vect 16.nw color=black
d.vect streams.16 color=blue
d.vect soils.16 color=white


~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*
  Rebecca Scheckler                        rebecca at vt.edu(internet)
  Information Systems and Insect Studies   rebeccas at vtvm1(bitnet)
  Virginia Tech                            fax: 703-231-9131
  202 Price Hall                           phone: 703-231-7216
  Blacksburg, VA 24061-0319
~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*





More information about the grass-dev mailing list