# MEC: A Mesoscale Events Classifier for Oceanographic Imagery
## 4 MEC Explained
### Features Extraction  
The spaghetti plot representation of an ensemble of SST signals within a given area of interest is a qualitative method that can be exploited in a preliminary stage to visually detect and classify mesoscale events by jointly observing the spatial and temporal SST trend. This approach is prone to human interpretative errors and becomes quickly unfeasible as the size of the considered area increases. A computer-based implementation of the visual classification task must be introduced to make the processing pipeline automatic and replace the mere visual analysis.  
In this section, we identify a number of features computed from the SST series exploited in the generation of the spaghetti plots, such as the \(p_{i,j}\) defined above, with the purpose of defining a set of rules to be applied to those features. The rules constitute the next step in the classification task and are described in detail in Section 4.3.  
The starting point is the set of the series \(p_{i,j}\), defined in (1), for all squares \(a_{i,j}\) in which the area of interest is divided. For each series \(p_{i,j}=\{(t_{k},\overline{T}_{i,j}(t_{k}))\mid k=1,\ldots,n_{i,j}\}\) the following three statistics are computed:  
1. The _temporal mean_ of \(p_{i,j}\) \[\mu_{i,j}=\frac{1}{n_{i,j}}\sum_{k=1}^{n_{i,j}}\overline{T}_{i,j}(t_{k});\]
2. The _standard deviation_ of \(p_{i,j}\) \[\sigma_{i,j}=\sqrt{\frac{1}{n_{i,j}}\sum_{k=1}^{n_{i,j}}(\overline{T}_{i,j}(t _{k})-\mu_{i,j}))^{2}};\]3. The _linear regression coefficient_\(\theta_{i,j}\), defined as the slope of the straight line that better interpolates the points in \(p_{i,j}\).  
These statistics describe, in first approximation, the behaviour of the SST locally in the square \(a_{i,j}\). Additional parameters, such as the coefficients of the quadratic regression curve for the points of \(p_{i,j}\), have been considered initially, but they have been discarded since their integration in the classification pipeline did not improve the performance, at the expense of a more complicated model. Notice that, by using the coefficient \(\theta_{i,j}\) we _do not assume_ that time and SST are linearly correlated: that value simply represents a descriptor of the SST trend in the square \(a_{i,j}\).  
Due to the fluctuating quality of the SST imagery, the value \(n_{i,j}\coloneqq|p_{i,j}|\) appearing in the formulas above is not constant, but depends on the quantity of reliable data in the files within the time period. In particular, higher values of \(n_{i,j}\) correspond to a more faithful estimation of the statistics for the SST trend in \(a_{i,j}\) in the time period through the computation of \(\mu_{i,j}\), \(\sigma_{i,j}\), and \(\theta_{i,j}\). Therefore, \(n_{i,j}\) can be viewed as a reliability index of the classification of the square \(a_{i,j}\). As an additional check to avoid the case of unreliable results, no feature is computed for a square \(a_{i,j}\) if it contains too few data in the time period.  
In Figure 4, three maps show the values of these statistics computed for the case study under investigation. Given the time interval \(\tau\) of 15 days, we expect to have \(n_{i,j}\approx 30\) SST values defined in each square, therefore in this case we set the threshold of \(n_{i,j}>4\) for the statistics to be computed for \(a_{i,j}\).  
Figure 3: Event of 13 August 2016 at around 21:40 UTC. (**a**) SST map at the date of the event; (**b**) detail of the SST in the reference area for the spaghetti plot (latitude between 37\({}^{\circ}\) and 37.75\({}^{\circ}\) N, longitude between 9.5\({}^{\circ}\) and 8.75\({}^{\circ}\) W, resolution 0.25\({}^{\circ}\)); (**c**) reference grid; and (**d**) generated spaghetti plot.