# Estimating Carrot Gross Primary Production Using UAV-Based Multispectral Imagery
## 2 Materials and Methods
### Spectral Indexes  
A total of 24 VIs were studied to determine their capacity to predict the daily GPP estimated the EC method. We implemented all of the indexes studied in [43] using the four bands available, namely NDVI, SAVI also referenced in [1], the modified soil adjusted vegetation indexes (MSAVI, MSAVI2), transformed normalized difference vegetation index (TSAVI), MTCI, also refenced in [39], the infrared percentage vegetation index (IPVI), transformed normalized difference vegetation index (TNDVI), green normalized difference vegetation index (GNDV), global environmental monitoring index (GEMI), pigment specific simple ratio (PSSR), ratio vegetation index (RVI), MCARI, also referenced in [20], the difference vegetation index (DVI), and WDVI, as referenced in [1]. We could not implement EVI, because it requires a blue band. However, we implemented the enhanced vegetation index 2 (EVI2) [44] that closely follows EVI using only the red and NIR bands. In addition, we also implemented Clgreen [17,18], CIred-edge, and red-edge NDVI (RENDVI) indicated in [20]. We also included the normalized difference red edge index (NDRE) found in [45] to add more red-edge-based indexes, WDRVI [17], and WDRVIgreen [18]. Finally, we included two novel VIs that have been found to correlate with GPP, namely the green-red vegetation index (GRVI) [29] and near-infrared reflectance of vegetation (NIRv) [19]. We did not find good results for TSAVI using the parameters indicated in [43], which coincides with other papers using the TSAVI; instead, we used the predetermined values indicated in [46] that use a stronger X parameter to suppress noise, which produced better results. After studying the graphs between the daily GPP and Vis, we found that linear regression was a good model to represent the relationship between the VIs and the GPP on several indexes (see Figure 2). In most VIs, the relationship GPP-VIs does not follow any discernible relationship or correlation, and we employ linear regression to be consistent with all the other indexes (Figure 2). The root mean square error (RMSE) and the R\({}^{2}\) score were computed to estimate the performance of the linear regression on each index, as follows:  
\[RMSE=\sqrt{\frac{\sum_{i=1}^{N}(x_{i}-\hat{x}_{i})^{2}}{N}} \tag{4}\]  
\[R^{2}=1-\frac{\sum_{i=1}^{N}(x_{i}-\hat{x}_{i})^{2}}{\sum_{i=1}^{N}(x_{i}-\pi)^ {2}} \tag{5}\]  
where, \(N\) is the number of points, \(x_{i}\) the observed value, and \(\hat{x}_{i}\) the value predicted by the VI. The implementation of all the methods reported here was carried out in Python 3.8. Linear regression was performed using the ordinary least square (OLS) model in the statsmodel  
Figure 2: Linear regression GPP–VIs. module. The RMSE and R\({}^{2}\) statistics were computed using the mean_squared_error and r2_score functions from the sklearn.metrics module. We perform a linear regression of the GPP vs. VIs using all the data available to screen out the best indexes using the RMSE and R\({}^{2}\) statistics, since we are not interested in the model parameters of all models, only in the models that perform better. To predict the performance of the best models on unseen data, we use leave-one-out cross-validation (LOOC), since the dataset is small (11 dates of image acquisition), and it has been shown that LOOC is an almost unbiased estimator of the true model generalization performance [47]. We select the first data sample as the test sample consisting of a VI value on the first date and the corresponding GPP value from the EC. The remaining 10 samples are used to train the first linear model, which is used to compute the error on the test sample. Then, the second data sample is selected as the test sample, and the remaining 10 samples are used to train a second linear model, which is used to compute the error on the second test sample. The process is repeated until all samples are used as test samples. In the end, we end up with 11 linear models and the estimated error on each of the 11 samples.