[GRASS-user] Patching rasters based on other rasters

Ken Mankoff mankoff at gmail.com
Tue Oct 17 04:38:34 PDT 2017


Dear GRASS List,

I'm trying to do something in GRASS and can't figure out an efficient way to do it. I'm guessing it is possible with 1-3 lines, but don't know which ones. The algorithm I'm developing would be much more complex, and I hope someone can suggest a shortcut.

I have several satellite products of the same region each day. For simplicity sake lets assume 3 overlapping solar zenith angle (SZA) products, and for each of those a visual image (VIS). I'd like to have one visual raster that, for each pixel, has the minimum SZA.

I can get the minimum SZA for each pixel with

r.mapcalc "SZA_min = min(SZA1,SZA2,SZA3)"

But now I've lost the source of the minimum SZA, and I need it to link SZA1 with VIS1. 

I could encode categories for each SZA:
r.category map=SZA1 cats=0-360 values=1
r.category map=SZA2 cats=0-360 values=2
r.category map=SZA3 cats=0-360 values=3

And then 

r.mapcalc "SZA_min_cat = min(@SZA1, at SZA2, at SZA3)"

And then use SZA_min_cat (values: 1 to 3) as a lookup to VIS1,VIS2,VIS3. I'm actually not clear how to do this last step, if this is the correct approach. Do I return to r.mapcalc, or is r.univar the right tool? 

Any help will be much appreciated.

Thanks,

  -k.
  


More information about the grass-user mailing list