File tree 3 files changed +36
-0
lines changed
3 files changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -749,6 +749,18 @@ NULL
749
749
cube <- .cube_filter_bands(cube , bands )
750
750
return (cube )
751
751
}
752
+ # ' @title Filter tiles that are non-empty.
753
+ # ' @noRd
754
+ # ' @param cube A data cube.
755
+ # ' @return A filtered data cube.
756
+ .cube_filter_nonempty <- function (cube ) {
757
+ UseMethod(" .cube_filter_nonempty" , cube )
758
+ }
759
+ # ' @export
760
+ .cube_filter_nonempty.raster_cube <- function (cube , roi ) {
761
+ not_empty <- slider :: slide_lgl(cube , .tile_is_nonempty )
762
+ cube [not_empty , ]
763
+ }
752
764
# ' @title Returns the tile names of a data cube
753
765
# ' @noRd
754
766
# ' @param cube A data cube.
Original file line number Diff line number Diff line change 165
165
}) | >
166
166
dplyr :: bind_rows()
167
167
168
+ # Filter non-empty file info
169
+ cube <- .cube_filter_nonempty(cube )
170
+
168
171
# Finalize customizing cube class
169
172
cube_class <- c(cube_class [1 ], " sar_cube" , cube_class [- 1 ])
170
173
.cube_set_class(cube , cube_class )
Original file line number Diff line number Diff line change @@ -365,6 +365,27 @@ NULL
365
365
is_complete <- .tile_is_complete(tile )
366
366
return (is_complete )
367
367
}
368
+ # ' @title Check if tile's file info is not empty
369
+ # ' @name .tile_is_nonempty
370
+ # ' @keywords internal
371
+ # ' @noRd
372
+ # ' @param tile A tile.
373
+ # ' @return TRUE/FALSE
374
+ .tile_is_nonempty <- function (tile ) {
375
+ UseMethod(" .tile_is_nonempty" , tile )
376
+ }
377
+ # ' @export
378
+ .tile_is_nonempty.raster_cube <- function (tile ) {
379
+ tile <- .tile(tile )
380
+ nrow(.fi(tile )) > 0
381
+ }
382
+ # ' @export
383
+ .tile_is_nonempty.default <- function (tile ) {
384
+ tile <- tibble :: as_tibble(tile )
385
+ tile <- .cube_find_class(tile )
386
+ is_nonempty <- .tile_is_nonempty(tile )
387
+ return (is_nonempty )
388
+ }
368
389
# ' @title Get path of first asset from file_info.
369
390
# ' @name .tile_path
370
391
# ' @keywords internal
You can’t perform that action at this time.
0 commit comments