Closed wincowgerDEV closed 10 months ago
@wincowgerDEV, thank you for the issue report. Please, confirm that I simplified your code correctly and that you get the same error messages:
suppressPackageStartupMessages({
library(hyperSpec)
library(hySpc.read.ENVI)
})
#> Warning: package 'ggplot2' was built under R version 4.3.1
download.file(
"https://github.com/r-hyperspec/hyperSpec/files/12080657/CA_tiny_map.zip",
destfile = "CA_tiny_map.zip"
)
unzip("CA_tiny_map.zip")
dat <- "CA small UF.dat"
hdr <- "CA small UF.hdr"
# Works
in_hyspc_read_envi <-
hySpc.read.ENVI::read_ENVI_Nicolet(file = dat, headerfile = hdr)
#> .read_ENVI_bin: 'byte order' not given => Guessing 'little'
# Throws error
in_hyperspec <-
hyperSpec::read.ENVI.Nicolet(file = dat, headerfile = hdr)
#> Warning: Function 'hyperSpec::read.ENVI.Nicolet' is deprecated.
#> Please, find alternatives in package 'hySpc.read.ENVI'
#> https://r-hyperspec.github.io/hySpc.read.ENVI
#> Warning: Function 'read.ENVI' is deprecated.
#> Please, find alternatives in package 'hySpc.read.ENVI'
#> https://r-hyperspec.github.io/hySpc.read.ENVI
#> Error in is.null(header[c("samples", "lines", "bands", "data type")]) || : 'length = 4' in coercion to 'logical(1)'
Created on 2023-07-19 with reprex v2.0.2
@GegznaV, thanks for the quick response. Appreciate you simplifying the code. I realize now that my code had some functions from a library I didn't call. I apologize about that.
Here is what I get from running your code. It is pretty similar but I don't get the message about the depreciation or alternatives.
suppressPackageStartupMessages({
library(hyperSpec)
library(hySpc.read.ENVI)
})
download.file(
"https://github.com/r-hyperspec/hyperSpec/files/12080657/CA_tiny_map.zip",
destfile = "CA_tiny_map.zip"
)
#trying URL 'https://github.com/r-hyperspec/hyperSpec/files/12080657/CA_tiny_map.zip'
#Content type 'application/x-zip-compressed' length 322061 bytes (314 KB)
#downloaded 314 KB
unzip("CA_tiny_map.zip")
dat <- "CA small UF.dat"
hdr <- "CA small UF.hdr"
#> # Works
#> in_hyspc_read_envi <-
#+ hySpc.read.ENVI::read_ENVI_Nicolet(file = dat, headerfile = hdr)
#.read_ENVI_bin: 'byte order' not given => Guessing 'little'
# Throws error
in_hyperspec <- hyperSpec::read.ENVI.Nicolet(file = dat, headerfile = hdr)
#Error in is.null(header[c("samples", "lines", "bands", "data type")]) || :
# 'length = 4' in coercion to 'logical(1)'
As I understand, the issue is related to stricter rules of how operator's ||
result is interpreted in current R version. I see that this issue is addressed in the newer version of the function (here is a diff of a few rows):
I've created a PR to development version 0.200.x to fix this issue. But I'm not sure when this reaches CRAN. So I recommend using hySpc.read.ENVI
package for ENVI files.
@cbeleites, should this be fixed in 0.100.x development version and released to CRAN soon?
Thanks!
On Tue, Jul 18, 2023 at 4:25 PM Vilmantas Gegzna @.***> wrote:
@cbeleites https://github.com/cbeleites, should this be fixed in 0.100.x development version and released to CRAN soon?
— Reply to this email directly, view it on GitHub https://github.com/r-hyperspec/hyperSpec/issues/116#issuecomment-1641118078, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGMUJU7CKT2QUPSR42JCGOLXQ4LQJANCNFSM6AAAAAA2OLZQAY . You are receiving this because you were mentioned.Message ID: @.***>
--
·.¸¸.·´¯
·.´¯·.¸¸.·´¯
ツ ------------------------------Win Cowger, PhD Pronouns: he/him Research Scientist Moore Institute for Plastic Pollution Research
Contact Info
515-298-3869 | @.*** | @Win_OpenData https://twitter.com/Win_OpenData
Issue
CA_tiny_map.zip
Describe the problem in detail Ran into an issue where one of our functions in Open Specy began throwing an error when it didn't a year ago (possibly due to a cran update)? Using the Nicolet ENVI file dataset attached, I used to be able to read in the file with hyperSpec::read.ENVI.Nicolet, but now throws an error unless I use hySpc.read.ENVI::read_ENVI_Nicolet.
Describe the behavior you expected Reading the file without error.
Software details
Session info
```r sessioninfo::session_info("hyperSpec") ``` ``` ─ Session info ──────────────────────────────────────────────────────────── setting value version R version 4.3.0 (2023-04-21 ucrt) os Windows 11 x64 (build 22621) system x86_64, mingw32 ui RStudio language (EN) collate English_United States.utf8 ctype English_United States.utf8 tz America/Los_Angeles date 2023-07-18 rstudio 2023.03.1+446 Cherry Blossom (desktop) pandoc 2.19.2 @ C:\\PROGRA~1\\Pandoc\\pandoc.exe ─ Packages ──────────────────────────────────────────────────────────────── package * version date (UTC) lib source brio 1.1.3 2021-11-30 [1] CRAN (R 4.3.0) callr 3.7.3 2022-11-02 [1] CRAN (R 4.3.0) cli 3.6.1 2023-03-23 [1] CRAN (R 4.3.0) colorspace 2.1-0 2023-01-23 [1] CRAN (R 4.3.0) crayon 1.5.2 2022-09-29 [1] CRAN (R 4.3.0) deldir 1.0-9 2023-05-17 [1] CRAN (R 4.3.0) desc 1.4.2 2022-09-08 [1] CRAN (R 4.3.0) diffobj 0.3.5 2021-10-05 [1] CRAN (R 4.3.0) digest 0.6.31 2022-12-11 [1] CRAN (R 4.3.0) dplyr 1.1.2 2023-04-20 [1] CRAN (R 4.3.0) ellipsis 0.3.2 2021-04-29 [1] CRAN (R 4.3.0) evaluate 0.21 2023-05-05 [1] CRAN (R 4.3.0) fansi 1.0.4 2023-01-22 [1] CRAN (R 4.3.0) farver 2.1.1 2022-07-06 [1] CRAN (R 4.3.0) fs 1.6.2 2023-04-25 [1] CRAN (R 4.3.0) generics 0.1.3 2022-07-05 [1] CRAN (R 4.3.0) ggplot2 * 3.4.2 2023-04-03 [1] CRAN (R 4.3.0) glue 1.6.2 2022-02-24 [1] CRAN (R 4.3.0) gtable 0.3.3 2023-03-21 [1] CRAN (R 4.3.0) hyperSpec * 0.100.0 2021-09-13 [1] CRAN (R 4.3.1) interp 1.1-4 2023-03-31 [1] CRAN (R 4.3.0) isoband 0.2.7 2022-12-20 [1] CRAN (R 4.3.0) jpeg 0.1-10 2022-11-29 [1] CRAN (R 4.3.0) jsonlite 1.8.5 2023-06-05 [1] CRAN (R 4.3.1) labeling 0.4.2 2020-10-20 [1] CRAN (R 4.3.0) lattice * 0.21-8 2023-04-05 [2] CRAN (R 4.3.0) latticeExtra 0.6-30 2022-07-04 [1] CRAN (R 4.3.0) lazyeval 0.2.2 2019-03-15 [1] CRAN (R 4.3.0) lifecycle 1.0.3 2022-10-07 [1] CRAN (R 4.3.0) magrittr 2.0.3 2022-03-30 [1] CRAN (R 4.3.0) MASS 7.3-58.4 2023-03-07 [2] CRAN (R 4.3.0) Matrix 1.5-4 2023-04-04 [2] CRAN (R 4.3.0) mgcv 1.8-42 2023-03-02 [2] CRAN (R 4.3.0) munsell 0.5.0 2018-06-12 [1] CRAN (R 4.3.0) nlme 3.1-162 2023-01-31 [2] CRAN (R 4.3.0) pillar 1.9.0 2023-03-22 [1] CRAN (R 4.3.0) pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 4.3.0) pkgload 1.3.2 2022-11-16 [1] CRAN (R 4.3.0) png 0.1-8 2022-11-29 [1] CRAN (R 4.3.0) praise 1.0.0 2015-08-11 [1] CRAN (R 4.3.0) processx 3.8.1 2023-04-18 [1] CRAN (R 4.3.0) ps 1.7.5 2023-04-18 [1] CRAN (R 4.3.0) R6 2.5.1 2021-08-19 [1] CRAN (R 4.3.0) RColorBrewer 1.1-3 2022-04-03 [1] CRAN (R 4.3.0) Rcpp 1.0.10 2023-01-22 [1] CRAN (R 4.3.0) RcppEigen 0.3.3.9.3 2022-11-05 [1] CRAN (R 4.3.0) rematch2 2.1.2 2020-05-01 [1] CRAN (R 4.3.0) rlang 1.1.1 2023-04-28 [1] CRAN (R 4.3.0) rprojroot 2.0.3 2022-04-02 [1] CRAN (R 4.3.0) scales 1.2.1 2022-08-20 [1] CRAN (R 4.3.0) testthat 3.1.8 2023-05-04 [1] CRAN (R 4.3.0) tibble 3.2.1 2023-03-20 [1] CRAN (R 4.3.0) tidyselect 1.2.0 2022-10-10 [1] CRAN (R 4.3.0) utf8 1.2.3 2023-01-31 [1] CRAN (R 4.3.0) vctrs 0.6.2 2023-04-19 [1] CRAN (R 4.3.0) viridisLite 0.4.2 2023-05-02 [1] CRAN (R 4.3.0) waldo 0.5.1 2023-05-08 [1] CRAN (R 4.3.0) withr 2.5.0 2022-03-03 [1] CRAN (R 4.3.0) xml2 * 1.3.4 2023-04-27 [1] CRAN (R 4.3.0) [1] C:/Users/winco/AppData/Local/R/win-library/4.3 [2] C:/Program Files/R/R-4.3.0/library ```