Re: [GRASS-user] compare a DCELL and FCELL question

ming han <[email protected]>
Newsgroups gmane.comp.gis.grass.devel,gmane.comp.gis.grass.user
Message-ID <CAD+uAWjCUF2T+D3qUYBgdhUjhCa9dc=wQ0mTbQO__utMsNyQ6Q@mail.gmail.com>
Hi Markus and Micha

     I am just trying to find grids have the same values in these two
rasters, I will try the threshold approach.

Thanks
Ming

Markus Neteler <[email protected]> 于2021年1月24日周日 上午6:58写道:

> Hi Ming,
>
> On Sun, Jan 24, 2021 at 10:49 AM ming han <[email protected]> wrote:
> >
> > Hi Micha
> >
> >      Many thanks for your reply.
> >      Here is the command I am using:
> >
> >      if(float(cat1_acc_riv) == float(cat1_minacc), str_r, null())
> >
> >       The str_r is a CELL raster. the result is different when I change
> it to:
> >        if(int(cat1_acc_riv) == int(cat1_minacc), str_r, null())
>
> Note that numerical "equality" is better tested with a threshold test
> against the map pixel difference.
> As the threshold, we use GRASS_EPSILON which is defined as 1.0e-15.
>
> Hence the test needs to be implemented in a different way, i.e. by
> using an epsilon.
> Essentially something like this:
>
> if(fabs(map_A - map_B) <= 1.0e-15, ... )
>
> In your case (untested):
> r.mapcalc diffepsilon = if( abs( map_A - map_B) <= 1.0e-15, str_r , null())
>
> See related discussions here: [1], [2] and elsewhere.
>
> [1] Comment by Glynn: https://trac.osgeo.org/grass/ticket/2854#comment:9
> [2] Comment by Glynn:
> https://lists.osgeo.org/pipermail/grass-user/2015-October/073200.html
>
> Best,
> Markus
>

_______________________________________________
grass-dev mailing list
[email protected]
https://lists.osgeo.org/mailman/listinfo/grass-dev
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.