Displaying 12 results from an estimated 12 matches for "r2_resampl".
Did you mean:
r2_resampled
2024 Aug 15
1
allequal diff
...e not exactly
>
> [1] FALSE
>
>> all.equal(tan(d45), rep(1, 10), tolerance = 0) # to see difference
>
> [1] "Mean relative difference: 1.29526e-15"
>
>>
>
>
>
> Unfortunately, I just get "FALSE" not the difference.
>
>> r2_resampled <- resample(r2, r1)
>
>> compareRaster(r1, r2_resampled)
>
> [1] TRUE
>
>> # Compare rasters
>
>> result <- all.equal(r1, r2_resampled)
>
> Warning message:
>
> In compareRaster(target, current, ..., values = values, stopiffalse =
> stop...
2024 Aug 16
1
allequal diff
Dear Ben
Many thanks.
I see that a second challenge are NA values. Is it possible to consider na.rm=TRUE?
> r2_resampled <- resample(r2, r1)
> compareRaster(r1, r2_resampled)
[1] TRUE
>
> all.equal(getValues(r1), getValues(r2_resampled), tolerance = 0)
[1] "'is.NA' value mismatch: 9544032 in current 66532795 in target"
Kind regards
Sibylle
-----Original Message-----...
2024 Aug 15
1
allequal diff
..., but
> all (tan(d45) == rep(1, 10)) # FALSE, since not exactly
[1] FALSE
> all.equal(tan(d45), rep(1, 10), tolerance = 0) # to see difference
[1] "Mean relative difference: 1.29526e-15"
>
Unfortunately, I just get "FALSE" not the difference.
> r2_resampled <- resample(r2, r1)
> compareRaster(r1, r2_resampled)
[1] TRUE
> # Compare rasters
> result <- all.equal(r1, r2_resampled)
Warning message:
In compareRaster(target, current, ..., values = values, stopiffalse =
stopiffalse, :
not all objects have the same values
> prin...
2024 Aug 16
2
allequal diff
...LI via R-help <r-help at r-project.org>
Cc: sibylle.stoeckli at gmx.ch
Subject: Re: [R] allequal diff
? Fri, 16 Aug 2024 07:19:38 +0200
SIBYLLE ST?CKLI via R-help <r-help at r-project.org> ?????:
> Is it possible to consider na.rm=TRUE?
> > all.equal(getValues(r1), getValues(r2_resampled), tolerance = 0)
>
> [1] "'is.NA' value mismatch: 9544032 in current 66532795 in target"
Use is.na() on getValues() outputs, combine the two masks using the | operator to get a mask of values that are missing in either raster, then negate the mask to choose the non-missi...
2024 Aug 16
1
allequal diff
? Fri, 16 Aug 2024 07:19:38 +0200
SIBYLLE ST?CKLI via R-help <r-help at r-project.org> ?????:
> Is it possible to consider na.rm=TRUE?
> > all.equal(getValues(r1), getValues(r2_resampled), tolerance = 0)
>
> [1] "'is.NA' value mismatch: 9544032 in current 66532795 in target"
Use is.na() on getValues() outputs, combine the two masks using the |
operator to get a mask of values that are missing in either raster,
then negate the mask to choose the non-mis...
2024 Aug 16
1
allequal diff
Cool thanks
# values and mask r1
r1 <- getValues(r1)
mask1 <- is.na(r1)
# Do the same for r2
r2 <- getValues(r2_resampled)
mask2 <- is.na(r2)
# Combine the masks
all.equal(r1[!(mask1 & mask2)], r2[!(mask1 & mask2)])
output
> all.equal(r1[!(mask1 & mask2)], r2[!(mask1 & mask2)])
[1] "'is.NA' value mismatch: 389 in current 56989152 in target"
--> so there is just a mismat...
2024 Aug 16
1
allequal diff
? Fri, 16 Aug 2024 11:32:58 +0200
<sibylle.stoeckli at gmx.ch> ?????:
> # values and mask r1
> r1 <- getValues(r1)
> mask1 <- is.na(r1)
> # Do the same for r2
> r2 <- getValues(r2_resampled)
> mask2 <- is.na(r2)
>
> # Combine the masks
> all.equal(r1[!(mask1 & mask2)], r2[!(mask1 & mask2)])
Let's consider a more tangible example:
# The vectors `x` and `y` start out equal
x <- y <- 1:10
# But then their different elements are made missing
x[c(1,3,4...
2024 Aug 18
1
allequal diff
...? Fri, 16 Aug 2024 11:32:58 +0200
> >> <sibylle.stoeckli at gmx.ch> ?????:
> >>
> >>> # values and mask r1
> >>> r1 <- getValues(r1)
> >>> mask1 <- is.na(r1)
> >>> # Do the same for r2
> >>> r2 <- getValues(r2_resampled)
> >>> mask2 <- is.na(r2)
> >>>
> >>> # Combine the masks
> >>> all.equal(r1[!(mask1 & mask2)], r2[!(mask1 & mask2)])
> >> Let's consider a more tangible example:
> >>
> >> # The vectors `x` and `y` start ou...
2024 Aug 18
2
allequal diff
...LLE ST?CKLI via R-help' <r-help at r-project.org>
Subject: Re: [R] allequal diff
? Fri, 16 Aug 2024 11:32:58 +0200
<sibylle.stoeckli at gmx.ch> ?????:
> # values and mask r1
> r1 <- getValues(r1)
> mask1 <- is.na(r1)
> # Do the same for r2
> r2 <- getValues(r2_resampled)
> mask2 <- is.na(r2)
>
> # Combine the masks
> all.equal(r1[!(mask1 & mask2)], r2[!(mask1 & mask2)])
Let's consider a more tangible example:
# The vectors `x` and `y` start out equal x <- y <- 1:10 # But then their different elements are made missing x[c(1,3,4...
2024 Aug 18
2
allequal diff
...ect.org>
> Subject: Re: [R] allequal diff
>
> ? Fri, 16 Aug 2024 11:32:58 +0200
> <sibylle.stoeckli at gmx.ch> ?????:
>
> > # values and mask r1
> > r1 <- getValues(r1)
> > mask1 <- is.na(r1)
> > # Do the same for r2
> > r2 <- getValues(r2_resampled)
> > mask2 <- is.na(r2)
> >
> > # Combine the masks
> > all.equal(r1[!(mask1 & mask2)], r2[!(mask1 & mask2)])
>
> Let's consider a more tangible example:
>
> # The vectors `x` and `y` start out equal x <- y <- 1:10 # But then their differen...
2024 Aug 16
1
allequal diff
? Fri, 16 Aug 2024 10:35:35 +0200
<sibylle.stoeckli at gmx.ch> ?????:
> what do you mean by use is.na() in getValues(). So I need to call
> getValues a second time?
Not necessarily, but it's one of the options. I was thinking along the
lines of:
values1 <- getValues(r1)
mask1 <- is.na(values1)
# Do the same for r2
# Combine the masks
all.equal(values1[!combined_mask],
2024 Aug 18
1
allequal diff
...R] allequal diff
>>
>> ? Fri, 16 Aug 2024 11:32:58 +0200
>> <sibylle.stoeckli at gmx.ch> ?????:
>>
>>> # values and mask r1
>>> r1 <- getValues(r1)
>>> mask1 <- is.na(r1)
>>> # Do the same for r2
>>> r2 <- getValues(r2_resampled)
>>> mask2 <- is.na(r2)
>>>
>>> # Combine the masks
>>> all.equal(r1[!(mask1 & mask2)], r2[!(mask1 & mask2)])
>> Let's consider a more tangible example:
>>
>> # The vectors `x` and `y` start out equal x <- y <- 1:10 # But...