Skip to content

Commit e84a23d

Browse files
Merge branch 'dev' of https://github.com/e-sensing/sits into dev
2 parents 2f19b30 + 59df038 commit e84a23d

11 files changed

Lines changed: 88 additions & 29 deletions

NAMESPACE

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ S3method(.cube_filter_tiles,raster_cube)
5454
S3method(.cube_find_class,default)
5555
S3method(.cube_find_class,raster_cube)
5656
S3method(.cube_find_class,tbl_df)
57+
S3method(.cube_geometry_use_s2,"bdc_cube_landsat-2m")
5758
S3method(.cube_geometry_use_s2,default)
5859
S3method(.cube_geometry_use_s2,ogh_cube)
5960
S3method(.cube_intersects,default)
@@ -119,6 +120,8 @@ S3method(.odata_cdse_extract_tile,RTC)
119120
S3method(.odata_cdse_search,RTC)
120121
S3method(.predictors,sits)
121122
S3method(.predictors,sits_base)
123+
S3method(.reg_tile_convert,"bdc_cube_landsat-2m")
124+
S3method(.reg_tile_convert,default)
122125
S3method(.reg_tile_convert,dem_cube)
123126
S3method(.reg_tile_convert,grd_cube)
124127
S3method(.reg_tile_convert,ogh_cube)
@@ -469,6 +472,7 @@ S3method(sits_reclassify,default)
469472
S3method(sits_reclassify,probs_cube)
470473
S3method(sits_reduce,raster_cube)
471474
S3method(sits_reduce,sits)
475+
S3method(sits_regularize,"bdc_cube_landsat-2m")
472476
S3method(sits_regularize,default)
473477
S3method(sits_regularize,dem_cube)
474478
S3method(sits_regularize,derived_cube)

R/api_cube.R

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1033,6 +1033,10 @@ NULL
10331033
cube
10341034
}
10351035
#' @export
1036+
`.cube_geometry_use_s2.bdc_cube_landsat-2m` <- function(cube, use_s2) {
1037+
.cube_geometry_use_s2.ogh_cube(cube = cube, use_s2 = use_s2)
1038+
}
1039+
#' @export
10361040
.cube_geometry_use_s2.default <- function(cube, use_s2) {
10371041
# Return
10381042
cube

R/api_regularize.R

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,6 @@
532532

533533
#' @noRd
534534
#' @export
535-
#'
536535
.reg_tile_convert.ogh_cube <- function(cube,
537536
grid_system,
538537
roi = NULL,
@@ -582,7 +581,19 @@
582581
cube_class <- c(cube_class[[1]], "ogh_cube", cube_class[-1])
583582
.cube_set_class(cube, cube_class)
584583
}
585-
584+
#' @noRd
585+
#' @export
586+
`.reg_tile_convert.bdc_cube_landsat-2m` <- function(cube,
587+
grid_system,
588+
roi = NULL,
589+
tiles = NULL) {
590+
.reg_tile_convert.ogh_cube(cube = cube,
591+
grid_system = grid_system,
592+
roi = roi,
593+
tiles = tiles)
594+
}
595+
#' @noRd
596+
#' @export
586597
.reg_tile_convert.default <- function(cube,
587598
grid_system,
588599
roi = NULL,

R/api_torch.R

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -535,15 +535,14 @@
535535
#' @noRd
536536
#' @description Find out if CUDA or MPS are available.
537537
#' Forces the CPU pipeline if environment variable
538-
#' SITS_FORCE_CPU is set to 'YES'.
538+
#' SITS_FORCE_CPU is set to TRUE.
539539
#'
540540
#' @return TRUE/FALSE
541-
#'
542541
.torch_gpu_classification <- function() {
543542
# Blank/unset means "let the hardware decide": only an explicit
544-
# 'YES' forces the CPU pipeline.
545-
force_cpu <- Sys.getenv("SITS_FORCE_CPU", unset = "")
546-
if (force_cpu == "YES") return(FALSE)
543+
# 'TRUE' forces the CPU pipeline.
544+
force_cpu <- Sys.getenv("SITS_FORCE_CPU", unset = "FALSE")
545+
if (force_cpu == "TRUE") return(FALSE)
547546
torch::cuda_is_available() || torch::backends_mps_is_available()
548547
}
549548

R/api_torch_dataset.R

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -143,11 +143,11 @@
143143
.torch_predict_chunks <- function(torch_model, dataset, callback) {
144144
# We set to 0 to reproduce the same behaviour in sits
145145
# Once mirai starts with 0 in torch
146-
multicores <- ifelse(
147-
test = sits_env[["multicores"]] == 1,
148-
yes = 0,
149-
no = sits_env[["multicores"]]
150-
)
146+
if (sits_env[["multicores"]] == 1) {
147+
multicores <- 0
148+
} else {
149+
multicores <- sits_env[["multicores"]]
150+
}
151151
# Wrap model with custom torch module which enhances GPU handling
152152
torch_model[["model"]] <- .torch_model_wrap(
153153
model = torch_model[["model"]],

R/sits_regularize.R

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ sits_regularize.ogh_cube <- function(cube, ...,
440440
res,
441441
output_dir,
442442
timeline = NULL,
443-
grid_system = "MGRS",
443+
grid_system = "BDC_MD_V2",
444444
roi = NULL,
445445
crs = NULL,
446446
tiles = NULL,
@@ -505,6 +505,31 @@ sits_regularize.ogh_cube <- function(cube, ...,
505505
}
506506
#' @rdname sits_regularize
507507
#' @export
508+
`sits_regularize.bdc_cube_landsat-2m` <- function(cube, ...,
509+
period,
510+
res,
511+
output_dir,
512+
timeline = NULL,
513+
grid_system = "BDC_MD_V2",
514+
roi = NULL,
515+
crs = NULL,
516+
tiles = NULL,
517+
multicores = 2L,
518+
progress = TRUE) {
519+
sits_regularize.ogh_cube(cube = cube, ...,
520+
period = period,
521+
res = res,
522+
output_dir = output_dir,
523+
timeline = timeline,
524+
grid_system = grid_system,
525+
roi = roi,
526+
crs = crs,
527+
tiles = tiles,
528+
multicores = 2L,
529+
progress = progress)
530+
}
531+
#' @rdname sits_regularize
532+
#' @export
508533
sits_regularize.derived_cube <- function(cube, ...) {
509534
stop(.conf("messages", "sits_regularize_default"))
510535
}

R/sits_utils.R

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,28 +37,28 @@ sits_show_prediction <- function(class) {
3737
#' @name sits_run_tests
3838
#'
3939
#' @description
40-
#' To run the tests, set "SITS_RUN_TESTS" environment to "YES" using
41-
#' Sys.setenv("SITS_RUN_TESTS" = "YES")
40+
#' To run the tests, set "SITS_RUN_TESTS" environment to TRUE using
41+
#' Sys.setenv("SITS_RUN_TESTS" = TRUE)
4242
#' To come back to the default behaviour, please set
43-
#' Sys.setenv("SITS_RUN_TESTS" = "NO")
43+
#' Sys.setenv("SITS_RUN_TESTS" = FALSE)
4444
#' @return TRUE/FALSE
4545
#' @export
4646
sits_run_tests <- function() {
47-
!Sys.getenv("SITS_RUN_TESTS") %in% c("", "NO", "FALSE", "OFF")
47+
Sys.getenv("SITS_RUN_TESTS", unset = "FALSE") == "TRUE"
4848
}
4949
#' @title Informs if sits examples should run
5050
#'
5151
#' @name sits_run_examples
5252
#'
5353
#' @description
5454
#' This function informs if sits examples should run.
55-
#' To run the examples, set "SITS_RUN_EXAMPLES" to "YES" using
56-
#' Sys.setenv("SITS_RUN_EXAMPLES" = "YES")
55+
#' To run the examples, set "SITS_RUN_EXAMPLES" to TRUE using
56+
#' Sys.setenv("SITS_RUN_EXAMPLES" = TRUE)
5757
#' To come back to the default behaviour, please set
58-
#' Sys.setenv("SITS_RUN_EXAMPLES" = "NO")
58+
#' Sys.setenv("SITS_RUN_EXAMPLES" = FALSE)
5959
#'
6060
#' @return A logical value
6161
#' @export
6262
sits_run_examples <- function() {
63-
!Sys.getenv("SITS_RUN_EXAMPLES") %in% c("", "NO", "FALSE", "OFF")
63+
Sys.getenv("SITS_RUN_EXAMPLES", unset = "FALSE") == "TRUE"
6464
}

inst/extdata/sources/config_source_ogh.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,5 +49,5 @@ sources:
4949
open_data_token : false
5050
metadata_search : "tile"
5151
ext_tolerance : 0.01
52-
grid_system : "WRS-2"
52+
grid_system : "GLAD_ARD_GTS"
5353
dates : "1997 to 2022"

man/sits_regularize.Rd

Lines changed: 17 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/sits_run_examples.Rd

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)