[GRASS-user] Problems Running r.flow

Hamish hamish_b at yahoo.com
Fri Jan 29 00:14:39 EST 2010


Glynn wrote:
> Try the attached patch. It replaces the exact comparison
> with a check that the resolutions agree to within 1ppm.
...
> +static int compare_regions(const struct Cell_head *a, const struct Cell_head *b)
> +{
> +    return (fabs(a->ew_res - b->ew_res) < 1e-6 * b->ew_res &&
> +        fabs(a->ns_res - b->ns_res) < 1e-6 * b->ns_res);
> +}

use GRASS_EPSILON, as it is based on the machine; it doesn't make
assumptions about the units you are measuring in. (or for that matter
that your x and y axes represent "distance" at all, in the way we usually
think about it)

e.g. for Lat/Long 1e-6 is not enough to accurately represent the
region resolution well for sub-meter data. (1e-6*1852*60 => ~ 11cm)


this may not have come up before because the improved reading/writing 
at "full" %.15g is rather new*, and the old read-write cycle may have,
as your post suggested, quietly rounded all the problems away.

[*] see task #335,  https://trac.osgeo.org/grass/ticket/335


Hamish



      


More information about the grass-user mailing list