Skip to content

Commit

Permalink
Merge pull request #1045 from OldLipe/feat/temp_seg
Browse files Browse the repository at this point in the history
Fix bugs in `sits_label_classification()` and `sits_classification()`
  • Loading branch information
OldLipe authored Nov 27, 2023
2 parents 842e186 + a013363 commit ae258d7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 11 deletions.
7 changes: 4 additions & 3 deletions R/api_segments.R
Original file line number Diff line number Diff line change
Expand Up @@ -398,9 +398,10 @@
progress) {

# how much memory do we need?
req_memory <- .tile_nrows(tile) * .tile_ncols(tile) *
length(.tile_timeline(tile)) * length(bands) * 4 *
.conf("processing_bloat_seg") / 1e+09
# Get image size
req_memory <- .as_dbl(.tile_nrows(tile)) * .as_dbl(.tile_ncols(tile))
req_memory <- req_memory * length(.tile_timeline(tile)) *
length(bands) * 4 * .conf("processing_bloat_seg") / 1e+09

# do we have enough memory?
if (req_memory < memsize) {
Expand Down
6 changes: 0 additions & 6 deletions R/sits_label_classification.R
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,6 @@ sits_label_classification.probs_cube <- function(cube, ...,
progress = TRUE) {
# Pre-conditions - Check parameters
.check_cube_files(cube)
.check_lgl_parameter(clean)
.check_window_size(window_size = window_size, min = 3, max = 15)
.check_memsize(memsize, min = 1, max = 16384)
.check_multicores(multicores, min = 1, max = 2048)
.check_output_dir(output_dir)
Expand All @@ -83,10 +81,6 @@ sits_label_classification.probs_cube <- function(cube, ...,

# Get block size
block <- .raster_file_blocksize(.raster_open_rast(.tile_path(cube)))
# Get image size
image_size <- .raster_size(.raster_open_rast(.tile_path(cube)))
# Overlapping pixels
overlap <- ceiling(window_size / 2) - 1
# Check minimum memory needed to process one block
job_memsize <- .jobs_memsize(
job_size = .block_size(block = block, overlap = 0),
Expand Down
4 changes: 2 additions & 2 deletions man/sits_cube.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ae258d7

Please sign in to comment.