[GRASS-user] computation in a location based on infos from another location

Patrice Dumas pertusus at free.fr
Thu Nov 19 06:19:33 EST 2009


Hello,

I have 2 locations, one with a lambert projection with a 1 km grid
(comes from hydro1k), covering africa, and the other with a longitude latitude
projection with a 0.5 decimal degrees grid (covering the world). I have a 
raster map on the lambert location that has values of 1 for a given area and 
0 (or null) otherwise (corresponds with upstream basins) and I would like to 
compute the corresponding area covered on the lonlat grid. This would lead 
to a value for each cell in the lonlat grid corresponding with the fraction
of the grid cell covered by 1 in the lambert map. So, for example, if the 
cell is completly in the area in the lambert map, the value in the lonlat map
should be 1, and if half of the area of the cell from the lonlat map
is covered by ones in the lambert map, the value in the lonlat map should
be 0.5.

If the two maps were in the same location, I could set the region
to be the one of the lonlat map, and do

r.resamp.stats -w input=lambert_map output=fraction_covered

But r.resamp.stats doesn't work with maps from different locations.
And it seems to me that r.proj forgets the information about the 
initial grid although in this case it should be kept.

I have read the manual pages and the wiki but couldn't find anything
answering my question, except that it seems to be something uneasy to 
do in grass, since operations on different locations cannot be done in order
to avoid losses of accuracy:
http://grass.osgeo.org/wiki/Location_and_Mapsets

I may be wrong, but it seems to me that this kind of use of ratios to 
interpolate from a grid to another would be something that is done
regularly, and I guess that other kind of computations requiring
that geographic informations are not lost for each map would also
be useful.

--
Pat


More information about the grass-user mailing list