## 2 Materials and Methods
### Feature Engineering
#### 2.4.2 Textural Features  
To generate textural features, we employed the grey-level co-occurrence matrix (GLCM), which is the most applied method for quantifying textures at the pixel level. A GLCM is in essence a matrix that describes the number of occurrences for pair-wise pixel values that occur in the original image expressed as probabilities [73]. There are various textural measures to summarise a GLCM, which were originally proposed by [74]. In this study, we calculated 17 GLCM-based textural measures for the 12 Sentinel-2 bands (Table 3), resulting in 204 textural features in total. The respective built-in function in GEE was used for this purpose [9]. Since the GLCM implementation was only supported with integer values, we converted reflectance values into 32-bit integers. A 3 \(\times\) 3-pixel moving window was applied, averaged over four spatial directions (i.e., horizontal, vertical, two diagonals) with a one-pixel displacement. This window size defined the neighbourhood where texture calculations took place, assigning the output to the window's centre pixel. We opted for a small window size with the aim to capture the texture of small-sized cocoa plots, following the practice of [45]. Given that some textural features showed a strong correlation with each other due to their similar calculation method [73], it is suggested to select a subset of them [74]. We implemented agglomerative hierarchical clustering to select a less-correlated subset from the 204 generated textural features. To this end, we employed the Scikit-learn package [88] in the Google Colaboratory environment [89]. Agglomerative hierarchical clustering progressively groups similar observations into clusters, starting by treating single observations \begin{table}
\begin{tabular}{c c c c} \hline \hline
**Input Data Type** & **Description** & **Acronym** & **Formula** & **Source** \\ \hline \multirow{8}{*}{Sentinel-2 level-2 reflectance bands} & Coastal aerosol & B1 & - & - \\  & Blue & B2 & - & - \\  & Green & B3 & - & - \\  & Red & B4 & - & - \\  & Red-edge 1 & B5 & - & - \\  & Red-edge 2 & B6 & - & - \\  & Red-edge 3 & B7 & - & - \\ bands & Near-infrared & B8 & - & - \\  & Red-edge 4 & B8A & - & - \\  & Water vapor & B9 & - & - \\  & Shortwave infrared 1 & B11 & - & - \\  & Shortwave infrared 2 & B12 & - & - \\ \hline \multirow{8}{*}{Vegetation indices} & Enhanced vegetation index & EVI & \(2.5\times(\text{B8}-\text{B4})\) & [75] \\  & Green normalised difference & \multirow{2}{*}{GNDVI} & \(\text{B8}-\text{B3}\) & [76] \\  & vegetation index & & \(\text{B8}+\text{B3}\) & \\  & Normalised difference moisture & \multirow{2}{*}{NDMI} & \(\text{B8}-\text{B11}\) & [77] \\  & index & & \(\text{B8}+\text{B11}\) & [77] \\  & Normalised difference red edge & \multirow{2}{*}{NDRE} & \(\text{B8}-\text{B5}\) & [78; 79] \\  & index & & \\  & Normalised difference & \multirow{2}{*}{NDVI} & \(\text{B8}-\text{B4}\) & [80] \\  & vegetation & index & \\  & Plant senescence reflectance indices & \multirow{2}{*}{PSRI} & \(\text{B4}-\text{B2}\) & [81] \\  & index & & \(\text{B7}-1\) & [72; 82] \\  & Red-edge chlorophyll index & \multirow{2}{*}{RECI} & \(\text{B5}-\text{B5}\) & [83] \\  & Red-edge normalised difference & \multirow{2}{*}{RENDIVI} & \(\text{B6}+\text{B5}\) & [83] \\  & Vegetation index & & \(\text{B8}-\text{B4}\) & [84] \\  & Soil-adjusted vegetation index & \multirow{2}{*}{TASUI} & \(\text{B8}+\text{B4}+\text{B4}\times 1.428\) & [84] \\  & Triangular chlorophyll index & \multirow{2}{*}{TCI} & \(1.2\times(\text{B5}-\text{B3})-1.5\times(\text{B4}-\text{B3})\times\text{ SQRT}(\text{B5}\over 64)\) & [85] \\  & Visible atmospherically & \multirow{2}{*}{VARI} & \(\text{B3}-\text{B4}\) & [85] \\  & resistant index & & \(\text{B3}+\text{B4}-\text{B2}\) & [86] \\ \hline \hline \end{tabular}
\end{table} 
Table 2: The 12 reflectance bands of the Sentinel-2 median composite image, along with 11 derived vegetation indices (VIs). Formulas were adjusted to the Sentinel-2 bands. Different names for VIs may have been used in literature.