Skip to content

Commit 112cbe4

Browse files
authored
Merge pull request #1132 from M3nin0/hotfix/args-merge
hotfix: fix sits_regularize and sits_merge
2 parents 745a00f + dd05607 commit 112cbe4

10 files changed

Lines changed: 50 additions & 24 deletions

‎DESCRIPTION‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: sits
22
Type: Package
3-
Version: 1.5.1
3+
Version: 1.5.0-1
44
Title: Satellite Image Time Series Analysis for Earth Observation Data Cubes
55
Authors@R: c(person('Rolf', 'Simoes', role = c('aut'), email = 'rolf.simoes@inpe.br'),
66
person('Gilberto', 'Camara', role = c('aut', 'cre'), email = 'gilberto.camara.inpe@gmail.com'),
@@ -17,7 +17,7 @@ Description: An end-to-end toolkit for land use and land cover classification
1717
applied to satellite image data cubes, as described in Simoes et al (2021) <doi:10.3390/rs13132428>.
1818
Builds regular data cubes from collections in AWS, Microsoft Planetary Computer,
1919
Brazil Data Cube, and Digital Earth Africa using the Spatio-temporal Asset Catalog (STAC)
20-
protocol (<https://stacspec.org/> and the 'gdalcubes' R package
20+
protocol (<https://stacspec.org/>) and the 'gdalcubes' R package
2121
developed by Appel and Pebesma (2019) <doi:10.3390/data4030092>.
2222
Supports visualization methods for images and time series and
2323
smoothing filters for dealing with noisy time series.

‎NAMESPACE‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -337,9 +337,6 @@ S3method(sits_cube,default)
337337
S3method(sits_cube,local_cube)
338338
S3method(sits_cube,sar_cube)
339339
S3method(sits_cube,stac_cube)
340-
S3method(sits_detect_change,default)
341-
S3method(sits_detect_change,raster_cube)
342-
S3method(sits_detect_change,sits)
343340
S3method(sits_get_data,csv)
344341
S3method(sits_get_data,data.frame)
345342
S3method(sits_get_data,default)
@@ -443,9 +440,6 @@ export(sits_config)
443440
export(sits_config_show)
444441
export(sits_cube)
445442
export(sits_cube_copy)
446-
export(sits_detect_change)
447-
export(sits_detect_change_method)
448-
export(sits_dtw)
449443
export(sits_factory_function)
450444
export(sits_filter)
451445
export(sits_formula_linear)

‎NEWS.md‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
# SITS Release History
22

33
# What's new in SITS version 1.5
4+
5+
### Hotfix version 1.5.0-1
6+
* Remove tapply from `.reg_cube_split_assets()` for R 4.X compatibility
7+
* Fix `sits_merge()` function that was not merging `SAR` and `OPTICAL` cubes
8+
* Rename n_input_pixels back to input_pixels for compatibility with models trained in old versions of the package
9+
* Fix torch usage in Apple M3 by turning off MPS technology
10+
* Fix date parameter usage in `sits_view()`
11+
* Improve `plot()` performance using raster overviews
12+
* Include support for PLANET Mosaic product
13+
414
### New features in SITS version 1.5.0
515
* Support for SENTINEL-1-RTC and SENTINEL-2-L2A in CDSE
616
* Include support for DEA products SENTINEL-1-RTC, LS5-SR, LS7-SR, LS9-SR, ALOS-PALSAR-MOSAIC, NDVI ANOMALY, DAILY CHIRPS, MONTHLY CHIRPS and DEM-30

‎R/api_detect_changes.R‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@
143143
# Fill with zeros remaining NA pixels
144144
values <- C_fill_na(values, 0)
145145
# Used to check values (below)
146-
n_input_pixels <- nrow(values)
146+
input_pixels <- nrow(values)
147147
# Include names in cube predictors
148148
colnames(values) <- .pred_features_name(
149149
.ml_bands(cd_method), tile_timeline
@@ -163,7 +163,7 @@
163163
# Are the results consistent with the data input?
164164
.check_processed_values(
165165
values = values,
166-
n_input_pixels = n_input_pixels
166+
input_pixels = input_pixels
167167
)
168168
# Log here
169169
.debug_log(

‎R/api_regularize.R‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
breaks = timeline,
4343
labels = FALSE
4444
)
45-
fi_groups <- unname(tapply(fi, groups, list))
45+
fi_groups <- unname(split(fi, groups))
4646
assets <- .common_size(
4747
.discard(tile, "file_info"),
4848
feature = timeline[unique(groups)],

‎R/sits_detect_change.R‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
#' each point (tibble of class "sits")
3939
#' or a data cube indicating detections in each pixel
4040
#' (tibble of class "detections_cube").
41-
#' @export
4241
sits_detect_change <- function(data,
4342
cd_method,
4443
...,
@@ -49,7 +48,6 @@ sits_detect_change <- function(data,
4948
}
5049

5150
#' @rdname sits_detect_change
52-
#' @export
5351
sits_detect_change.sits <- function(data,
5452
cd_method,
5553
...,
@@ -74,7 +72,6 @@ sits_detect_change.sits <- function(data,
7472
}
7573

7674
#' @rdname sits_detect_change
77-
#' @export
7875
sits_detect_change.raster_cube <- function(data,
7976
cd_method, ...,
8077
roi = NULL,
@@ -180,7 +177,6 @@ sits_detect_change.raster_cube <- function(data,
180177
}
181178

182179
#' @rdname sits_detect_change
183-
#' @export
184180
sits_detect_change.default <- function(data, cd_method, ...) {
185181
stop("Input should be a sits tibble or a data cube")
186182
}

‎R/sits_detect_change_method.R‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
#' @return Change detection method prepared
1313
#' to be passed to
1414
#' \code{\link[sits]{sits_detect_change}}
15-
#' @export
16-
#'
1715
sits_detect_change_method <- function(samples, cd_method = sits_dtw()) {
1816
# set caller to show in errors
1917
.check_set_caller("sits_detect_change_method")

‎R/sits_dtw.R‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919
#' used in operations with data cubes.
2020
#' @return Change detection method prepared to be passed to
2121
#' \code{\link[sits]{sits_detect_change_method}}
22-
#' @export
23-
#'
2422
sits_dtw <-
2523
function(samples = NULL,
2624
...,

‎R/sits_merge.R‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -132,10 +132,10 @@ sits_merge.raster_cube <- function(data1, data2, ...) {
132132
.data[["tile"]]
133133
)
134134

135-
if (inherits(data2, "raster_cube")) {
136-
return(.merge_equal_cube(data1, data2))
137-
} else {
135+
if (inherits(data2, "sar_cube")) {
138136
return(.merge_distinct_cube(data1, data2))
137+
} else {
138+
return(.merge_equal_cube(data1, data2))
139139
}
140140
}
141141

@@ -152,8 +152,8 @@ sits_merge.raster_cube <- function(data1, data2, ...) {
152152

153153
.merge_distinct_cube <- function(data1, data2) {
154154
# Get cubes timeline
155-
d1_tl <- unique(as.Date(unlist(.cube_timeline(data1))))
156-
d2_tl <- unique(as.Date(unlist(.cube_timeline(data2))))
155+
d1_tl <- unique(as.Date(.cube_timeline(data1)[[1]]))
156+
d2_tl <- unique(as.Date(.cube_timeline(data2)[[1]]))
157157

158158
# get intervals
159159
d1_period <- as.numeric(
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
sources:
2+
PLANET :
3+
s3_class : ["planet_cube", "stac_cube", "eo_cube",
4+
"raster_cube"]
5+
collections :
6+
MOSAIC :
7+
bands :
8+
B01 : &planet_mosaic_4m
9+
missing_value : 0
10+
minimum_value : 1
11+
maximum_value : 65534
12+
scale_factor : 0.01
13+
offset_value : 0
14+
resolution : 4.77
15+
band_name : "blue"
16+
data_type : "INT2U"
17+
B02 :
18+
<<: *planet_mosaic_4m
19+
band_name : "green"
20+
B03 :
21+
<<: *planet_mosaic_4m
22+
band_name : "red"
23+
B04 :
24+
<<: *planet_mosaic_4m
25+
band_name : "nir"
26+
satellite : "PLANETSCOPE"
27+
sensor : "MOSAIC"
28+
collection_name: "planet-mosaic"
29+
ext_tolerance: 0
30+
grid_system : ""

0 commit comments

Comments
 (0)