# Mewara-SOC-Modelling-in-South-Africa
This code was developed by Swati Mewara while undertaking her dissertation project titled 'Mapping Soil Organic Carbon (SOC) Stocks of South Africa using Convolutional Neural Network and Analyzing Trends in SOC Changes'.
The purpose of this repo is to create robust and accurate Soil Organic Carbon (SOC) stock maps for South Africa (SA) from 2000 to 2023 using Convolutional Neural Networks (CNNs) and compare their performance against Random Forest (RF) model. After generating the maps, the trends in SOC stock changes across different biomes in South Africa are generated.
### Data
The data folder contains the following data sources:
- **Field Samples**: Ground soil samples include Date, Latitude, Longitude (in decimals), Carbon (C) percentage by mass, and Bulk Density (BD) in g/cm³. Missing bulk density values are filled using the African iSDA raster dataset [1] during the data processing step. Additional field samples from iSDA are included for modeling, but only a few samples from South Africa are used, while others from Southern African countries are excluded.
### Data Collection
This folder contains Python scripts for collecting covariates
- `landsat_earth_engine`: Downloads annual Landsat composites from Landsat 5, 7, 8, 9 sensors (1986-2023) from Google Earth Engine [2] to Google Storage Drive. The script harmonizes Landsat bands across different sensors, computes indices like NDVI, SAVI, RVI, and EVI, and saves the annual composites to Google Drive.
- `raster_preprocessor`: Resamples and merges rasters into a single composite to manage large sizes.
- `terrain_data`: terrain raster is manually downloaded from Open Topography, which provides access to the Copernicus Digital Elevation Model [3] in chunks for SA. The script downsamples the raster to 120 m resolution and calculates aspect, slope, and total wetness index.
- `world_clim`: historical weather data until 2021, including monthly average maximum and minimum tem …