@@ -131,18 +131,6 @@ test_that("Segmentation", {
131
131
regexp = " Recovery: "
132
132
)
133
133
})
134
- # Expect error when trying to classify derived cube
135
- expect_error({
136
- sits_classify(
137
- data = probs_segs ,
138
- ml_model = rfor_model ,
139
- output_dir = output_dir ,
140
- n_sam_pol = 20 ,
141
- multicores = 6 ,
142
- memsize = 24 ,
143
- version = " vt2"
144
- )
145
- })
146
134
# Create a classified vector cube
147
135
class_segs <- sits_label_classification(
148
136
cube = probs_segs ,
@@ -195,13 +183,12 @@ test_that("Segmentation", {
195
183
expect_true(all(sits_labels(rfor_model ) %in% colnames(sf_uncert )))
196
184
})
197
185
test_that(" Segmentation of large files" ,{
198
-
199
186
modis_cube <- .try(
200
187
{
201
188
sits_cube(
202
189
source = " BDC" ,
203
190
collection = " MOD13Q1-6" ,
204
- bands = c(" NDVI" , " CLOUD" ),
191
+ bands = c(" NDVI" , " EVI " , " CLOUD" ),
205
192
tiles = " 012010" ,
206
193
start_date = " 2018-09-14" ,
207
194
end_date = " 2019-08-29" ,
@@ -217,13 +204,17 @@ test_that("Segmentation of large files",{
217
204
if (! dir.exists(output_dir )) {
218
205
dir.create(output_dir )
219
206
}
220
- modis_cube_local <- sits_regularize(
221
- cube = modis_cube ,
222
- period = " P1M" ,
223
- res = 1000 ,
224
- multicores = 6 ,
225
- output_dir = output_dir
207
+ expect_warning(
208
+ modis_cube_local <- sits_regularize(
209
+ cube = modis_cube ,
210
+ period = " P1M" ,
211
+ res = 1000 ,
212
+ multicores = 6 ,
213
+ output_dir = output_dir
214
+ )
226
215
)
216
+ expect_true(.cube_is_regular(modis_cube_local ))
217
+ expect_true(all(sits_bands(modis_cube_local ) %in% c(" EVI" , " NDVI" )))
227
218
segments <- sits_segment(
228
219
cube = modis_cube_local ,
229
220
seg_fn = sits_slic(
@@ -235,8 +226,11 @@ test_that("Segmentation of large files",{
235
226
multicores = 4 ,
236
227
memsize = 16 ,
237
228
progress = TRUE ,
238
- version = " res1000-step50-iter10-minarea100-m4 "
229
+ version = " v2bands "
239
230
)
231
+ expect_s3_class(object = segments , class = " vector_cube" )
232
+ expect_true(" vector_info" %in% colnames(segments ))
233
+
240
234
# Train a rf model
241
235
rfor_model <- sits_train(samples_modis_ndvi , ml_method = sits_rfor )
242
236
probs_segs <- sits_classify(
@@ -246,7 +240,15 @@ test_that("Segmentation of large files",{
246
240
n_sam_pol = 10 ,
247
241
multicores = 6 ,
248
242
memsize = 24 ,
249
- version = " res1000"
243
+ version = " v2bands"
244
+ )
245
+ expect_s3_class(probs_segs , class = " probs_vector_cube" )
246
+ expect_true(
247
+ " vector_info" %in% colnames(probs_segs )
248
+ )
249
+ # Read segments of a probability cube
250
+ vector_probs <- .segments_read_vec(probs_segs )
251
+ expect_true(
252
+ all(sits_labels(probs_segs ) %in% colnames(vector_probs ))
250
253
)
251
-
252
254
})
0 commit comments