-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathdc_cubeoperations.html
More file actions
1103 lines (1079 loc) · 80.9 KB
/
Copy pathdc_cubeoperations.html
File metadata and controls
1103 lines (1079 loc) · 80.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta charset="utf-8" />
<meta name="generator" content="quarto-1.3.361" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
<meta name="author" content="Gilberto Camara, Rolf Simoes, Felipe Souza, Felipe Carlos, Pedro Andrade, Karine Ferreira, Lorena Santos, Charlotte Pelletier, Bianca Zadrosny" />
<title>Satellite Image Time Series Analysis on Earth Observation Data Cubes – 8 Algebraic operations on data cubes</title>
<style>
code{white-space: pre-wrap;}
span.smallcaps{font-variant: small-caps;}
div.columns{display: flex; gap: min(4vw, 1.5em);}
div.column{flex: auto; overflow-x: auto;}
div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
ul.task-list{list-style: none;}
ul.task-list li input[type="checkbox"] {
width: 0.8em;
margin: 0 0.8em 0.2em -1em; /* quarto-specific, see https://github.com/quarto-dev/quarto-cli/issues/4556 */
vertical-align: middle;
}
/* CSS for syntax highlighting */
pre > code.sourceCode { white-space: pre; position: relative; }
pre > code.sourceCode > span { display: inline-block; line-height: 1.25; }
pre > code.sourceCode > span:empty { height: 1.2em; }
.sourceCode { overflow: visible; }
code.sourceCode > span { color: inherit; text-decoration: inherit; }
div.sourceCode { margin: 1em 0; }
pre.sourceCode { margin: 0; }
@media screen {
div.sourceCode { overflow: auto; }
}
@media print {
pre > code.sourceCode { white-space: pre-wrap; }
pre > code.sourceCode > span { text-indent: -5em; padding-left: 5em; }
}
pre.numberSource code
{ counter-reset: source-line 0; }
pre.numberSource code > span
{ position: relative; left: -4em; counter-increment: source-line; }
pre.numberSource code > span > a:first-child::before
{ content: counter(source-line);
position: relative; left: -1em; text-align: right; vertical-align: baseline;
border: none; display: inline-block;
-webkit-touch-callout: none; -webkit-user-select: none;
-khtml-user-select: none; -moz-user-select: none;
-ms-user-select: none; user-select: none;
padding: 0 4px; width: 4em;
}
pre.numberSource { margin-left: 3em; padding-left: 4px; }
div.sourceCode
{ }
@media screen {
pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; }
}
/* CSS for citations */
div.csl-bib-body { }
div.csl-entry {
clear: both;
}
.hanging-indent div.csl-entry {
margin-left:2em;
text-indent:-2em;
}
div.csl-left-margin {
min-width:2em;
float:left;
}
div.csl-right-inline {
margin-left:2em;
padding-left:1em;
}
div.csl-indent {
margin-left: 2em;
}</style>
<!-- htmldependencies:E3FAD763 -->
<script id="quarto-search-options" type="application/json">{
"location": "sidebar",
"copy-button": false,
"collapse-after": 3,
"panel-placement": "start",
"type": "textbox",
"limit": 20,
"language": {
"search-no-results-text": "No results",
"search-matching-documents-text": "matching documents",
"search-copy-link-title": "Copy link to search",
"search-hide-matches-text": "Hide additional matches",
"search-more-match-text": "more match in this document",
"search-more-matches-text": "more matches in this document",
"search-clear-button-title": "Clear",
"search-detached-cancel-button-title": "Cancel",
"search-submit-button-title": "Submit",
"search-label": "Search"
}
}</script>
</head>
<body>
<div id="quarto-search-results"></div>
<header id="quarto-header" class="headroom fixed-top">
<nav class="quarto-secondary-nav">
<div class="container-fluid d-flex">
<button type="button" class="quarto-btn-toggle btn"
data-bs-toggle="collapse" data-bs-target="#quarto-sidebar,#quarto-sidebar-glass"
aria-controls="quarto-sidebar" aria-expanded="false" aria-label="Toggle sidebar navigation"
onclick="if (window.quartoToggleHeadroom) { window.quartoToggleHeadroom(); }">
<i class="bi bi-layout-text-sidebar-reverse"></i>
</button>
<h1 class="quarto-secondary-nav-title"></h1>
<a class="flex-grow-1" role="button" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar,#quarto-sidebar-glass"
aria-controls="quarto-sidebar" aria-expanded="false" aria-label="Toggle sidebar navigation"
onclick="if (window.quartoToggleHeadroom) { window.quartoToggleHeadroom(); }">
</a>
<button type="button" class="btn quarto-search-button" aria-label="" onclick="window.quartoOpenSearch();">
<i class="bi bi-search"></i>
</button>
</div>
</nav>
</header>
<!-- content -->
<div id="quarto-content" class="quarto-container page-columns page-rows-contents page-layout-article">
<!-- sidebar -->
<nav id="quarto-sidebar" class="sidebar collapse collapse-horizontal sidebar-navigation floating overflow-auto">
<div class="pt-lg-2 mt-2 text-left sidebar-header">
<div class="sidebar-title mb-0 py-0">
<a href="/">
Satellite Image Time Series Analysis on Earth Observation Data Cubes
</a>
<div class="sidebar-tools-main">
<a href="https://github.com/e-sensing/sitsbook" title="Source Code" class="quarto-navigation-tool px-1" aria-label="Source Code"><i class="bi bi-github"></i></a>
<a href="" class="quarto-reader-toggle quarto-navigation-tool px-1" onclick="window.quartoToggleReader(); return false;" title="Toggle reader mode">
<div class="quarto-reader-toggle-btn">
<i class="bi"></i>
</div>
</a>
</div>
</div>
</div>
<div class="mt-2 flex-shrink-0 align-items-center">
<div class="sidebar-search">
<div id="quarto-search" class="" title="Search"></div>
</div>
</div>
<div class="sidebar-menu-container">
<ul class="list-unstyled mt-1">
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="/index.html" class="sidebar-item-text sidebar-link">
<span class="menu-text">Greetings</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="/setup.html" class="sidebar-item-text sidebar-link">
<span class="menu-text">Setup</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="/support.html" class="sidebar-item-text sidebar-link">
<span class="menu-text">Support</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="/acknowledgements.html" class="sidebar-item-text sidebar-link">
<span class="menu-text">Acknowledgements</span></a>
</div>
</li>
<li class="sidebar-item sidebar-item-section">
<div class="sidebar-item-container">
<a href="/introduction.html" class="sidebar-item-text sidebar-link">
<span class="menu-text">The Basics of SITS</span></a>
<a class="sidebar-item-toggle text-start" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar-section-1" aria-expanded="true" aria-label="Toggle section">
<i class="bi bi-chevron-right ms-2"></i>
</a>
</div>
<ul id="quarto-sidebar-section-1" class="collapse list-unstyled sidebar-section depth1 show">
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="/intro_quicktour.html" class="sidebar-item-text sidebar-link">
<span class="menu-text"><span class='chapter-number'>1</span> <span class='chapter-title'>A quick tour of SITS</span></span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="/intro_examples.html" class="sidebar-item-text sidebar-link">
<span class="menu-text"><span class='chapter-number'>2</span> <span class='chapter-title'>How to use SITS with real examples</span></span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="/intro_visualisation.html" class="sidebar-item-text sidebar-link">
<span class="menu-text"><span class='chapter-number'>3</span> <span class='chapter-title'>Data visualisation in SITS</span></span></a>
</div>
</li>
</ul>
</li>
<li class="sidebar-item sidebar-item-section">
<div class="sidebar-item-container">
<a href="/datacubes.html" class="sidebar-item-text sidebar-link">
<span class="menu-text">Earth observation data cubes</span></a>
<a class="sidebar-item-toggle text-start" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar-section-2" aria-expanded="true" aria-label="Toggle section">
<i class="bi bi-chevron-right ms-2"></i>
</a>
</div>
<ul id="quarto-sidebar-section-2" class="collapse list-unstyled sidebar-section depth1 show">
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="/dc_ardcollections.html" class="sidebar-item-text sidebar-link">
<span class="menu-text"><span class='chapter-number'>4</span> <span class='chapter-title'>Analysis-ready image collections</span></span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="/dc_regularize.html" class="sidebar-item-text sidebar-link">
<span class="menu-text"><span class='chapter-number'>5</span> <span class='chapter-title'>Building regular data cubes</span></span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="/dc_merge.html" class="sidebar-item-text sidebar-link">
<span class="menu-text"><span class='chapter-number'>6</span> <span class='chapter-title'>Merging multi-source EO data cubes</span></span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="/dc_localcubes.html" class="sidebar-item-text sidebar-link">
<span class="menu-text"><span class='chapter-number'>7</span> <span class='chapter-title'>Data cubes from local files</span></span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="/dc_cubeoperations.html" class="sidebar-item-text sidebar-link active">
<span class="menu-text"><span class='chapter-number'>8</span> <span class='chapter-title'>Algebraic operations on data cubes</span></span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="/dc_mixture.html" class="sidebar-item-text sidebar-link">
<span class="menu-text"><span class='chapter-number'>9</span> <span class='chapter-title'>Spectral mixture analysis</span></span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="/dc_reduce.html" class="sidebar-item-text sidebar-link">
<span class="menu-text"><span class='chapter-number'>10</span> <span class='chapter-title'>Temporal reduction operations</span></span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="/dc_texture.html" class="sidebar-item-text sidebar-link">
<span class="menu-text"><span class='chapter-number'>11</span> <span class='chapter-title'>Texture operations in data cubes</span></span></a>
</div>
</li>
</ul>
</li>
<li class="sidebar-item sidebar-item-section">
<div class="sidebar-item-container">
<a href="/timeseries.html" class="sidebar-item-text sidebar-link">
<span class="menu-text">Satellite image time series</span></a>
<a class="sidebar-item-toggle text-start" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar-section-3" aria-expanded="true" aria-label="Toggle section">
<i class="bi bi-chevron-right ms-2"></i>
</a>
</div>
<ul id="quarto-sidebar-section-3" class="collapse list-unstyled sidebar-section depth1 show">
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="/ts_basics.html" class="sidebar-item-text sidebar-link">
<span class="menu-text"><span class='chapter-number'>12</span> <span class='chapter-title'>Basic operations on image time series</span></span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="/ts_cluster.html" class="sidebar-item-text sidebar-link">
<span class="menu-text"><span class='chapter-number'>13</span> <span class='chapter-title'>Hierarchical clustering of time series</span></span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="/ts_som.html" class="sidebar-item-text sidebar-link">
<span class="menu-text"><span class='chapter-number'>14</span> <span class='chapter-title'>Self-organized maps for sample quality control</span></span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="/ts_balance.html" class="sidebar-item-text sidebar-link">
<span class="menu-text"><span class='chapter-number'>15</span> <span class='chapter-title'>Reducing imbalances in training samples</span></span></a>
</div>
</li>
</ul>
</li>
<li class="sidebar-item sidebar-item-section">
<div class="sidebar-item-container">
<a href="/classification.html" class="sidebar-item-text sidebar-link">
<span class="menu-text">Machine learning for image time series</span></a>
<a class="sidebar-item-toggle text-start" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar-section-4" aria-expanded="true" aria-label="Toggle section">
<i class="bi bi-chevron-right ms-2"></i>
</a>
</div>
<ul id="quarto-sidebar-section-4" class="collapse list-unstyled sidebar-section depth1 show">
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="/cl_machinelearning.html" class="sidebar-item-text sidebar-link">
<span class="menu-text"><span class='chapter-number'>16</span> <span class='chapter-title'>Machine learning algorithms for image time series</span></span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="/cl_tuning.html" class="sidebar-item-text sidebar-link">
<span class="menu-text"><span class='chapter-number'>17</span> <span class='chapter-title'>Deep learning model tuning</span></span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="/cl_rasterclassification.html" class="sidebar-item-text sidebar-link">
<span class="menu-text"><span class='chapter-number'>18</span> <span class='chapter-title'>Classification of raster data cubes</span></span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="/cl_smoothing.html" class="sidebar-item-text sidebar-link">
<span class="menu-text"><span class='chapter-number'>19</span> <span class='chapter-title'>Bayesian smoothing for classification post-processing</span></span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="/cl_reclassification.html" class="sidebar-item-text sidebar-link">
<span class="menu-text"><span class='chapter-number'>20</span> <span class='chapter-title'>Map reclassification</span></span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="/cl_uncertainty.html" class="sidebar-item-text sidebar-link">
<span class="menu-text"><span class='chapter-number'>21</span> <span class='chapter-title'>Uncertainty and active learning</span></span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="/cl_ensembleprediction.html" class="sidebar-item-text sidebar-link">
<span class="menu-text"><span class='chapter-number'>22</span> <span class='chapter-title'>Ensemble prediction with multiple models</span></span></a>
</div>
</li>
</ul>
</li>
<li class="sidebar-item sidebar-item-section">
<div class="sidebar-item-container">
<a href="/validation.html" class="sidebar-item-text sidebar-link">
<span class="menu-text">Validation and accuracy measurement</span></a>
<a class="sidebar-item-toggle text-start" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar-section-5" aria-expanded="true" aria-label="Toggle section">
<i class="bi bi-chevron-right ms-2"></i>
</a>
</div>
<ul id="quarto-sidebar-section-5" class="collapse list-unstyled sidebar-section depth1 show">
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="/val_kfold.html" class="sidebar-item-text sidebar-link">
<span class="menu-text"><span class='chapter-number'>23</span> <span class='chapter-title'>Cross-validation of training data</span></span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="/val_map.html" class="sidebar-item-text sidebar-link">
<span class="menu-text"><span class='chapter-number'>24</span> <span class='chapter-title'>Map accuracy assessment</span></span></a>
</div>
</li>
</ul>
</li>
<li class="sidebar-item sidebar-item-section">
<div class="sidebar-item-container">
<a href="/vector_datacubes.html" class="sidebar-item-text sidebar-link">
<span class="menu-text">Vector data cubes</span></a>
<a class="sidebar-item-toggle text-start" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar-section-6" aria-expanded="true" aria-label="Toggle section">
<i class="bi bi-chevron-right ms-2"></i>
</a>
</div>
<ul id="quarto-sidebar-section-6" class="collapse list-unstyled sidebar-section depth1 show">
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="/vec_obia.html" class="sidebar-item-text sidebar-link">
<span class="menu-text"><span class='chapter-number'>25</span> <span class='chapter-title'>Object-based time series image analysis</span></span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="/vec_creating.html" class="sidebar-item-text sidebar-link">
<span class="menu-text"><span class='chapter-number'>26</span> <span class='chapter-title'>Creating vector data cube from local files</span></span></a>
</div>
</li>
</ul>
</li>
<li class="sidebar-item sidebar-item-section">
<div class="sidebar-item-container">
<a href="/embeddings.html" class="sidebar-item-text sidebar-link">
<span class="menu-text">Foundational Models and Embeddings</span></a>
<a class="sidebar-item-toggle text-start" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar-section-7" aria-expanded="true" aria-label="Toggle section">
<i class="bi bi-chevron-right ms-2"></i>
</a>
</div>
<ul id="quarto-sidebar-section-7" class="collapse list-unstyled sidebar-section depth1 show">
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="/emb_build.html" class="sidebar-item-text sidebar-link">
<span class="menu-text"><span class='chapter-number'>27</span> <span class='chapter-title'>Building regional embeddings</span></span></a>
</div>
</li>
</ul>
</li>
<li class="sidebar-item sidebar-item-section">
<div class="sidebar-item-container">
<a href="/annex.html" class="sidebar-item-text sidebar-link">
<span class="menu-text">Advanced Topics</span></a>
<a class="sidebar-item-toggle text-start" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar-section-8" aria-expanded="true" aria-label="Toggle section">
<i class="bi bi-chevron-right ms-2"></i>
</a>
</div>
<ul id="quarto-sidebar-section-8" class="collapse list-unstyled sidebar-section depth1 show">
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="/annex_export.html" class="sidebar-item-text sidebar-link">
<span class="menu-text"><span class='chapter-number'>28</span> <span class='chapter-title'>Exporting data to other packages</span></span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="/annex_gee.html" class="sidebar-item-text sidebar-link">
<span class="menu-text"><span class='chapter-number'>29</span> <span class='chapter-title'>SITS and GEE: side-by-side comparison</span></span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="/annex_api.html" class="sidebar-item-text sidebar-link">
<span class="menu-text"><span class='chapter-number'>30</span> <span class='chapter-title'>Developing new functions in SITS</span></span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="/annex_ml.html" class="sidebar-item-text sidebar-link">
<span class="menu-text"><span class='chapter-number'>31</span> <span class='chapter-title'>Including new methods for machine learning</span></span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="/annex_stac.html" class="sidebar-item-text sidebar-link">
<span class="menu-text"><span class='chapter-number'>32</span> <span class='chapter-title'>Supporting STAC-based ARD catalogs</span></span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="/annex_parallel.html" class="sidebar-item-text sidebar-link">
<span class="menu-text"><span class='chapter-number'>33</span> <span class='chapter-title'>How parallel processing works in SITS</span></span></a>
</div>
</li>
</ul>
</li>
</ul>
</div>
</nav>
<div id="quarto-sidebar-glass" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar,#quarto-sidebar-glass" ></div>
<!-- margin-sidebar -->
<div id="quarto-margin-sidebar" class="sidebar margin-sidebar">
<div id="quarto-toc-target"></div>
</div>
<!-- main -->
<main class="content" id="quarto-document-content">
<script>window.__SITSHELP_CONFIG__ = { apiUrl: "https://sits-rag.ngrok.io" };</script>
<header id="title-block-header" class="quarto-title-block default">
<div class="quarto-title">
<h1 class="title"><span class="chapter-number">8</span> <span class="chapter-title">Algebraic operations on data cubes</span></h1>
</div>
<div class="quarto-title-meta">
</div>
</header>
<nav id="TOC" role="doc-toc">
<h2 id="toc-title">Table of contents</h2>
<ul>
<li><a href="#configurations-to-run-this-chapter" id="toc-configurations-to-run-this-chapter">Configurations to run this chapter</a></li>
<li><a href="#pixel-based-and-neighborhood-based-operations" id="toc-pixel-based-and-neighborhood-based-operations"><span class="header-section-number">8.1</span> Pixel-based and neighborhood-based operations</a></li>
<li><a href="#computing-vegetation-indexes" id="toc-computing-vegetation-indexes"><span class="header-section-number">8.2</span> Computing vegetation indexes</a></li>
<li><a href="#spectral-indexes-for-identifying-burned-areas" id="toc-spectral-indexes-for-identifying-burned-areas"><span class="header-section-number">8.3</span> Spectral indexes for identifying burned areas</a></li>
<li><a href="#support-for-non-normalized-indexes" id="toc-support-for-non-normalized-indexes"><span class="header-section-number">8.4</span> Support for non-normalized indexes</a></li>
<li><a href="#summary" id="toc-summary"><span class="header-section-number">8.5</span> Summary</a></li>
<li><a href="#references" id="toc-references">References</a></li>
</ul>
</nav>
<p><a href="https://www.kaggle.com/code/esensing/computing-ndvi-and-other-spectral-indices" target="_blank"> <img src="https://kaggle.com/static/images/open-in-kaggle.svg"/> </a></p>
<section id="configurations-to-run-this-chapter" class="level3 unnumbered">
<h3 class="unnumbered">Configurations to run this chapter</h3>
<div class="panel-tabset">
<ul class="nav nav-tabs" role="tablist"><li class="nav-item" role="presentation"><a class="nav-link active" id="tabset-1-1-tab" data-bs-toggle="tab" data-bs-target="#tabset-1-1" role="tab" aria-controls="tabset-1-1" aria-selected="true">R</a></li><li class="nav-item" role="presentation"><a class="nav-link" id="tabset-1-2-tab" data-bs-toggle="tab" data-bs-target="#tabset-1-2" role="tab" aria-controls="tabset-1-2" aria-selected="false">Python</a></li></ul>
<div class="tab-content">
<div id="tabset-1-1" class="tab-pane active" role="tabpanel" aria-labelledby="tabset-1-1-tab">
<div class="cell">
<div class="sourceCode" id="cb1"><pre class="sourceCode r cell-code"><code class="sourceCode r"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="co"># load package "tibble"</span></span>
<span id="cb1-2"><a href="#cb1-2" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(tibble)</span>
<span id="cb1-3"><a href="#cb1-3" aria-hidden="true" tabindex="-1"></a><span class="co"># load packages "sits" and "sitsdata"</span></span>
<span id="cb1-4"><a href="#cb1-4" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(sits)</span>
<span id="cb1-5"><a href="#cb1-5" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(sitsdata)</span>
<span id="cb1-6"><a href="#cb1-6" aria-hidden="true" tabindex="-1"></a><span class="co"># set tempdir if it does not exist </span></span>
<span id="cb1-7"><a href="#cb1-7" aria-hidden="true" tabindex="-1"></a>tempdir_r <span class="ot"><-</span> <span class="st">"~/sitsbook/tempdir/R/dc_cubeoperations"</span></span>
<span id="cb1-8"><a href="#cb1-8" aria-hidden="true" tabindex="-1"></a><span class="fu">dir.create</span>(tempdir_r, <span class="at">showWarnings =</span> <span class="cn">FALSE</span>, <span class="at">recursive =</span> <span class="cn">TRUE</span>)</span></code></pre></div>
</div>
</div>
<div id="tabset-1-2" class="tab-pane" role="tabpanel" aria-labelledby="tabset-1-2-tab">
<div class="cell">
<div class="sourceCode" id="cb2"><pre class="sourceCode python cell-code"><code class="sourceCode python"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a><span class="co"># load "pysits" library</span></span>
<span id="cb2-2"><a href="#cb2-2" aria-hidden="true" tabindex="-1"></a><span class="im">from</span> pysits <span class="im">import</span> <span class="op">*</span></span>
<span id="cb2-3"><a href="#cb2-3" aria-hidden="true" tabindex="-1"></a><span class="im">from</span> pathlib <span class="im">import</span> Path</span>
<span id="cb2-4"><a href="#cb2-4" aria-hidden="true" tabindex="-1"></a><span class="co"># set tempdir if it does not exist </span></span>
<span id="cb2-5"><a href="#cb2-5" aria-hidden="true" tabindex="-1"></a>tempdir_py <span class="op">=</span> Path.home() <span class="op">/</span> <span class="st">"sitsbook/tempdir/Python/dc_cubeoperations"</span></span>
<span id="cb2-6"><a href="#cb2-6" aria-hidden="true" tabindex="-1"></a>tempdir_py.mkdir(parents<span class="op">=</span><span class="va">True</span>, exist_ok<span class="op">=</span><span class="va">True</span>)</span></code></pre></div>
</div>
</div>
</div>
</div>
</section>
<section id="pixel-based-and-neighborhood-based-operations" class="level2" data-number="8.1">
<h2 data-number="8.1"><span class="header-section-number">8.1</span> Pixel-based and neighborhood-based operations</h2>
<p>Pixel-based operations in remote sensing images refer to image processing techniques that operate on individual pixels or cells in an image without considering their spatial relationships with neighboring pixels. These operations are typically applied to each pixel in the image independently; they are used to extract information on spectral, radiometric, or spatial properties. Pixel-based operations produce spectral indexes which combine data from multiple bands.</p>
<p>Neighborhood-based operations are applied to groups of pixels in an image. The neighborhood is typically defined as a rectangular or circular region centered on a given pixel. These operations can be used for removing noise, detecting edges, and sharpening, among other uses.</p>
<p>The <code>sits_apply()</code> function computes new indexes from a desired mathematical operation as a function of the bands available on the cube using any valid R expression. It applies the operation for all tiles and all temporal intervals. There are two types of operations in <code>sits_apply()</code>:</p>
<ul>
<li><p>Pixel-based operations that produce an index based on individual pixels of existing bands. The input bands and indexes should be part of the input data cube and have the same names used in the cube. The new index will be computed for every pixel of all images in the time series. Besides arithmetic operators, the function also accepts vectorized R functions that can be applied to matrices (e.g., <code>sqrt()</code>, <code>log()</code>, and <code>sin()</code>).</p></li>
<li><p>Neighborhood-based operations that produce a derived value based on a window centered around each individual pixel. The available functions are <code>w_median()</code>, <code>w_sum()</code>, <code>w_mean()</code>, <code>w_min()</code>, <code>w_max()</code>, <code>w_sd()</code> (standard deviation), and <code>w_var()</code> (variance). Users set the window size (only odd values are allowed).</p></li>
</ul>
<p>The following examples show how to use <code>sits_apply()</code>.</p>
</section>
<section id="computing-vegetation-indexes" class="level2" data-number="8.2">
<h2 data-number="8.2"><span class="header-section-number">8.2</span> Computing vegetation indexes</h2>
<p>Using vegetation indexes is an established practice in remote sensing. These indexes aim to improve the discrimination of vegetation structure by combining two wavebands, one where leaf pigments reflect incoming light with another where leaves absorb incoming radiation. Green leaves from natural vegetation such as forests have high reflectance in the near-infrared bands and low reflectance in the red bands of the electromagnetic spectrum. These spectral properties are used to calculate the Normalized Difference Vegetation Index (NDVI), a widely used index that is computed as the normalized difference between the values of near-infrared and red bands. Including red-edge bands in Sentinel-2 images has broadened the scope of the bands used to calculate these indexes <span class="citation" data-cites="Xie2019 Sun2020a"><a href="#ref-Xie2019" role="doc-biblioref">[1]</a>, <a href="#ref-Sun2020a" role="doc-biblioref">[2]</a></span>. In what follows, we show examples of vegetation index calculation using a Sentinel-2 data cube.</p>
<p>First, we define a data cube for a tile in the state of Rondonia, Brazil, including bands used to compute different vegetation indexes. We regularize the cube using a target resolution of 60 meters to reduce processing time.</p>
<div class="panel-tabset">
<ul class="nav nav-tabs" role="tablist"><li class="nav-item" role="presentation"><a class="nav-link active" id="tabset-2-1-tab" data-bs-toggle="tab" data-bs-target="#tabset-2-1" role="tab" aria-controls="tabset-2-1" aria-selected="true">R</a></li><li class="nav-item" role="presentation"><a class="nav-link" id="tabset-2-2-tab" data-bs-toggle="tab" data-bs-target="#tabset-2-2" role="tab" aria-controls="tabset-2-2" aria-selected="false">Python</a></li></ul>
<div class="tab-content">
<div id="tabset-2-1" class="tab-pane active" role="tabpanel" aria-labelledby="tabset-2-1-tab">
<div class="cell" data-hash="dc_cubeoperations_cache/html/apply-reg-s2_f73867c148e165d3379c3ec0d6516c2a">
<div class="sourceCode" id="cb3"><pre class="sourceCode r cell-code"><code class="sourceCode r"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="co"># Create an non-regular data cube from AWS</span></span>
<span id="cb3-2"><a href="#cb3-2" aria-hidden="true" tabindex="-1"></a>s2_cube <span class="ot"><-</span> <span class="fu">sits_cube</span>(</span>
<span id="cb3-3"><a href="#cb3-3" aria-hidden="true" tabindex="-1"></a> <span class="at">source =</span> <span class="st">"AWS"</span>,</span>
<span id="cb3-4"><a href="#cb3-4" aria-hidden="true" tabindex="-1"></a> <span class="at">collection =</span> <span class="st">"SENTINEL-S2-L2A-COGS"</span>,</span>
<span id="cb3-5"><a href="#cb3-5" aria-hidden="true" tabindex="-1"></a> <span class="at">tiles =</span> <span class="st">"20LKP"</span>,</span>
<span id="cb3-6"><a href="#cb3-6" aria-hidden="true" tabindex="-1"></a> <span class="at">bands =</span> <span class="fu">c</span>(<span class="st">"B02"</span>, <span class="st">"B03"</span>, <span class="st">"B04"</span>, </span>
<span id="cb3-7"><a href="#cb3-7" aria-hidden="true" tabindex="-1"></a> <span class="st">"B05"</span>, <span class="st">"B06"</span>, <span class="st">"B07"</span>, </span>
<span id="cb3-8"><a href="#cb3-8" aria-hidden="true" tabindex="-1"></a> <span class="st">"B08"</span>, <span class="st">"B8A"</span>, <span class="st">"B11"</span>, </span>
<span id="cb3-9"><a href="#cb3-9" aria-hidden="true" tabindex="-1"></a> <span class="st">"B12"</span>,<span class="st">"CLOUD"</span>),</span>
<span id="cb3-10"><a href="#cb3-10" aria-hidden="true" tabindex="-1"></a> <span class="at">start_date =</span> <span class="fu">as.Date</span>(<span class="st">"2018-07-01"</span>),</span>
<span id="cb3-11"><a href="#cb3-11" aria-hidden="true" tabindex="-1"></a> <span class="at">end_date =</span> <span class="fu">as.Date</span>(<span class="st">"2018-08-31"</span>))</span>
<span id="cb3-12"><a href="#cb3-12" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb3-13"><a href="#cb3-13" aria-hidden="true" tabindex="-1"></a><span class="co"># Regularize the cube to 15 day intervals</span></span>
<span id="cb3-14"><a href="#cb3-14" aria-hidden="true" tabindex="-1"></a>reg_cube <span class="ot"><-</span> <span class="fu">sits_regularize</span>(</span>
<span id="cb3-15"><a href="#cb3-15" aria-hidden="true" tabindex="-1"></a> <span class="at">cube =</span> s2_cube,</span>
<span id="cb3-16"><a href="#cb3-16" aria-hidden="true" tabindex="-1"></a> <span class="at">output_dir =</span> tempdir_r,</span>
<span id="cb3-17"><a href="#cb3-17" aria-hidden="true" tabindex="-1"></a> <span class="at">res =</span> <span class="dv">60</span>,</span>
<span id="cb3-18"><a href="#cb3-18" aria-hidden="true" tabindex="-1"></a> <span class="at">period =</span> <span class="st">"P15D"</span>,</span>
<span id="cb3-19"><a href="#cb3-19" aria-hidden="true" tabindex="-1"></a> <span class="at">multicores =</span> <span class="dv">4</span>)</span></code></pre></div>
</div>
</div>
<div id="tabset-2-2" class="tab-pane" role="tabpanel" aria-labelledby="tabset-2-2-tab">
<div class="cell">
<div class="sourceCode" id="cb4"><pre class="sourceCode python cell-code"><code class="sourceCode python"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="co"># Create an non-regular data cube from AWS</span></span>
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a>s2_cube <span class="op">=</span> sits_cube(</span>
<span id="cb4-3"><a href="#cb4-3" aria-hidden="true" tabindex="-1"></a> source <span class="op">=</span> <span class="st">"AWS"</span>,</span>
<span id="cb4-4"><a href="#cb4-4" aria-hidden="true" tabindex="-1"></a> collection <span class="op">=</span> <span class="st">"SENTINEL-S2-L2A-COGS"</span>,</span>
<span id="cb4-5"><a href="#cb4-5" aria-hidden="true" tabindex="-1"></a> tiles <span class="op">=</span> <span class="st">"20LKP"</span>,</span>
<span id="cb4-6"><a href="#cb4-6" aria-hidden="true" tabindex="-1"></a> bands <span class="op">=</span> (<span class="st">"B02"</span>, <span class="st">"B03"</span>, <span class="st">"B04"</span>, </span>
<span id="cb4-7"><a href="#cb4-7" aria-hidden="true" tabindex="-1"></a> <span class="st">"B05"</span>, <span class="st">"B06"</span>, <span class="st">"B07"</span>, </span>
<span id="cb4-8"><a href="#cb4-8" aria-hidden="true" tabindex="-1"></a> <span class="st">"B08"</span>, <span class="st">"B8A"</span>, <span class="st">"B11"</span>, </span>
<span id="cb4-9"><a href="#cb4-9" aria-hidden="true" tabindex="-1"></a> <span class="st">"B12"</span>,<span class="st">"CLOUD"</span>),</span>
<span id="cb4-10"><a href="#cb4-10" aria-hidden="true" tabindex="-1"></a> start_date <span class="op">=</span> <span class="st">"2018-07-01"</span>,</span>
<span id="cb4-11"><a href="#cb4-11" aria-hidden="true" tabindex="-1"></a> end_date <span class="op">=</span> <span class="st">"2018-08-31"</span>)</span>
<span id="cb4-12"><a href="#cb4-12" aria-hidden="true" tabindex="-1"></a> </span>
<span id="cb4-13"><a href="#cb4-13" aria-hidden="true" tabindex="-1"></a><span class="co"># Regularize the cube to 15 day intervals</span></span>
<span id="cb4-14"><a href="#cb4-14" aria-hidden="true" tabindex="-1"></a>reg_cube <span class="op">=</span> sits_regularize(</span>
<span id="cb4-15"><a href="#cb4-15" aria-hidden="true" tabindex="-1"></a> cube <span class="op">=</span> s2_cube,</span>
<span id="cb4-16"><a href="#cb4-16" aria-hidden="true" tabindex="-1"></a> output_dir <span class="op">=</span> tempdir_py,</span>
<span id="cb4-17"><a href="#cb4-17" aria-hidden="true" tabindex="-1"></a> res <span class="op">=</span> <span class="dv">60</span>,</span>
<span id="cb4-18"><a href="#cb4-18" aria-hidden="true" tabindex="-1"></a> period <span class="op">=</span> <span class="st">"P15D"</span>,</span>
<span id="cb4-19"><a href="#cb4-19" aria-hidden="true" tabindex="-1"></a> multicores <span class="op">=</span> <span class="dv">4</span>)</span></code></pre></div>
</div>
</div>
</div>
</div>
<p>There are many options for calculating vegetation indexes using Sentinel-2 bands. The most widely used method combines band B08 (785-899 nm) and band B04 (650-680 nm). Recent works in the literature propose using the red-edge bands B05 (698-713 nm), B06 (733-748 nm), and B07 (773-793 nm) for capturing subtle variations in chlorophyll absorption producing indexes, which are called Normalized Difference Vegetation Red-edge indexes (NDRE) <span class="citation" data-cites="Xie2019"><a href="#ref-Xie2019" role="doc-biblioref">[1]</a></span>. In a recent review, Chaves et al. argue that red-edge bands are important for distinguishing leaf structure and chlorophyll content of different vegetation species <span class="citation" data-cites="Chaves2020"><a href="#ref-Chaves2020" role="doc-biblioref">[3]</a></span>. In the example below, we show how to include indexes in the regular data cube with the Sentinel-2 spectral bands.</p>
<p>We first calculate the NDVI in the usual way, using bands B08 and B04.</p>
<div class="panel-tabset">
<ul class="nav nav-tabs" role="tablist"><li class="nav-item" role="presentation"><a class="nav-link active" id="tabset-3-1-tab" data-bs-toggle="tab" data-bs-target="#tabset-3-1" role="tab" aria-controls="tabset-3-1" aria-selected="true">R</a></li><li class="nav-item" role="presentation"><a class="nav-link" id="tabset-3-2-tab" data-bs-toggle="tab" data-bs-target="#tabset-3-2" role="tab" aria-controls="tabset-3-2" aria-selected="false">Python</a></li></ul>
<div class="tab-content">
<div id="tabset-3-1" class="tab-pane active" role="tabpanel" aria-labelledby="tabset-3-1-tab">
<div class="cell" data-layout-align="center" data-hash="dc_cubeoperations_cache/html/fig-ops-ndvi_bc4623d754016f0817293f6cd186d184">
<div class="sourceCode" id="cb5"><pre class="sourceCode r cell-code"><code class="sourceCode r"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a><span class="co"># Calculate NDVI index using bands B08 and B04</span></span>
<span id="cb5-2"><a href="#cb5-2" aria-hidden="true" tabindex="-1"></a>reg_cube <span class="ot"><-</span> <span class="fu">sits_apply</span>(reg_cube,</span>
<span id="cb5-3"><a href="#cb5-3" aria-hidden="true" tabindex="-1"></a> <span class="at">NDVI =</span> (B08 <span class="sc">-</span> B04)<span class="sc">/</span>(B08 <span class="sc">+</span> B04),</span>
<span id="cb5-4"><a href="#cb5-4" aria-hidden="true" tabindex="-1"></a> <span class="at">output_dir =</span> tempdir_r</span>
<span id="cb5-5"><a href="#cb5-5" aria-hidden="true" tabindex="-1"></a>)</span>
<span id="cb5-6"><a href="#cb5-6" aria-hidden="true" tabindex="-1"></a><span class="co"># Plot</span></span>
<span id="cb5-7"><a href="#cb5-7" aria-hidden="true" tabindex="-1"></a><span class="fu">plot</span>(reg_cube, <span class="at">band =</span> <span class="st">"NDVI"</span>, <span class="at">palette =</span> <span class="st">"RdYlGn"</span>)</span></code></pre></div>
<div class="cell-output-display">
<div id="fig-ops-ndvi" class="quarto-figure quarto-figure-center">
<figure>
<p><img src="dc_cubeoperations_files/figure-html/fig-ops-ndvi-1.png" class="img-fluid" style="width:80.0%" /></p>
<figcaption>Figure 8.1: NDVI using bands B08 and B04 of Sentinel-2.</figcaption>
</figure>
</div>
</div>
</div>
</div>
<div id="tabset-3-2" class="tab-pane" role="tabpanel" aria-labelledby="tabset-3-2-tab">
<div class="cell">
<div class="sourceCode" id="cb6"><pre class="sourceCode python cell-code"><code class="sourceCode python"><span id="cb6-1"><a href="#cb6-1" aria-hidden="true" tabindex="-1"></a><span class="co"># Calculate NDVI index using bands B08 and B04</span></span>
<span id="cb6-2"><a href="#cb6-2" aria-hidden="true" tabindex="-1"></a>reg_cube <span class="op">=</span> sits_apply(reg_cube,</span>
<span id="cb6-3"><a href="#cb6-3" aria-hidden="true" tabindex="-1"></a> NDVI <span class="op">=</span> <span class="st">"(B08 - B04)/(B08 + B04)"</span>,</span>
<span id="cb6-4"><a href="#cb6-4" aria-hidden="true" tabindex="-1"></a> output_dir <span class="op">=</span> tempdir_py</span>
<span id="cb6-5"><a href="#cb6-5" aria-hidden="true" tabindex="-1"></a>)</span>
<span id="cb6-6"><a href="#cb6-6" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb6-7"><a href="#cb6-7" aria-hidden="true" tabindex="-1"></a><span class="co"># Plot</span></span>
<span id="cb6-8"><a href="#cb6-8" aria-hidden="true" tabindex="-1"></a>plot(reg_cube, band <span class="op">=</span> <span class="st">"NDVI"</span>, palette <span class="op">=</span> <span class="st">"RdYlGn"</span>)</span></code></pre></div>
</div>
<div class="cell" data-layout-align="center" data-hash="dc_cubeoperations_cache/html/py-fig-ops-ndvi_af8fe8c20029648468d073698537548a">
<div class="sourceCode" id="cb7"><pre class="sourceCode r cell-code"><code class="sourceCode r"><span id="cb7-1"><a href="#cb7-1" aria-hidden="true" tabindex="-1"></a><span class="co"># Plot</span></span>
<span id="cb7-2"><a href="#cb7-2" aria-hidden="true" tabindex="-1"></a><span class="fu">plot</span>(reg_cube, <span class="at">band =</span> <span class="st">"NDVI"</span>, <span class="at">palette =</span> <span class="st">"RdYlGn"</span>)</span></code></pre></div>
<div class="cell-output-display">
<div class="quarto-figure quarto-figure-center">
<figure>
<p><img src="dc_cubeoperations_files/figure-html/py-fig-ops-ndvi-1.png" class="img-fluid" style="width:80.0%" /></p>
<figcaption>NDVI using bands B08 and B04 of Sentinel-2.</figcaption>
</figure>
</div>
</div>
</div>
</div>
</div>
</div>
<p>We now compare the traditional NDVI with another vegetation index computed using red-edge bands. The example below shows the NDRE1 index, obtained using bands B06 and B05. Sun et al. argue that a vegetation index built using bands B06 and B07 provides a better approximation to leaf area index estimates than NDVI <span class="citation" data-cites="Sun2020a"><a href="#ref-Sun2020a" role="doc-biblioref">[2]</a></span>. Notice that the contrast between forests and deforested areas is more robust in the NDRE1 index than with NDVI.</p>
<div class="panel-tabset">
<ul class="nav nav-tabs" role="tablist"><li class="nav-item" role="presentation"><a class="nav-link active" id="tabset-4-1-tab" data-bs-toggle="tab" data-bs-target="#tabset-4-1" role="tab" aria-controls="tabset-4-1" aria-selected="true">R</a></li><li class="nav-item" role="presentation"><a class="nav-link" id="tabset-4-2-tab" data-bs-toggle="tab" data-bs-target="#tabset-4-2" role="tab" aria-controls="tabset-4-2" aria-selected="false">Python</a></li></ul>
<div class="tab-content">
<div id="tabset-4-1" class="tab-pane active" role="tabpanel" aria-labelledby="tabset-4-1-tab">
<div class="cell" data-hash="dc_cubeoperations_cache/html/fig-ops-ndre1_9d3b2830ea7560fb2ab34f1d4cded3a7">
<div class="sourceCode" id="cb8"><pre class="sourceCode r cell-code"><code class="sourceCode r"><span id="cb8-1"><a href="#cb8-1" aria-hidden="true" tabindex="-1"></a><span class="co"># Calculate NDRE1 index using bands B06 and B05</span></span>
<span id="cb8-2"><a href="#cb8-2" aria-hidden="true" tabindex="-1"></a>reg_cube <span class="ot"><-</span> <span class="fu">sits_apply</span>(reg_cube,</span>
<span id="cb8-3"><a href="#cb8-3" aria-hidden="true" tabindex="-1"></a> <span class="at">NDRE1 =</span> (B06 <span class="sc">-</span> B05)<span class="sc">/</span>(B06 <span class="sc">+</span> B05),</span>
<span id="cb8-4"><a href="#cb8-4" aria-hidden="true" tabindex="-1"></a> <span class="at">output_dir =</span> tempdir_r</span>
<span id="cb8-5"><a href="#cb8-5" aria-hidden="true" tabindex="-1"></a>)</span>
<span id="cb8-6"><a href="#cb8-6" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb8-7"><a href="#cb8-7" aria-hidden="true" tabindex="-1"></a><span class="co"># Plot NDRE1 index</span></span>
<span id="cb8-8"><a href="#cb8-8" aria-hidden="true" tabindex="-1"></a><span class="fu">plot</span>(reg_cube, <span class="at">band =</span> <span class="st">"NDRE1"</span>, <span class="at">palette =</span> <span class="st">"RdYlGn"</span>)</span></code></pre></div>
<div class="cell-output-display">
<div id="fig-ops-ndre1" class="quarto-figure quarto-figure-center">
<figure>
<p><img src="dc_cubeoperations_files/figure-html/fig-ops-ndre1-1.png" class="img-fluid" style="width:80.0%" /></p>
<figcaption>Figure 8.2: NDRE1 using bands B06 and B05 of Sentinel-2.</figcaption>
</figure>
</div>
</div>
</div>
</div>
<div id="tabset-4-2" class="tab-pane" role="tabpanel" aria-labelledby="tabset-4-2-tab">
<div class="cell">
<div class="sourceCode" id="cb9"><pre class="sourceCode python cell-code"><code class="sourceCode python"><span id="cb9-1"><a href="#cb9-1" aria-hidden="true" tabindex="-1"></a><span class="co"># Calculate NDRE1 index using bands B06 and B05</span></span>
<span id="cb9-2"><a href="#cb9-2" aria-hidden="true" tabindex="-1"></a>reg_cube <span class="op">=</span> sits_apply(reg_cube,</span>
<span id="cb9-3"><a href="#cb9-3" aria-hidden="true" tabindex="-1"></a> NDRE1 <span class="op">=</span> <span class="st">"(B06 - B05)/(B06 + B05)"</span>,</span>
<span id="cb9-4"><a href="#cb9-4" aria-hidden="true" tabindex="-1"></a> output_dir <span class="op">=</span> tempdir_py</span>
<span id="cb9-5"><a href="#cb9-5" aria-hidden="true" tabindex="-1"></a>)</span>
<span id="cb9-6"><a href="#cb9-6" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb9-7"><a href="#cb9-7" aria-hidden="true" tabindex="-1"></a><span class="co"># Plot NDRE1 index</span></span>
<span id="cb9-8"><a href="#cb9-8" aria-hidden="true" tabindex="-1"></a>plot(reg_cube, band <span class="op">=</span> <span class="st">"NDRE1"</span>, palette <span class="op">=</span> <span class="st">"RdYlGn"</span>)</span></code></pre></div>
</div>
<div class="cell" data-hash="dc_cubeoperations_cache/html/py-fig-ops-ndre1_aa21d7a0fa584d1325c39ddf20e41405">
<div class="sourceCode" id="cb10"><pre class="sourceCode r cell-code"><code class="sourceCode r"><span id="cb10-1"><a href="#cb10-1" aria-hidden="true" tabindex="-1"></a><span class="co"># Plot NDRE1 index</span></span>
<span id="cb10-2"><a href="#cb10-2" aria-hidden="true" tabindex="-1"></a><span class="fu">plot</span>(reg_cube, <span class="at">band =</span> <span class="st">"NDRE1"</span>, <span class="at">palette =</span> <span class="st">"RdYlGn"</span>)</span></code></pre></div>
<div class="cell-output-display">
<div class="quarto-figure quarto-figure-center">
<figure>
<p><img src="dc_cubeoperations_files/figure-html/py-fig-ops-ndre1-1.png" class="img-fluid" style="width:80.0%" /></p>
<figcaption>NDRE1 using bands B06 and B05 of Sentinel-2.</figcaption>
</figure>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
<section id="spectral-indexes-for-identifying-burned-areas" class="level2" data-number="8.3">
<h2 data-number="8.3"><span class="header-section-number">8.3</span> Spectral indexes for identifying burned areas</h2>
<p>Band combinations can also generate spectral indexes for detecting degradation by fires, which are an important element in environmental degradation. Forest fires significantly impact emissions and impoverish natural ecosystems <span class="citation" data-cites="Nepstad1999"><a href="#ref-Nepstad1999" role="doc-biblioref">[4]</a></span>. Fires open the canopy, making the microclimate drier and increasing the amount of dry fuel <span class="citation" data-cites="Gao2020"><a href="#ref-Gao2020" role="doc-biblioref">[5]</a></span>. One well-established technique for detecting burned areas with remote sensing images is the normalized burn ratio (NBR), the difference between the near-infrared and the short wave infrared band, calculated using bands B8A and B12.</p>
<div class="panel-tabset">
<ul class="nav nav-tabs" role="tablist"><li class="nav-item" role="presentation"><a class="nav-link active" id="tabset-5-1-tab" data-bs-toggle="tab" data-bs-target="#tabset-5-1" role="tab" aria-controls="tabset-5-1" aria-selected="true">R</a></li><li class="nav-item" role="presentation"><a class="nav-link" id="tabset-5-2-tab" data-bs-toggle="tab" data-bs-target="#tabset-5-2" role="tab" aria-controls="tabset-5-2" aria-selected="false">Python</a></li></ul>
<div class="tab-content">
<div id="tabset-5-1" class="tab-pane active" role="tabpanel" aria-labelledby="tabset-5-1-tab">
<div class="cell" data-layout-align="center" data-hash="dc_cubeoperations_cache/html/fig-ops-nbr_40a2318f49bc3205111041eea030b883">
<div class="sourceCode" id="cb11"><pre class="sourceCode r cell-code"><code class="sourceCode r"><span id="cb11-1"><a href="#cb11-1" aria-hidden="true" tabindex="-1"></a><span class="co"># Calculate the NBR index</span></span>
<span id="cb11-2"><a href="#cb11-2" aria-hidden="true" tabindex="-1"></a>reg_cube <span class="ot"><-</span> <span class="fu">sits_apply</span>(reg_cube,</span>
<span id="cb11-3"><a href="#cb11-3" aria-hidden="true" tabindex="-1"></a> <span class="at">NBR =</span> (B12 <span class="sc">-</span> B8A)<span class="sc">/</span>(B12 <span class="sc">+</span> B8A),</span>
<span id="cb11-4"><a href="#cb11-4" aria-hidden="true" tabindex="-1"></a> <span class="at">output_dir =</span> tempdir_r</span>
<span id="cb11-5"><a href="#cb11-5" aria-hidden="true" tabindex="-1"></a>)</span>
<span id="cb11-6"><a href="#cb11-6" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb11-7"><a href="#cb11-7" aria-hidden="true" tabindex="-1"></a><span class="co"># Plot the NBR for the first date</span></span>
<span id="cb11-8"><a href="#cb11-8" aria-hidden="true" tabindex="-1"></a><span class="fu">plot</span>(reg_cube, <span class="at">band =</span> <span class="st">"NBR"</span>, <span class="at">palette =</span> <span class="st">"Reds"</span>)</span></code></pre></div>
<div class="cell-output-display">
<div id="fig-ops-nbr" class="quarto-figure quarto-figure-center">
<figure>
<p><img src="dc_cubeoperations_files/figure-html/fig-ops-nbr-1.png" class="img-fluid" style="width:80.0%" /></p>
<figcaption>Figure 8.3: NBR ratio using Sentinel-2 B12 and B8A.</figcaption>
</figure>
</div>
</div>
</div>
</div>
<div id="tabset-5-2" class="tab-pane" role="tabpanel" aria-labelledby="tabset-5-2-tab">
<div class="cell">
<div class="sourceCode" id="cb12"><pre class="sourceCode python cell-code"><code class="sourceCode python"><span id="cb12-1"><a href="#cb12-1" aria-hidden="true" tabindex="-1"></a><span class="co"># Calculate the NBR index</span></span>
<span id="cb12-2"><a href="#cb12-2" aria-hidden="true" tabindex="-1"></a>reg_cube <span class="op">=</span> sits_apply(reg_cube,</span>
<span id="cb12-3"><a href="#cb12-3" aria-hidden="true" tabindex="-1"></a> NBR <span class="op">=</span> <span class="st">"(B12 - B8A)/(B12 + B8A)"</span>,</span>
<span id="cb12-4"><a href="#cb12-4" aria-hidden="true" tabindex="-1"></a> output_dir <span class="op">=</span> tempdir_py</span>
<span id="cb12-5"><a href="#cb12-5" aria-hidden="true" tabindex="-1"></a>)</span>
<span id="cb12-6"><a href="#cb12-6" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb12-7"><a href="#cb12-7" aria-hidden="true" tabindex="-1"></a><span class="co"># Plot the NBR for the first date</span></span>
<span id="cb12-8"><a href="#cb12-8" aria-hidden="true" tabindex="-1"></a>plot(reg_cube, band <span class="op">=</span> <span class="st">"NBR"</span>, palette <span class="op">=</span> <span class="st">"Reds"</span>)</span></code></pre></div>
</div>
<div class="cell" data-layout-align="center" data-hash="dc_cubeoperations_cache/html/py-fig-ops-nbr_0e5fbb99d7708183afb4224b5955b3d3">
<div class="cell-output-display">
<div class="quarto-figure quarto-figure-center">
<figure>
<p><img src="dc_cubeoperations_files/figure-html/py-fig-ops-nbr-1.png" class="img-fluid" style="width:80.0%" /></p>
<figcaption>NBR ratio using Sentinel-2 B12 and B8A.</figcaption>
</figure>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
<section id="support-for-non-normalized-indexes" class="level2" data-number="8.4">
<h2 data-number="8.4"><span class="header-section-number">8.4</span> Support for non-normalized indexes</h2>
<p>All data cube operations discussed so far produce normalized indexes. By default, the indexes generated by the <code>sits_apply()</code> function are normalized between -1 and 1, scaled by a factor of 0.0001. Normalized indexes are saved as INT2S (Integer with sign). If the normalized parameter is FALSE, no scaling factor will be applied and the index will be saved as FLT4S (Float with sign). The code below shows an example of the non-normalized index, CVI - chlorophyll vegetation index. CVI is a spectral index used to estimate the chlorophyll content and overall health of vegetation. It combines bands in visible and near-infrared (NIR) regions to assess vegetation characteristics. Since CVI is not normalized, we have to set the parameter <code>normalized</code> to <code>FALSE</code> to inform <code>sits_apply()</code> to generate an FLT4S image.</p>
<div class="panel-tabset">
<ul class="nav nav-tabs" role="tablist"><li class="nav-item" role="presentation"><a class="nav-link active" id="tabset-6-1-tab" data-bs-toggle="tab" data-bs-target="#tabset-6-1" role="tab" aria-controls="tabset-6-1" aria-selected="true">R</a></li><li class="nav-item" role="presentation"><a class="nav-link" id="tabset-6-2-tab" data-bs-toggle="tab" data-bs-target="#tabset-6-2" role="tab" aria-controls="tabset-6-2" aria-selected="false">Python</a></li></ul>
<div class="tab-content">
<div id="tabset-6-1" class="tab-pane active" role="tabpanel" aria-labelledby="tabset-6-1-tab">
<div class="cell" data-layout-align="center" data-hash="dc_cubeoperations_cache/html/fig-ops-cvi_0a9419270a7713c7de3a7cb1c563a384">
<div class="sourceCode" id="cb13"><pre class="sourceCode r cell-code"><code class="sourceCode r"><span id="cb13-1"><a href="#cb13-1" aria-hidden="true" tabindex="-1"></a><span class="co"># Calculate the CVI index</span></span>
<span id="cb13-2"><a href="#cb13-2" aria-hidden="true" tabindex="-1"></a>reg_cube <span class="ot"><-</span> <span class="fu">sits_apply</span>(reg_cube,</span>
<span id="cb13-3"><a href="#cb13-3" aria-hidden="true" tabindex="-1"></a> <span class="at">CVI =</span> (B8A <span class="sc">/</span> B03) <span class="sc">*</span> (B05 <span class="sc">/</span> B03 ),</span>
<span id="cb13-4"><a href="#cb13-4" aria-hidden="true" tabindex="-1"></a> <span class="at">normalized =</span> <span class="cn">FALSE</span>, </span>
<span id="cb13-5"><a href="#cb13-5" aria-hidden="true" tabindex="-1"></a> <span class="at">output_dir =</span> tempdir_r</span>
<span id="cb13-6"><a href="#cb13-6" aria-hidden="true" tabindex="-1"></a>)</span>
<span id="cb13-7"><a href="#cb13-7" aria-hidden="true" tabindex="-1"></a><span class="co"># Plot</span></span>
<span id="cb13-8"><a href="#cb13-8" aria-hidden="true" tabindex="-1"></a><span class="fu">plot</span>(reg_cube, <span class="at">band =</span> <span class="st">"CVI"</span>, <span class="at">palette =</span> <span class="st">"Greens"</span>)</span></code></pre></div>
<div class="cell-output-display">
<div id="fig-ops-cvi" class="quarto-figure quarto-figure-center">
<figure>
<p><img src="dc_cubeoperations_files/figure-html/fig-ops-cvi-1.png" class="img-fluid" style="width:80.0%" /></p>
<figcaption>Figure 8.4: CVI index using bands B03, B05, and B8A.</figcaption>
</figure>
</div>
</div>
</div>
</div>
<div id="tabset-6-2" class="tab-pane" role="tabpanel" aria-labelledby="tabset-6-2-tab">
<div class="cell">
<div class="sourceCode" id="cb14"><pre class="sourceCode python cell-code"><code class="sourceCode python"><span id="cb14-1"><a href="#cb14-1" aria-hidden="true" tabindex="-1"></a><span class="co"># Calculate the NBR index</span></span>
<span id="cb14-2"><a href="#cb14-2" aria-hidden="true" tabindex="-1"></a>reg_cube <span class="op">=</span> sits_apply(reg_cube,</span>
<span id="cb14-3"><a href="#cb14-3" aria-hidden="true" tabindex="-1"></a> CVI <span class="op">=</span> <span class="st">"(B8A / B03) * (B05 / B03 )"</span>,</span>
<span id="cb14-4"><a href="#cb14-4" aria-hidden="true" tabindex="-1"></a> normalized <span class="op">=</span> <span class="va">False</span>, </span>
<span id="cb14-5"><a href="#cb14-5" aria-hidden="true" tabindex="-1"></a> output_dir <span class="op">=</span> tempdir_py</span>
<span id="cb14-6"><a href="#cb14-6" aria-hidden="true" tabindex="-1"></a>)</span>
<span id="cb14-7"><a href="#cb14-7" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb14-8"><a href="#cb14-8" aria-hidden="true" tabindex="-1"></a><span class="co"># Plot</span></span>
<span id="cb14-9"><a href="#cb14-9" aria-hidden="true" tabindex="-1"></a>plot(reg_cube, band <span class="op">=</span> <span class="st">"CVI"</span>, palette <span class="op">=</span> <span class="st">"Greens"</span>)</span></code></pre></div>
</div>
<div class="cell" data-layout-align="center" data-hash="dc_cubeoperations_cache/html/py-fig-ops-cvi_4ed80f10d54b9cf6564ba94bd8973287">
<div class="cell-output-display">
<div class="quarto-figure quarto-figure-center">
<figure>
<p><img src="dc_cubeoperations_files/figure-html/py-fig-ops-cvi-1.png" class="img-fluid" style="width:80.0%" /></p>
<figcaption>CVI index using bands B03, B05, and B8A.</figcaption>
</figure>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
<section id="summary" class="level2" data-number="8.5">
<h2 data-number="8.5"><span class="header-section-number">8.5</span> Summary</h2>
<p>In this chapter, we learned how to operate on data cubes, including how to compute spectral indexes. The next chapter will discuss mixture model operations in <code>sits</code>.</p>
</section>
<section id="references" class="level2 unnumbered">
<h2 class="unnumbered">References</h2>
<div id="quarto-navigation-envelope" class="hidden">
<p><span class="hidden" data-render-id="quarto-int-sidebar-title">Satellite Image Time Series Analysis on Earth Observation Data Cubes</span> <span class="hidden" data-render-id="quarto-int-navbar-title">Satellite Image Time Series Analysis on Earth Observation Data Cubes</span> <span class="hidden" data-render-id="quarto-int-next"><span class="chapter-number">9</span> <span class="chapter-title">Spectral mixture analysis</span></span> <span class="hidden" data-render-id="quarto-int-prev"><span class="chapter-number">7</span> <span class="chapter-title">Data cubes from local files</span></span> <span class="hidden" data-render-id="quarto-int-sidebar:/index.html">Greetings</span> <span class="hidden" data-render-id="quarto-int-sidebar:/setup.html">Setup</span> <span class="hidden" data-render-id="quarto-int-sidebar:/support.html">Support</span> <span class="hidden" data-render-id="quarto-int-sidebar:/acknowledgements.html">Acknowledgements</span> <span class="hidden" data-render-id="quarto-int-sidebar:quarto-sidebar-section-1">The Basics of SITS</span> <span class="hidden" data-render-id="quarto-int-sidebar:/intro_quicktour.html"><span class="chapter-number">1</span> <span class="chapter-title">A quick tour of SITS</span></span> <span class="hidden" data-render-id="quarto-int-sidebar:/intro_examples.html"><span class="chapter-number">2</span> <span class="chapter-title">How to use SITS with real examples</span></span> <span class="hidden" data-render-id="quarto-int-sidebar:/intro_visualisation.html"><span class="chapter-number">3</span> <span class="chapter-title">Data visualisation in SITS</span></span> <span class="hidden" data-render-id="quarto-int-sidebar:quarto-sidebar-section-2">Earth observation data cubes</span> <span class="hidden" data-render-id="quarto-int-sidebar:/dc_ardcollections.html"><span class="chapter-number">4</span> <span class="chapter-title">Analysis-ready image collections</span></span> <span class="hidden" data-render-id="quarto-int-sidebar:/dc_regularize.html"><span class="chapter-number">5</span> <span class="chapter-title">Building regular data cubes</span></span> <span class="hidden" data-render-id="quarto-int-sidebar:/dc_merge.html"><span class="chapter-number">6</span> <span class="chapter-title">Merging multi-source EO data cubes</span></span> <span class="hidden" data-render-id="quarto-int-sidebar:/dc_localcubes.html"><span class="chapter-number">7</span> <span class="chapter-title">Data cubes from local files</span></span> <span class="hidden" data-render-id="quarto-int-sidebar:/dc_cubeoperations.html"><span class="chapter-number">8</span> <span class="chapter-title">Algebraic operations on data cubes</span></span> <span class="hidden" data-render-id="quarto-int-sidebar:/dc_mixture.html"><span class="chapter-number">9</span> <span class="chapter-title">Spectral mixture analysis</span></span> <span class="hidden" data-render-id="quarto-int-sidebar:/dc_reduce.html"><span class="chapter-number">10</span> <span class="chapter-title">Temporal reduction operations</span></span> <span class="hidden" data-render-id="quarto-int-sidebar:/dc_texture.html"><span class="chapter-number">11</span> <span class="chapter-title">Texture operations in data cubes</span></span> <span class="hidden" data-render-id="quarto-int-sidebar:quarto-sidebar-section-3">Satellite image time series</span> <span class="hidden" data-render-id="quarto-int-sidebar:/ts_basics.html"><span class="chapter-number">12</span> <span class="chapter-title">Basic operations on image time series</span></span> <span class="hidden" data-render-id="quarto-int-sidebar:/ts_cluster.html"><span class="chapter-number">13</span> <span class="chapter-title">Hierarchical clustering of time series</span></span> <span class="hidden" data-render-id="quarto-int-sidebar:/ts_som.html"><span class="chapter-number">14</span> <span class="chapter-title">Self-organized maps for sample quality control</span></span> <span class="hidden" data-render-id="quarto-int-sidebar:/ts_balance.html"><span class="chapter-number">15</span> <span class="chapter-title">Reducing imbalances in training samples</span></span> <span class="hidden" data-render-id="quarto-int-sidebar:quarto-sidebar-section-4">Machine learning for image time series</span> <span class="hidden" data-render-id="quarto-int-sidebar:/cl_machinelearning.html"><span class="chapter-number">16</span> <span class="chapter-title">Machine learning algorithms for image time series</span></span> <span class="hidden" data-render-id="quarto-int-sidebar:/cl_tuning.html"><span class="chapter-number">17</span> <span class="chapter-title">Deep learning model tuning</span></span> <span class="hidden" data-render-id="quarto-int-sidebar:/cl_rasterclassification.html"><span class="chapter-number">18</span> <span class="chapter-title">Classification of raster data cubes</span></span> <span class="hidden" data-render-id="quarto-int-sidebar:/cl_smoothing.html"><span class="chapter-number">19</span> <span class="chapter-title">Bayesian smoothing for classification post-processing</span></span> <span class="hidden" data-render-id="quarto-int-sidebar:/cl_reclassification.html"><span class="chapter-number">20</span> <span class="chapter-title">Map reclassification</span></span> <span class="hidden" data-render-id="quarto-int-sidebar:/cl_uncertainty.html"><span class="chapter-number">21</span> <span class="chapter-title">Uncertainty and active learning</span></span> <span class="hidden" data-render-id="quarto-int-sidebar:/cl_ensembleprediction.html"><span class="chapter-number">22</span> <span class="chapter-title">Ensemble prediction with multiple models</span></span> <span class="hidden" data-render-id="quarto-int-sidebar:quarto-sidebar-section-5">Validation and accuracy measurement</span> <span class="hidden" data-render-id="quarto-int-sidebar:/val_kfold.html"><span class="chapter-number">23</span> <span class="chapter-title">Cross-validation of training data</span></span> <span class="hidden" data-render-id="quarto-int-sidebar:/val_map.html"><span class="chapter-number">24</span> <span class="chapter-title">Map accuracy assessment</span></span> <span class="hidden" data-render-id="quarto-int-sidebar:quarto-sidebar-section-6">Vector data cubes</span> <span class="hidden" data-render-id="quarto-int-sidebar:/vec_obia.html"><span class="chapter-number">25</span> <span class="chapter-title">Object-based time series image analysis</span></span> <span class="hidden" data-render-id="quarto-int-sidebar:/vec_creating.html"><span class="chapter-number">26</span> <span class="chapter-title">Creating vector data cube from local files</span></span> <span class="hidden" data-render-id="quarto-int-sidebar:quarto-sidebar-section-7">Foundational Models and Embeddings</span> <span class="hidden" data-render-id="quarto-int-sidebar:/emb_build.html"><span class="chapter-number">27</span> <span class="chapter-title">Building regional embeddings</span></span> <span class="hidden" data-render-id="quarto-int-sidebar:quarto-sidebar-section-8">Advanced Topics</span> <span class="hidden" data-render-id="quarto-int-sidebar:/annex_export.html"><span class="chapter-number">28</span> <span class="chapter-title">Exporting data to other packages</span></span> <span class="hidden" data-render-id="quarto-int-sidebar:/annex_gee.html"><span class="chapter-number">29</span> <span class="chapter-title">SITS and GEE: side-by-side comparison</span></span> <span class="hidden" data-render-id="quarto-int-sidebar:/annex_api.html"><span class="chapter-number">30</span> <span class="chapter-title">Developing new functions in SITS</span></span> <span class="hidden" data-render-id="quarto-int-sidebar:/annex_ml.html"><span class="chapter-number">31</span> <span class="chapter-title">Including new methods for machine learning</span></span> <span class="hidden" data-render-id="quarto-int-sidebar:/annex_stac.html"><span class="chapter-number">32</span> <span class="chapter-title">Supporting STAC-based ARD catalogs</span></span> <span class="hidden" data-render-id="quarto-int-sidebar:/annex_parallel.html"><span class="chapter-number">33</span> <span class="chapter-title">How parallel processing works in SITS</span></span> <span class="hidden" data-render-id="footer-left">The SITS book was written by Gilberto Camara, Rolf Simoes, Felipe Souza, Felipe Carlos, Pedro Andrade, Karine Ferreira, Pedro Brito, Alexandre Assunção, Charlotte Pelletier, and Bianca Zadrosny.</span> <span class="hidden" data-render-id="footer-right">This book was built with <a href="https://quarto.org/">Quarto</a>.</span> <span class="hidden" data-render-id="quarto-breadcrumbs-7753113dfcc2696160cb3fcf8b77a977">Earth observation data cubes</span> <span class="hidden" data-render-id="quarto-breadcrumbs-e0ee8e4d630bc2129a6faf8e65b4d187"><span class="chapter-number">8</span> <span class="chapter-title">Algebraic operations on data cubes</span></span></p>
</div>
<div id="quarto-meta-markdown" class="hidden">
<p><span class="hidden" data-render-id="quarto-metatitle">Satellite Image Time Series Analysis on Earth Observation Data Cubes - <span class="chapter-number">8</span> <span class="chapter-title">Algebraic operations on data cubes</span></span> <span class="hidden" data-render-id="quarto-twittercardtitle">Satellite Image Time Series Analysis on Earth Observation Data Cubes - <span class="chapter-number">8</span> <span class="chapter-title">Algebraic operations on data cubes</span></span> <span class="hidden" data-render-id="quarto-ogcardtitle">Satellite Image Time Series Analysis on Earth Observation Data Cubes - <span class="chapter-number">8</span> <span class="chapter-title">Algebraic operations on data cubes</span></span> <span class="hidden" data-render-id="quarto-metasitename">Satellite Image Time Series Analysis on Earth Observation Data Cubes</span> <span class="hidden" data-render-id="quarto-twittercarddesc"></span> <span class="hidden" data-render-id="quarto-ogcardddesc"></span></p>
</div>
<div id="refs" class="references csl-bib-body" role="list">
<div id="ref-Xie2019" class="csl-entry" role="listitem">
<div class="csl-left-margin">[1] </div><div class="csl-right-inline">Q. Xie <em>et al.</em>, <span>“Retrieval of crop biophysical parameters from <span>Sentinel-2</span> remote sensing imagery,”</span> <em>International Journal of Applied Earth Observation and Geoinformation</em>, vol. 80, pp. 187–195, 2019, doi: <a href="https://doi.org/10.1016/j.jag.2019.04.019">10.1016/j.jag.2019.04.019</a>.</div>
</div>
<div id="ref-Sun2020a" class="csl-entry" role="listitem">
<div class="csl-left-margin">[2] </div><div class="csl-right-inline">Y. Sun, Q. Qin, H. Ren, T. Zhang, and S. Chen, <span>“Red-<span>Edge Band Vegetation Indices</span> for <span>Leaf Area Index Estimation From Sentinel-2</span>/<span>MSI Imagery</span>,”</span> <em>IEEE Transactions on Geoscience and Remote Sensing</em>, vol. 58, no. 2, pp. 826–840, 2020, doi: <a href="https://doi.org/10.1109/TGRS.2019.2940826">10.1109/TGRS.2019.2940826</a>.</div>
</div>
<div id="ref-Chaves2020" class="csl-entry" role="listitem">
<div class="csl-left-margin">[3] </div><div class="csl-right-inline">M. Chaves, M. Picoli, and I. Sanches, <span>“Recent <span>Applications</span> of <span>Landsat</span> 8/<span>OLI</span> and <span>Sentinel-2</span>/<span>MSI</span> for <span>Land Use</span> and <span>Land Cover Mapping</span>: <span>A Systematic Review</span>,”</span> <em>Remote Sensing</em>, vol. 12, no. 18, p. 3062, 2020, doi: <a href="https://doi.org/10.3390/rs12183062">10.3390/rs12183062</a>.</div>
</div>
<div id="ref-Nepstad1999" class="csl-entry" role="listitem">
<div class="csl-left-margin">[4] </div><div class="csl-right-inline">D. C. Nepstad <em>et al.</em>, <span>“Large-scale impoverishment of <span>Amazonian</span> forests by logging and fire,”</span> <em>Nature</em>, vol. 398, no. 6727, pp. 505–508, 1999, doi: <a href="https://doi.org/10.1038/19066">10.1038/19066</a>.</div>
</div>
<div id="ref-Gao2020" class="csl-entry" role="listitem">
<div class="csl-left-margin">[5] </div><div class="csl-right-inline">Y. Gao, M. Skutsch, J. Paneque-Gálvez, and A. Ghilardi, <span>“Remote sensing of forest degradation: A review,”</span> <em>Environmental Research Letters</em>, vol. 15, no. 10, p. 103001, 2020, doi: <a href="https://doi.org/10.1088/1748-9326/abaad7">10.1088/1748-9326/abaad7</a>.</div>
</div>
</div>
</section>
</main> <!-- /main -->
<script id = "quarto-html-after-body" type="application/javascript">
window.document.addEventListener("DOMContentLoaded", function (event) {
const toggleBodyColorMode = (bsSheetEl) => {
const mode = bsSheetEl.getAttribute("data-mode");
const bodyEl = window.document.querySelector("body");
if (mode === "dark") {
bodyEl.classList.add("quarto-dark");
bodyEl.classList.remove("quarto-light");
} else {
bodyEl.classList.add("quarto-light");
bodyEl.classList.remove("quarto-dark");
}
}
const toggleBodyColorPrimary = () => {
const bsSheetEl = window.document.querySelector("link#quarto-bootstrap");
if (bsSheetEl) {
toggleBodyColorMode(bsSheetEl);
}
}
toggleBodyColorPrimary();
const icon = "";
const anchorJS = new window.AnchorJS();
anchorJS.options = {
placement: 'right',
icon: icon
};
anchorJS.add('.anchored');
const isCodeAnnotation = (el) => {
for (const clz of el.classList) {
if (clz.startsWith('code-annotation-')) {
return true;
}
}
return false;
}
const clipboard = new window.ClipboardJS('.code-copy-button', {
text: function(trigger) {
const codeEl = trigger.previousElementSibling.cloneNode(true);
for (const childEl of codeEl.children) {
if (isCodeAnnotation(childEl)) {
childEl.remove();
}
}
return codeEl.innerText;
}
});
clipboard.on('success', function(e) {
// button target
const button = e.trigger;
// don't keep focus
button.blur();
// flash "checked"
button.classList.add('code-copy-button-checked');
var currentTitle = button.getAttribute("title");
button.setAttribute("title", "Copied!");
let tooltip;
if (window.bootstrap) {
button.setAttribute("data-bs-toggle", "tooltip");
button.setAttribute("data-bs-placement", "left");
button.setAttribute("data-bs-title", "Copied!");
tooltip = new bootstrap.Tooltip(button,
{ trigger: "manual",
customClass: "code-copy-button-tooltip",
offset: [0, -8]});
tooltip.show();
}
setTimeout(function() {
if (tooltip) {
tooltip.hide();
button.removeAttribute("data-bs-title");
button.removeAttribute("data-bs-toggle");
button.removeAttribute("data-bs-placement");
}
button.setAttribute("title", currentTitle);
button.classList.remove('code-copy-button-checked');
}, 1000);
// clear code selection
e.clearSelection();
});
function tippyHover(el, contentFn) {
const config = {
allowHTML: true,
content: contentFn,
maxWidth: 500,
delay: 100,
arrow: false,
appendTo: function(el) {
return el.parentElement;
},
interactive: true,
interactiveBorder: 10,
theme: 'quarto',
placement: 'bottom-start'
};
window.tippy(el, config);
}
const noterefs = window.document.querySelectorAll('a[role="doc-noteref"]');
for (var i=0; i<noterefs.length; i++) {
const ref = noterefs[i];
tippyHover(ref, function() {
// use id or data attribute instead here
let href = ref.getAttribute('data-footnote-href') || ref.getAttribute('href');
try { href = new URL(href).hash; } catch {}
const id = href.replace(/^#\/?/, "");
const note = window.document.getElementById(id);
return note.innerHTML;
});
}
let selectedAnnoteEl;
const selectorForAnnotation = ( cell, annotation) => {
let cellAttr = 'data-code-cell="' + cell + '"';
let lineAttr = 'data-code-annotation="' + annotation + '"';
const selector = 'span[' + cellAttr + '][' + lineAttr + ']';
return selector;
}
const selectCodeLines = (annoteEl) => {
const doc = window.document;
const targetCell = annoteEl.getAttribute("data-target-cell");
const targetAnnotation = annoteEl.getAttribute("data-target-annotation");
const annoteSpan = window.document.querySelector(selectorForAnnotation(targetCell, targetAnnotation));
const lines = annoteSpan.getAttribute("data-code-lines").split(",");
const lineIds = lines.map((line) => {
return targetCell + "-" + line;
})
let top = null;
let height = null;
let parent = null;
if (lineIds.length > 0) {
//compute the position of the single el (top and bottom and make a div)
const el = window.document.getElementById(lineIds[0]);
top = el.offsetTop;
height = el.offsetHeight;
parent = el.parentElement.parentElement;
if (lineIds.length > 1) {
const lastEl = window.document.getElementById(lineIds[lineIds.length - 1]);
const bottom = lastEl.offsetTop + lastEl.offsetHeight;
height = bottom - top;
}
if (top !== null && height !== null && parent !== null) {
// cook up a div (if necessary) and position it
let div = window.document.getElementById("code-annotation-line-highlight");
if (div === null) {
div = window.document.createElement("div");
div.setAttribute("id", "code-annotation-line-highlight");
div.style.position = 'absolute';
parent.appendChild(div);
}
div.style.top = top - 2 + "px";
div.style.height = height + 4 + "px";
let gutterDiv = window.document.getElementById("code-annotation-line-highlight-gutter");
if (gutterDiv === null) {
gutterDiv = window.document.createElement("div");
gutterDiv.setAttribute("id", "code-annotation-line-highlight-gutter");
gutterDiv.style.position = 'absolute';
const codeCell = window.document.getElementById(targetCell);
const gutter = codeCell.querySelector('.code-annotation-gutter');
gutter.appendChild(gutterDiv);
}
gutterDiv.style.top = top - 2 + "px";
gutterDiv.style.height = height + 4 + "px";
}
selectedAnnoteEl = annoteEl;