Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pifMatch() Error: object is not a matrix #66

Open
mschmidty opened this issue Sep 1, 2020 · 2 comments
Open

pifMatch() Error: object is not a matrix #66

mschmidty opened this issue Sep 1, 2020 · 2 comments

Comments

@mschmidty
Copy link

I can't seem to get pifMatch() to work. I keep getting the error:

> test<-RStoolbox::pifMatch(r_0101, r_0102, returnPifMap = F, returnSimMap = F)
Error in model.frame.default(formula = ref ~ img, data = df, drop.unused.levels = TRUE) : 
  object is not a matrix

I've tried both raster bricks and stacks. Same error.

Here's the info on the raster layers:

> r_0101
class      : RasterStack 
dimensions : 17674, 14122, 249592228, 4  (nrow, ncol, ncell, nlayers)
resolution : 0.1, 0.1  (x, y)
extent     : 697220.3, 698632.5, 4220342, 4222109  (xmin, xmax, ymin, ymax)
crs        : +proj=utm +zone=12 +datum=NAD83 +units=m +no_defs 
names      : SM_GypsumGapNW_0101_180611.1, SM_GypsumGapNW_0101_180611.2, SM_GypsumGapNW_0101_180611.3, SM_GypsumGapNW_0101_180611.4 
min values :                            0,                            0,                            0,                            0 
max values :                        65535,                        65535,                        65535,                        65535 

> r_0102
class      : RasterStack 
dimensions : 17677, 14125, 249687625, 4  (nrow, ncol, ncell, nlayers)
resolution : 0.1, 0.1  (x, y)
extent     : 698590.1, 700002.6, 4220375, 4222143  (xmin, xmax, ymin, ymax)
crs        : +proj=utm +zone=12 +datum=NAD83 +units=m +no_defs 
names      : SM_GypsumGapNW_0102_180611.1, SM_GypsumGapNW_0102_180611.2, SM_GypsumGapNW_0102_180611.3, SM_GypsumGapNW_0102_180611.4 
min values :                            0,                            0,                            0,                            0 
max values :                        65535,                        65535,                        65535,                        65535 

Session info:

> sessionInfo()
R version 4.0.2 (2020-06-22)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 17134)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252    LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                           LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] raster_3.3-13   sp_1.4-2        RStoolbox_0.2.6

loaded via a namespace (and not attached):
 [1] xfun_0.15            tidyselect_1.1.0     purrr_0.3.4          reshape2_1.4.4       splines_4.0.2        lattice_0.20-41     
 [7] colorspace_1.4-1     vctrs_0.3.2          generics_0.0.2       stats4_4.0.2         XML_3.99-0.5         survival_3.1-12     
[13] prodlim_2019.11.13   rlang_0.4.7          ModelMetrics_1.2.2.2 pillar_1.4.6         glue_1.4.1           withr_2.2.0         
[19] foreach_1.5.0        lifecycle_0.2.0      plyr_1.8.6           lava_1.6.7           stringr_1.4.0        rgeos_0.5-3         
[25] timeDate_3043.102    munsell_0.5.0        gtable_0.3.0         recipes_0.1.13       codetools_0.2-16     knitr_1.29          
[31] doParallel_1.0.15    caret_6.0-86         parallel_4.0.2       class_7.3-17         Rcpp_1.0.5           geosphere_1.5-10    
[37] scales_1.1.1         ipred_0.9-9          ggplot2_3.3.2        stringi_1.4.6        dplyr_1.0.0          grid_4.0.2          
[43] rgdal_1.5-16         tools_4.0.2          magrittr_1.5         tibble_3.0.3         crayon_1.3.4         pkgconfig_2.0.3     
[49] ellipsis_0.3.1       MASS_7.3-51.6        Matrix_1.2-18        data.table_1.13.0    pROC_1.16.2          lubridate_1.7.9     
[55] gower_0.2.2          rstudioapi_0.11      iterators_1.0.12     R6_2.4.1             rpart_4.1-15         nnet_7.3-14         
[61] nlme_3.1-148         compiler_4.0.2 

Thanks for the package. I use it all the time.

@aazuspan
Copy link

I was having the same issue and fixed it by loading my rasters using raster::brick instead of raster::stack. The docs say either should work, so I'm guessing this is just a bug.

@KonstiDE
Copy link
Collaborator

KonstiDE commented Feb 9, 2024

Do you still have the data to test it on the refactored version 0.4.0 @mschmidty ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants