raster::stack fails with "missing value where TRUE/FALSE needed"

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

raster::stack fails with "missing value where TRUE/FALSE needed"

Hugo Costa
Dear list,

is there any reason for raster::stack retrieve and error (see below) for
the raster provided in dropbox
<https://www.dropbox.com/s/tdfxezlieka1ofd/gsw.tif?dl=0>?
Thanks

# this may read the raster from dropbox directly, but is slow
# r<-raster("https://www.dropbox.com/s/tdfxezlieka1ofd/gsw.tif?dl=1")

# download raster from
https://www.dropbox.com/s/tdfxezlieka1ofd/gsw.tif?dl=0
r<-raster("path/to/downloaded/raster")
stack(r,r)

Error in if (common.len == 1L) unlist(x, recursive = FALSE) else if
> (common.len >  :
>   missing value where TRUE/FALSE needed
>

# reduce extent (no error)
r2<-crop(r, extent(r)/2)
stack(r2,r2)

R version 3.5.2 (2018-12-20)

> Platform: i386-w64-mingw32/i386 (32-bit)
> Running under: Windows >= 8 x64 (build 9200)
>
> Matrix products: default
> locale:
> [1] LC_COLLATE=English_United Kingdom.1252  LC_CTYPE=English_United
> Kingdom.1252    LC_MONETARY=English_United Kingdom.1252
> [4] LC_NUMERIC=C                            LC_TIME=English_United
> Kingdom.1252
>
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base
>
> other attached packages:
> [1] raster_2.9-23 sp_1.3-1
>
> loaded via a namespace (and not attached):
> [1] compiler_3.5.2   rgdal_1.4-4      tools_3.5.2      Rcpp_1.0.0
> codetools_0.2-15 grid_3.5.2       lattice_0.20-38
>

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Reply | Threaded
Open this post in threaded view
|

Re: raster::stack fails with "missing value where TRUE/FALSE needed"

Hugo Costa
For some reason, RStudio was linked to the R 32-bits version. I manually
defined the link to the 64-bits (in RStudio's global options) and the
problem went away.
Hugo

Hugo Costa <[hidden email]> escreveu no dia segunda, 5/08/2019 à(s)
22:49:

> Dear list,
>
> is there any reason for raster::stack retrieve and error (see below) for
> the raster provided in dropbox
> <https://www.dropbox.com/s/tdfxezlieka1ofd/gsw.tif?dl=0>?
> Thanks
>
> # this may read the raster from dropbox directly, but is slow
> # r<-raster("https://www.dropbox.com/s/tdfxezlieka1ofd/gsw.tif?dl=1")
>
> # download raster from
> https://www.dropbox.com/s/tdfxezlieka1ofd/gsw.tif?dl=0
> r<-raster("path/to/downloaded/raster")
> stack(r,r)
>
> Error in if (common.len == 1L) unlist(x, recursive = FALSE) else if
>> (common.len >  :
>>   missing value where TRUE/FALSE needed
>>
>
> # reduce extent (no error)
> r2<-crop(r, extent(r)/2)
> stack(r2,r2)
>
> R version 3.5.2 (2018-12-20)
>> Platform: i386-w64-mingw32/i386 (32-bit)
>> Running under: Windows >= 8 x64 (build 9200)
>>
>> Matrix products: default
>> locale:
>> [1] LC_COLLATE=English_United Kingdom.1252  LC_CTYPE=English_United
>> Kingdom.1252    LC_MONETARY=English_United Kingdom.1252
>> [4] LC_NUMERIC=C                            LC_TIME=English_United
>> Kingdom.1252
>>
>> attached base packages:
>> [1] stats     graphics  grDevices utils     datasets  methods   base
>>
>> other attached packages:
>> [1] raster_2.9-23 sp_1.3-1
>>
>> loaded via a namespace (and not attached):
>> [1] compiler_3.5.2   rgdal_1.4-4      tools_3.5.2      Rcpp_1.0.0
>> codetools_0.2-15 grid_3.5.2       lattice_0.20-38
>>
>

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo