# Detecting Symptoms and Dispersal of Pine Tortoise Scale Pest in an Urban Forest by Remote Sensing
## 2 Material and Methods
### Detection Dataset and Model  
PRISMA imagery was used to detect the presence of PTS symptoms on the Estate stone pine stands. Among all the levels provided by the PRISMA mission, level 2D is the most comprehensive, offering reflectance information, atmospheric corrections, and geographical co-registration. Other levels provide raw radiance without radiometric, atmospheric, and geographic corrections.  
The imagery used had a maximum of 2.7% cloud coverage, which never affected the scene over the Estate. The downloaded he5 file also contained all the metadata related to the platform required for geometric processing. The original he5 file was opened in the Python (version 3.12) environment using the _h5 py_ library ([[https://pypi.org/project/h5](https://pypi.org/project/h5) py/]([https://pypi.org/project/h5](https://pypi.org/project/h5) py/) (accessed on 1 June 2024)), and GeoTIFF images containing all the 239 hyperspectral bands were created. From this set of bands, 27 were removed due to many values tending toward zero, representing the spectral region between the VIS-NIR and SWIR, as well as intervals within different parts of the SWIR.  
The detection dataset that was used to train, validate, and test a binary Random Forest (RF) classifier was formed by random sampling points geographically located in pine forest stands, with a minimum neighbor distance of 30 m, and including the 40 locations of the phenological dataset. Stands were buffered inward by the same distance to mitigate the potential edge effect caused by the coarse spatial resolution of the PRISMA image. As a result of the buffer process, the total pine forest area decreased to 530 ha.  
Reflectance thresholds from the phenological dataset were used to integrate ground validation data to correctly label the binary class (the presence/absence of symptoms in  
Figure 2: The monthly median and composite values of near-infrared (yellow color) and visible red (cyan color) reflectance were sampled at 40 random points in the forest stands and loess-smoothed curves. PRISMA is an acronym for “Hyperspectral Precursor of the Application Mission” earth observation system used to detect the symptoms of infestation of _Toumeyella parvicornis_ in forest stands.  
-pine forests). For this reason, all PRISMA bands in the visible region were excluded from the detection dataset to avoid any dependency issues in the training of the RF classifier.  
The final detection dataset featured 384 locations and 167 features. Train, validation, and test sub-datasets were randomly sampled from the detection dataset with 65%, 10%, and 25% proportions, respectively.  
To obtain the highest model accuracy, before applying the Random Forest algorithm for the final classification, the model was fine-tuned using the testing dataset. Different combinations of hyperparameters were used to train the Random Forest model on the training dataset. The sequences of parameters were defined as follows: number of trees ranging from 1 to 100 with a step of 10, variables per split ranging from 1 to 20 with a step of 2, and leaf population ranging from 1 to 10 with a step of 1. The accuracy of each trial was then evaluated on the independent testing dataset that was never used during training, ensuring an unbiased assessment of the model performance for each parameter configuration. Finally, the model was trained and validated with training and validation datasets. A classification accuracy assessment was carried out using the overall accuracy (OA) and Kappa coefficient of agreement (\(\hat{K}\)), one of the most common and reliable indicators for reporting the accuracy of thematic maps [53].  
Furthermore, RF provides an important score for each variable used for classification (PRISMA image bands), which was used to determine what wavelengths were most significant for infestation diagnosis. A threshold of importance was established to select the most diagnostic bands. The reflectance values were used for labeling each pixel according to the presence/absence of symptoms.