Skip to content

Commit

Permalink
version 1.2.4-1 with corrections
Browse files Browse the repository at this point in the history
  • Loading branch information
gilbertocamara committed Nov 2, 2023
1 parent 59c06a4 commit 1692dec
Show file tree
Hide file tree
Showing 226 changed files with 3,362 additions and 4,532 deletions.
9 changes: 8 additions & 1 deletion 01-setup.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,14 @@ After configuring GDAL, GEOS, and PROJ4, please proceed to install `sits`, which
install.packages("sits", dependencies = TRUE)
```

The source code repository of `sits` is on [GitHub](https://github.com/e-sensing/sits). To install the development version, which contains the latest updates but might be unstable, users should install `devtools` (if not already available), and then install `sits` as follows:
The source code repository of `sits` is on [GitHub](https://github.com/e-sensing/sits). There are two versions available on GitHub: `master` and `dev`. The first contains the current stable version, which is either the same code available in CRAN or a minor update with bug fixes. To install the `master` version, To install the development version, which contains the latest updates but might be unstable, users should install `devtools` (if not already available) and do as follows:

```{r, eval = FALSE}
install.packages("devtools")
devtools::install_github("e-sensing/sits", dependencies = TRUE)
```

To install the development version, which contains the latest updates but might be unstable, users should install `devtools` (if not already available), and then install `sits` as follows:

```{r, eval = FALSE}
install.packages("devtools")
Expand Down
16 changes: 13 additions & 3 deletions 02-acknowledgements.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,16 @@ The authors acknowledge the funders that supported the development of `sits`:

## Community Contributions {-}

The authors thank the R-spatial community for their foundational work, including Marius Appel, Tim Appelhans, Robert Hijmans, Jakub Nowosad, Edzer Pebesma, and Martijn Tennekes for their R packages `gdalcubes`, `leafem`, `terra`, `supercells`, `sf`/`stars`, and `tmap`. We are grateful for the work of Dirk Eddelbuettel on `Rcpp` and `RcppArmadillo` and Ron Wehrens in package `kohonen`. We are much indebted to Hadley Wickham for the `tidyverse`, Daniel Falbel for the `torch` and `luz` packages, and the RStudio team for package `leaflet`. The multiple authors of machine learning packages `randomForest`, `e1071`, and `xgboost` provided robust algorithms. We would like to thank Python developers who shared their deep learning algorithms for image time series classification: Vivien Sainte Fare Garnot, Zhiguang Wang, Maja Schneider, and Marc Rußwurm. The first author also thanks Roger Bivand for his benign influence in all things related to **R**.
The authors thank the R-spatial community for their foundational work, including Marius Appel, Tim Appelhans, Robert Hijmans, Jakub Nowosad, Edzer Pebesma, and Martijn Tennekes for their R packages `gdalcubes`, `leafem`, `terra`, `supercells`, `sf`/`stars`, and `tmap`. We are grateful for the work of Dirk Eddelbuettel on `Rcpp` and `RcppArmadillo` and Ron Wehrens in package `kohonen`. We are much indebted to Hadley Wickham for the `tidyverse`, Daniel Falbel for the `torch` and `luz` packages, and the RStudio team for package `leaflet`. The multiple authors of machine learning packages `randomForest`, `e1071`, and `xgboost` provided robust algorithms. We would like to thank Python developers who shared their deep learning algorithms for image time series classification: Vivien Sainte Fare Garnot, Zhiguang Wang, Maja Schneider, and Marc Rußwurm. The first author also thanks Roger Bivand for his benign influence in all things related to **R**.

## Reproducible papers used in building `sits` {-}
## Reproducible papers and books used in building `sits` {-}

We thank the authors of the following papers for making their code openly and reusable. Their contribution has been essential to build `sits`.
We thank the authors of the following papers for making their code and papers open and reusable. Their contribution has been essential to build `sits`.

- Edzer Pebesma, [Simple Features for R: Standardized Support for Spatial Vector Data](https://journal.r-project.org/archive/2018/RJ-2018-009/RJ-2018-009.pdf). R Journal, 10(1), 2018.

- Martin Tennekes, [tmap: Thematic Maps in R](https://www.jstatsoft.org/article/view/v084i06). Journal of Statistical Software, 84(6), 1–39, 2018.

- Ron Wehrens and Johannes Kruisselbrink, [Flexible Self-Organising Maps in kohonen 3.0](https://doi.org/10.18637/jss.v087.i07). Journal of Statistical Software, 87, 7, 2018.

- Hassan Fawaz, Germain Forestier, Jonathan Weber, Lhassane Idoumghar, and Pierre-Alain Muller, [Deep learning for time series classification: a review](https://doi.org/10.1007/s10618-019-00619-1). Data Mining and Knowledge Discovery, 33(4): 917--963, 2019.
Expand All @@ -45,8 +47,16 @@ We thank the authors of the following papers for making their code openly and re

- Maja Schneider, Marco Körner, [[Re] Satellite Image Time Series Classification with Pixel-Set Encoders and Temporal Self-Attention.](https://doi.org/10.5281/zenodo.4835356) ReScience C 7 (2), 2021.

- Rolf Simoes, Felipe Souza, Mateus Zaglia, Gilberto Queiroz, Rafael dos Santos and Karine Ferreira, [Rstac: An R Package to Access Spatiotemporal Asset Catalog Satellite Imagery](http://www.brazildatacube.org/en/rstac-an-r-package-to-access-spatiotemporal-asset-catalog-satellite-imagery-2/). IGARSS, 2021, pp. 7674-7677.

- Jakub Nowosad, Tomasz Stepinksi, [Extended SLIC superpixels algorithm for applications to non-imagery geospatial rasters](https://doi.org/10.1016/j.jag.2022.102935). International Journal of Applied Earth Observations and Geoinformation, 2022.

- Sigrid Keydana, [Deep Learning and Scientific Computing with R torch](https://skeydan.github.io/Deep-Learning-and-Scientific-Computing-with-R-torch/), Chapman and Hall/CRC, London, 2023.

- Robin Lovelace, Jakub Nowosad, Jannes Münchow, [Geocomputation with R](https://r.geocompx.org/). Chapman and Hall/CRC, London, 2023.

- Edzer Pebesma, Roger Bivand, [Spatial Data Science: With applications in R](https://r-spatial.org/book/). Chapman and Hall/CRC, London, 2023.

## Publications using `sits` {-}

This section gathers the publications that have used `sits` to generate their results.
Expand Down
11 changes: 9 additions & 2 deletions 03-intro.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ sinop_probs <- sits_classify(
output_dir = "./tempdir/chp3"
)
# Plot the probability cube for class Forest
plot(sinop_probs, labels = "Forest", palette = "RdYlGn")
plot(sinop_probs, labels = "Forest", palette = "YlGnBu")
```

After completing the classification, we plot the probability maps for class Forest. Probability maps are helpful to visualize the degree of confidence the classifier assigns to the labels for each pixel. They can be used to produce uncertainty information and support active learning, as described in Chapter [Image classification in data cubes](https://e-sensing.github.io/sitsbook/image-classification-in-data-cubes.html).
Expand All @@ -230,7 +230,7 @@ sinop_bayes <- sits_smooth(
memsize = 8,
output_dir = "./tempdir/chp3"
)
plot(sinop_bayes, labels = "Forest", palette = "RdYlGn")
plot(sinop_bayes, labels = "Forest", palette = "YlGnBu")
```

## Labeling a probability data cube {.unnumbered}
Expand All @@ -256,6 +256,13 @@ The resulting classification files can be read by QGIS. Links to the associated
sinop_map$file_info[[1]]
```

To simplify the process of importing your data to QGIS, the color palette used to display classified maps in `sits` can be exported as a QGIS style using `sits_colors_qgis`. The function takes two parameters: (a) `cube`, a classified data cube; and (b) `file`, the file where the QGIS style in XML will be written to. In this case study, it suffices to do the following command.

```{r}
# Show the location of the classification file
sits_colors_qgis(sinop_map, file = "./tempdir/chp3/qgis_style.xml")
```


## Visualization of data cubes in interactive maps {.unnumbered}

Expand Down
13 changes: 7 additions & 6 deletions 04-datacubes.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ hls_cube_merged <- sits_merge(hls_cube_s2, hls_cube_l8)

Comparing the timelines of the original cubes and the merged one, one can see the benefits of the merged collection for time series data analysis.

```{r, tidy="styler", out.width="100%", fig.align="center", fig.cap="Plot of Landsat-8 image obtained from the NASA HLS collection with a single tile showing the island of Ilhabela in the Brazilian coast."}
```{r, tidy="styler"}
# Timeline of the Sentinel-2 cube
sits_timeline(hls_cube_s2)
```
Expand All @@ -271,7 +271,8 @@ sits_timeline(hls_cube_l8)
```{r, tidy="styler"}
# Timeline of the Landsat-8 cube
sits_timeline(hls_cube_merged)
```
```{r, tidy="styler", out.width="100%", fig.align="center", fig.cap="Plot of Landsat-8 image obtained from the NASA HLS collection with a single tile showing the island of Ilhabela in the Brazilian coast."}
# plotting a harmonized Landsat image from the merged data set
# plot the cube
plot(hls_cube_merged,
Expand Down Expand Up @@ -300,22 +301,22 @@ In general, `sits` users need to match the local file names to the values provid
```{r}
library(sits)
# Create a cube based on a stack of CBERS data
data_dir <- system.file("extdata/Rondonia-20LMR", package = "sitsdata")
data_dir <- system.file("extdata/Rondonia-20LKP", package = "sitsdata")
# List the first file
list.files(data_dir)[1]
```

```{r, tidy="styler", out.width="100%", fig.align="center", fig.cap="Sentinel-2 image over an area in Rondonia, Brazil (Source: Authors)."}
# Create a data cube from local files
s2_cube_20LMR <- sits_cube(
s2_cube_20LKP <- sits_cube(
source = "MPC",
collection = "SENTINEL-2-L2A",
data_dir = data_dir
)
# Plot the band B8A in the first time instance
plot(s2_cube_20LMR, red = "B11", green = "B8A", blue = "B02",
date = "2022-07-16")
plot(s2_cube_20LKP, red = "B11", green = "B8A", blue = "B02",
date = "2020-07-22")
```

## Defining a data cube using classified images{-}
Expand Down
6 changes: 3 additions & 3 deletions 09-rasterclassification.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ plot(cube_20LMR_bayes, labels = c("Forest", "Clear_Cut_Bare_Soil"), palette = "

In general, users should perform a post-processing smoothing after obtaining the probability maps in raster format. After the post-processing operation, we apply `sits_label_classification()` to obtain a map with the most likely class for each pixel. For each pixel, the `sits_label_classification()` function takes the label with highest probability and assigns it to the resulting map. The output is a labelled map with classes. In addition, the function will remove outliers using a modal filter after if the `clean` parameter is set to `TRUE` (default value). For each pixel, the modal filter scans a neighborhood defined by `window_size` (default = 3) and assigns such pixel to the most frequent label inside the window.

```{r, tidy = "styler", out.width = "120%", fig.align="center", fig.cap="Final map of deforestation (Source: Authors)."}
```{r, tidy = "styler", out.width = "120%", fig.align="left", fig.cap="Final map of deforestation obtained by random forest model(Source: Authors)."}
# Generate a thematic map
cube_20LMR_class <- sits_label_classification(
cube = cube_20LMR_bayes,
Expand All @@ -130,7 +130,7 @@ plot(cube_20LMR_class, tmap_options =



## Training and runninng deep learning models{-}
## Training and running deep learning models{-}

The next examples shows how to run deep learning models in `sits`. This model will show how to run deep learning methods in GPUs if available. The case study uses the Temporal CNN model [@Pelletier2019], which is described in Chapter[Machine learning for data cubes](https://e-sensing.github.io/sitsbook/machine-learning-for-data-cubes.html). We first show the need for model tuning, before applying the model for data cube classification.

Expand Down Expand Up @@ -213,7 +213,7 @@ cube_20LMR_probs_tcnn <- sits_classify(

After classification, we can smooth the probability cube and then label the resulting smoothed probabilities to obtain a classified map.

```{r, tidy="styler", out.width = "120%", fig.align="center", fig.cap="Final map of deforestation (Source: Authors)."}
```{r, tidy="styler", out.width = "120%", fig.align="left", fig.cap="Final map of deforestation obtained using TempCNN model (Source: Authors)."}
# Smoothen the probability map
cube_20LMR_bayes_tcnn <- sits_smooth(
cube_20LMR_probs_tcnn,
Expand Down
Loading

0 comments on commit 1692dec

Please sign in to comment.