[GRASS-dev] Re: [GRASS GIS] #1405: [PATCH] Direct floating point values comparison in r.terraflow

GRASS GIS trac at osgeo.org
Mon Jul 18 15:41:12 EDT 2011


#1405: [PATCH] Direct floating point values comparison in r.terraflow
-------------------------+--------------------------------------------------
 Reporter:  dron         |       Owner:  grass-dev@…              
     Type:  defect       |      Status:  new                      
 Priority:  normal       |   Milestone:                           
Component:  Raster       |     Version:  svn-trunk                
 Keywords:  r.terraflow  |    Platform:  Unspecified              
      Cpu:  Unspecified  |  
-------------------------+--------------------------------------------------

Comment(by glynn):

 Replying to [ticket:1405 dron]:
 {{{
 +  if (!(fabs(region->ew_res - cell_hd.ew_res) < 0.0000001
 +               && fabs(region->ns_res - cell_hd.ns_res) < 0.0000001)) {
 }}}

 The tolerance is probably too small.

 I'd suggest checking that the difference over the entire region is less
 than some fraction of a cell, e.g.
 {{{
 fabs(region->ns_res - cell_hd.ns_res) * region->rows < region->ns_res *
 0.1
 }}}

 The ideal check is probably a 1:1 correspondence between raster cells and
 region cells, but that isn't easy to implement. Note that this depends on
 both the resolution and the alignment. In the worst case, if the raster is
 offset by half a cell relative to the region, even a miniscule difference
 in resolution could result in cells being either duplicated or omitted.

-- 
Ticket URL: <http://trac.osgeo.org/grass/ticket/1405#comment:1>
GRASS GIS <http://grass.osgeo.org>



More information about the grass-dev mailing list