Skip to content

Commit 7e98e88

Browse files
plot overviews
1 parent 61af7d9 commit 7e98e88

9 files changed

+102
-115
lines changed

DESCRIPTION

+4-2
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,12 @@ Description: An end-to-end toolkit for land use and land cover classification
2828
temporal convolutional neural networks proposed by Pelletier et al (2019) <doi:10.3390/rs11050523>,
2929
residual networks by Fawaz et al (2019) <doi:10.1007/s10618-019-00619-1>, and temporal attention encoders
3030
by Garnot and Landrieu (2020) <doi:10.48550/arXiv.2007.00586>.
31+
Supports GPU processing of deep learning models using torch <https://torch.mlverse.org/>.
3132
Performs efficient classification of big Earth observation data cubes and includes
3233
functions for post-classification smoothing based on Bayesian inference, and
33-
methods for uncertainty assessment. Enables best
34-
practices for estimating area and assessing accuracy of land change as
34+
methods for active learning and uncertainty assessment. Supports object-based
35+
time series analysis using package supercells <https://jakubnowosad.com/supercells/>.
36+
Enables best practices for estimating area and assessing accuracy of land change as
3537
recommended by Olofsson et al (2014) <doi:10.1016/j.rse.2014.02.015>.
3638
Minimum recommended requirements: 16 GB RAM and 4 CPU dual-core.
3739
Encoding: UTF-8

NAMESPACE

-2
Original file line numberDiff line numberDiff line change
@@ -274,8 +274,6 @@ S3method(.view_add_overlay_grps,class_cube)
274274
S3method(.view_add_overlay_grps,derived_cube)
275275
S3method(.view_add_overlay_grps,raster_cube)
276276
S3method(.view_add_overlay_grps,vector_cube)
277-
S3method(.view_adjust_palette,default)
278-
S3method(.view_adjust_palette,sar_cube)
279277
S3method(plot,class_cube)
280278
S3method(plot,class_vector_cube)
281279
S3method(plot,geo_distances)

R/api_gdal.R

+17-9
Original file line numberDiff line numberDiff line change
@@ -92,22 +92,30 @@
9292
)
9393
return(invisible(file))
9494
}
95-
#' @title Run gdal_warp for SAR GRD files
95+
#' @title Run gdal_warp_file
9696
#' @noRd
9797
#' @param raster_file File to be copied from (with path)
98-
#' @param size Size of output file
98+
#' @param sizes Sizes of output file
99+
#' @param t_srs Target spatial reference system
99100
#' @returns Name of output file
100-
.gdal_warp_grd <- function(raster_file, size) {
101+
.gdal_warp_file <- function(raster_file, sizes, t_srs = NULL) {
102+
# create a temporary file
101103
temp_file <- tempfile(fileext = ".tif")
104+
# basic parameters
105+
params = list(
106+
"-ts" = list(sizes[["xsize"]], sizes[["ysize"]]),
107+
"-multi" = FALSE,
108+
"-q" = TRUE,
109+
"-overwrite" = FALSE
110+
)
111+
# additional param for target SRS
112+
if (.has(t_srs))
113+
params <- append(params, c("t_srs" = t_srs))
114+
# warp the data
102115
.gdal_warp(
103116
file = temp_file,
104117
base_files = raster_file,
105-
params = list(
106-
"-ts" = list(size[["xsize"]], size[["ysize"]]),
107-
"-multi" = FALSE,
108-
"-q" = TRUE,
109-
"-overwrite" = FALSE
110-
),
118+
params = params,
111119
quiet = TRUE)
112120
return(temp_file)
113121
}

R/api_plot_raster.R

+7-7
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
band_offset <- .offset(band_conf)
3939
max_value <- .max_value(band_conf)
4040
# retrieve the overview if COG
41-
bw_file <- .gdal_warp_grd(bw_file, sizes)
41+
bw_file <- .gdal_warp_file(bw_file, sizes)
4242
# open the file in terra
4343
rast <- terra::rast(bw_file)
4444
# apply scale and offset
@@ -142,9 +142,9 @@
142142
max_value <- .max_value(band_params)
143143
# used for SAR images without tiling system
144144
if (tile[["tile"]] == "NoTilingSystem") {
145-
red_file <- .gdal_warp_grd(red_file, sizes)
146-
green_file <- .gdal_warp_grd(green_file, sizes)
147-
blue_file <- .gdal_warp_grd(blue_file, sizes)
145+
red_file <- .gdal_warp_file(red_file, sizes)
146+
green_file <- .gdal_warp_file(green_file, sizes)
147+
blue_file <- .gdal_warp_file(blue_file, sizes)
148148
}
149149
# plot multitemporal band as RGB
150150
p <- .plot_rgb_stars(
@@ -201,9 +201,9 @@
201201
sizes <- .tile_overview_size(tile = tile, max_size)
202202
# used for SAR images
203203
if (tile[["tile"]] == "NoTilingSystem") {
204-
red_file <- .gdal_warp_grd(red_file, sizes)
205-
green_file <- .gdal_warp_grd(green_file, sizes)
206-
blue_file <- .gdal_warp_grd(blue_file, sizes)
204+
red_file <- .gdal_warp_file(red_file, sizes)
205+
green_file <- .gdal_warp_file(green_file, sizes)
206+
blue_file <- .gdal_warp_file(blue_file, sizes)
207207
}
208208
p <- .plot_rgb_stars(
209209
red_file = red_file,

0 commit comments

Comments
 (0)