## 3 Materials and Methods
### Scripting in GRASS GIS  
First, the work project 'Algeria' was created and defined using the spatial location. The geospatial information on the coordinate reference system (CRS) was derived from the Landsat images and included the following data: WGS84 datum and ellipsoid (EPSG: 4326) UTM Projection Zone 32. The Landsat bands were then imported into the project using the 'r.import' module, using the bilinear resampling method for reprojection, which applies the extent of the current region and maintains the resolution of the output raster map (i.e., 30 m for Landsat bands in the visible spectrum). The raster metadata were checked using the 'r.info' module, and the computational region was defined to match the scene using the 'g.region' module. The GRASS GIS code is shown in Listing 2:  
```
1r.importinput-/Users/poliamemekova/grassdata/Algeria/LC08_LZSP_193036_20140101_20200912_02_T1_SR_B1.TIFoutput-LS_2014_01 resample-bilinearxtxtensionresolutionregion



A group and a subgroup were created to run the classification using a combination of raster map layers within a group for each year. The Landsat OLI/TIRS images for multiple years (2014 to 2022) were inspected and processed. Grouping and subgrouping the data facilitated the organization and management of data and raster map layers within the 'Algeria' project. Since the current study included several images for multiple years, the semantic labels were set up for each group of bands. This was conducted with the aim of reusing the signature file for the classification of different imagery groups across these years. The semantic labels were generated before the signature files using the 'r.support' module of the GRASS GIS, as shown in Listing 4:
```
1#Defining semanticlabelsforall LandsatOLI/TIRSbands
2r.supportmap=L8,2014.01 semantic_label=OLLI_1
3r.supportmap=L8,2014.02 semantic_label=OLLI_2
4r.supportmap=L8,2014.03 semantic_label=OLLI_3
5r.supportmap=L8,2014.04 semantic_label=OLLI_4
6r.supportmap=L8,2014.05 semantic_label=OLLI_5
7r.supportmap=L8,2014.06 semantic_label=OLLI_6
8r.supportmap=L8,2014.07 semantic_label=OLLI_7
```
Listing 4: GRASS GIS code for creating semantic labels for the Landsat OLI/TIRS. The following steps of the classification included the 'i.cluster' and 'i.maxlik' modules, which used the previously defined imagery group for each year (2014 to 2022) and subgroups of the Landsat bands with the defined year and resolution. The signature file generated in the snippet of code above was allowed to classify the current imagery group only. This means that the data included only visible Landsat bands with a 30 m resolution without panchromatic and thermal infrared bands, which were not necessary in this case. The methodological approach of the 'i.cluster' technique is based on reading the bands of the Landsat satellite images and assigning pixels into the clusters according to the differences in their spectral reflectances. The pixel clusters represent categories (or landscape patches with 30 m sizes) associated with land cover types on the Earth's shape. Therefore, the clusters were automatically defined by the GRASS GIS and used for further steps in classification. The clustering approach of the GRASS GIS uses the k-means algorithm. During the process of k-means clustering by 'i.cluster', the means of the groups to which pixels are assigned are constantly changing. As new pixels are assigned, the means are recalculated iteratively to maximize the distances between the groups until all pixels are assigned into clusters. The bands used for generating signatures of clusters are stored in the group '_L8_2014', as shown in Listing 5. ```
1#generatingsignaturefileandreportfor10 classes
2i.clustergroup=L8,2014 subgroup=res_30m
3 signaturefile=cluster_L8,2014 classes=10 reportfile=rep_clust_L8,2014.txt
```
Listing 5: GRASS GIS code for creating a signature file by the k-means clustering algorithm. The next step includes the classification of images by the 'i.maxlik' module.