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

Merry Christmas ❄️ #98

Merged
merged 70 commits into from
Jan 12, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
1d5ea3e
switch to terra
Mar 7, 2022
2cf70f2
implement ggplot2 funcs natively with terra
Mar 7, 2022
f5d4cba
Dont import stats::filter, instead call it directly.
Mar 8, 2022
6f987b9
migrate fCover to terra
Mar 8, 2022
8e99cee
add pipe
Mar 8, 2022
1474385
mv to terra
Mar 8, 2022
173ab9b
agnostic check for canProcessInMemory
Mar 9, 2022
5dd7953
mv to terra
Mar 9, 2022
9eee808
mv to terra
Mar 10, 2022
e9d1ed9
mv to terra
Mar 10, 2022
94a1c56
mv to terra
Mar 10, 2022
f21a1f9
Merge remote-tracking branch 'origin/master' into switch_to_terra
Nov 20, 2023
56cfad0
initial terra changes for cloudMasking and sub-methods used
Nov 20, 2023
54c58e6
fixed various tests, completed cloudmask to terra transition + coregi…
Nov 21, 2023
6881d3a
fixed tests, devtools::test() now works. Continuing on terra/sf trans…
Nov 23, 2023
f0dea88
started on qa
Nov 23, 2023
3e9995a
fixing various things, corrected .toTerra, next pensharpening and tod…
Nov 23, 2023
9b9aa2d
more fixes, brought back canProcessInMemory function
Nov 24, 2023
7163177
fixed rasterPCA, cleaned out radCor and sub-methods of estimateHaze.R…
Nov 26, 2023
8267097
hotfix with .nlyr, will be removed in the future
Nov 27, 2023
561eb9a
rasterCVA.R and tests
Nov 27, 2023
f70866f
superClass.R to terra
Nov 28, 2023
4bc0de2
deleted old superClass.R methods from testing. Those were leftovers
KonstiDE Nov 30, 2023
57fe712
read/save RSTBX files to rds and back with superClass
KonstiDE Nov 30, 2023
c989b68
started on topCor
KonstiDE Nov 30, 2023
0aec5d7
topCor continuation
KonstiDE Nov 30, 2023
fbc29b0
topCor almost done, lapply solved
KonstiDE Dec 1, 2023
1648849
finished topCor.R
KonstiDE Dec 1, 2023
e6ce836
ui doc push, corrected to SpatRaster
Dec 2, 2023
85cf4ff
found mistakes in ggR, not forced to use terra. And not sure about te…
Dec 2, 2023
60126e8
ggR.R
Dec 2, 2023
916e6a1
tests to terra so far possible
Dec 5, 2023
a7d0d7d
test-entropy.R trying damn to save terra as a nice rda to switch the …
Dec 5, 2023
e2ce681
Replaced test data with terra stuff
KonstiDE Dec 6, 2023
4d2062e
Removed unnecessary st_to_sf statement
KonstiDE Dec 6, 2023
78e1c56
data and stuff
KonstiDE Dec 8, 2023
c9033a5
data and stuff2
KonstiDE Dec 8, 2023
8750c60
first check issues
KonstiDE Dec 8, 2023
84cca90
check and examples
KonstiDE Dec 11, 2023
938332b
check runs
KonstiDE Dec 12, 2023
115340a
fixed estimate haze
KonstiDE Dec 12, 2023
2add1cc
check fixes as raster and sp were thrown out entirely
KonstiDE Dec 12, 2023
a244414
reduced size of exemplary data as well as the duration of example-checks
KonstiDE Dec 14, 2023
3d2f035
documentation push
KonstiDE Dec 14, 2023
2f26039
checkRd fix for linking grDevices
KonstiDE Dec 14, 2023
cd0359c
threw libs out
KonstiDE Dec 15, 2023
93bf348
dont run stuff
KonstiDE Dec 19, 2023
142e7e3
fixed a bug for .paraRasterFun
KonstiDE Dec 19, 2023
164ea55
test
KonstiDE Dec 19, 2023
7dab612
fixed warning from imports of RStoolbox.R
Dec 24, 2023
46ad313
trigger worksflows
Dec 24, 2023
a446c3e
hopefully fixed test coverage pipeline
Dec 24, 2023
3c26656
trigger codecov
Dec 24, 2023
88e2c8a
Update coverage.yaml
KonstiDE Dec 25, 2023
489770e
Update coverage.yaml
KonstiDE Dec 25, 2023
5d87bcd
routine for runnign codecov locally
Dec 25, 2023
81b25c0
new test coverage.yaml
Dec 25, 2023
14104c7
downgrade v2
Dec 25, 2023
de82b7f
again
Dec 25, 2023
e959f29
remove devtools
Dec 25, 2023
5b3260b
skip on covr
Dec 25, 2023
30a0d3b
Update README.md
KonstiDE Dec 25, 2023
e93fecc
clear check to only notes
Dec 25, 2023
ecc1ebf
Merge remote-tracking branch 'origin/master'
Dec 25, 2023
c0e222e
Update README.md
KonstiDE Dec 25, 2023
853a921
skip on ci
Dec 25, 2023
8bef3cc
Merge remote-tracking branch 'origin/master'
Dec 25, 2023
7b0f666
fixed description emails
Dec 25, 2023
cc998ac
renaming and DESCRIPTION cre change
Jan 12, 2024
5ab9e31
add missing .Rd files
Jan 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
superClass.R to terra
  • Loading branch information
Konstantin committed Nov 28, 2023
commit f70866fe5daf58841c811625672d46972da9b22b
5 changes: 0 additions & 5 deletions R/cloudMask.R
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,3 @@ cloudShadowMask <- function (img, cm, nc = 5, shiftEstimate = NULL, preciseShift
if(returnShift) return(list(shift = shiftPar, shadowMap = cms)) else return(cms)

}


my_test <- function(){
class(c(last, last))
}
6 changes: 4 additions & 2 deletions R/internalFunctions.R
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@
if (isTRUE(getOption('rasterCluster'))) {
do.call("clusterR", args = c(list(x = raster, fun = rasterFun, args=args), wrArgs))
} else {
#do.call("rasterFun", args=c(x = raster, args), wrArgs)
do.call("rasterFun", c(list(raster), args, wrArgs))
}
}
Expand Down Expand Up @@ -193,7 +192,10 @@
x <- gsub("\\\\", "/", x) ## anti-win
x <- gsub("//", "/", x) ## anti-win

if(basename(x) == x | grepl("^[.][.]/", x)) x <- file.path(getwd(),x)
if(basename(x) == x | grepl("^[.][.]/", x)){
x <- file.path(getwd(),x)
}

if(grepl("[.][.]", x)){
xs <- strsplit(x, "/")[[1]]
ups <- grep("[.][.]", xs)
Expand Down
8 changes: 0 additions & 8 deletions R/radCor.R
Original file line number Diff line number Diff line change
Expand Up @@ -289,11 +289,3 @@ radCor <- function(img, metaData, method = "apref", bandSet = "full", hazeValues

return(out)
}


test <- function(){
devtools::load_all()
mtlFile <- system.file("external/landsat/LT52240631988227CUB02_MTL.txt", package = "RStoolbox")
method <- "dos"
radCor(lsat, metaData = mtlFile, method = method, hazeBands = c(1, 2))
}
62 changes: 39 additions & 23 deletions R/saveRSTBX.R
Original file line number Diff line number Diff line change
Expand Up @@ -42,47 +42,63 @@
NULL

#' @describeIn saveRSTBX Save RStoolbox object to file
saveRSTBX <- function(x, filename, format ="raster", ...){

saveRSTBX <- function(x, filename, format = "raster", ...){
stopifnot(inherits(x, "RStoolbox"))


if(!inherits(x$map, "SpatRaster")){
x$map <- .toTerra(x$map)
}

rdsFile <- rastFile <- .fullPath(filename)
extension(rdsFile) <- ".rds"
extension(rastFile) <- .rasterExtension(format)
f <- raster::filename(x$map)
if(inherits(x$map, "Raster")){
if(inMemory(x$map)){
## In memory
x$map <- writeRaster(x$map, filename = rastFile, format=format, ...)
} else {
if(f!=rastFile){
## File onDisk but not in requested path and/or format
x$map <- writeRaster(x$map, filename = rastFile, format=format, ...)
}
}
rdsFile <- paste0(rdsFile, ".rds")
rastFile <- paste0(rastFile, .rasterExtension(format))

f <- terra::sources(x$map)

if(inMemory(x$map)){
x$map <- writeRaster(x$map, filename = rastFile, ...)
} else {
if(f!=rastFile){
x$map <- writeRaster(x$map, filename = rastFile, ...)
}
}
saveRDS(x, rdsFile)
base::saveRDS(x, rdsFile)
}

#' @describeIn saveRSTBX Read files saved with saveRSTBX
#' @export
readRSTBX <- function(filename){
rdsFile <- rastFile <- .fullPath(filename)
extension(rdsFile) <- ".rds"
x <- readRDS(rdsFile)
if(!inherits(x, "RStoolbox")) stop(filename, "is not a RStoolbox object.", call. = FALSE)

x <- readRDS(rdsFile)
print(x)

if(!inherits(x, "RStoolbox"))
stop(filename, "is not a RStoolbox object.", call. = FALSE)

namesBU <- names(x$map) ## backup names (might get lost between file formats)
if(inherits(x$map, "Raster")){
extension(rastFile) <- extension(filename(x$map))

if(inherits(x$map, "SpatRaster")){
rastFile <- paste0(rastFile, sources(x$map))
if(!file.exists(rastFile)) {
warning("Corresponding raster file ", rastFile, " cannot be found. \nThe *.rds and the raster file must be located in the same directory.")
x$map <- "Raster map not found"
} else {
x$map <- if(inherits(x$map, "RasterLayer")) raster(rastFile) else brick(rastFile)
x$map <- rast(rastFile)
}
names(x$map) <- namesBU
}
x
}

test <- function(){
devtools::load_all()

train <- readRDS(system.file("external/trainingPoints.rds", package="RStoolbox"))
sc <- superClass(rlogo, train, tuneLength = 1, resp="class")

## Save and re-import
outbase <- paste0(tempdir(),"/test-RSTOOLBOX-sc")
saveRSTBX(sc, outbase , overwrite = TRUE)
sc_re <- readRSTBX(paste0(outbase, ".rds"))
}
Loading