# MEC: A Mesoscale Events Classifier for Oceanographic Imagery
## 4 MEC Explained
### Classification Rules
Increase \(e_{i,j}^{4}\) if: 1. The SST trend \(\theta_{i,j}\) inside \(a_{i,j}\) and the \(\theta\)-values of all the full neighbourhood squares of \(a_{i,j}\) (Figure 5a) are positive; 2. The SST in the northwestern neighbourhood (see Figure 5d) of \(a_{i,j}\) either increases after the one in \(a_{i,j}\) or decreases, and the SST in the southeastern neighbourhood of \(a_{i,j}\) increases before the one in \(a_{i,j}\) (this condition is tested for all the relevant squares in the neighbourhoods separately); 3. \(a_{i,j}\) is warmer, on average, than the squares in its northwestern neighbourhood and colder, on average, than the ones in its southeastern neighbourhood (the two conditions are tested separately, each increasing the score if the outcome is positive, and an extra increase is awarded if both are verified). 5. Additional conditions may modify the final scores (these are checked after the previous four points): 1. If the SST variation \(\sigma_{i,j}\) is large (namely \(\sigma_{i,j}\geq 1\) \({}^{\circ}\!C\), which is considered a very large value with respect to the typical standard deviation within the chosen time frame--see also Figure 4), then increase either \(e_{i,j}^{1}\), \(e_{i,j}^{2}\) and \(e_{i,j}^{3}\) (if the SST in \(a_{i,j}\) decreases) or \(e_{i,j}^{4}\) (if the SST increases); 2. If \(a_{i,j}\) is either globally \"cold\" (for events E1, E2, and E3) or globally \"warm\" (for E4), meaning that \(\mu_{i,j}\) is smaller (respectively, larger) than the average of the \(\mu\)-values of all the squares in the area of interest, boost the corresponding scores;(c) If \(a_{i,j}\) is too near the coast (within about 75 km away from it, that is a threshold to distinguish between inshore and offshore upwelling events, given their typical spatial extension), penalize the scores \(e_{i,j}^{1}\) and \(e_{i,j}^{2}\); if it is too far from the coast (further than about 75 km away), penalize \(e_{i,j}^{3}\) and \(e_{i,j}^{4}\). In the case study that we are following, the application of the rules to the values of the statistics in Figure 4 produces the scores reported in Figure 6.  
The final step of the classification process is the production of a heatmap, like the one in Figure 7, which is the result of our case study. It is defined in the following way: for each square \(a_{i,j}\), consider the maximum score \(e_{i,j}^{m}=\max\{e_{i,j}^{1},e_{i,j}^{2},e_{i,j}^{3},e_{i,j}^{4}\}\) and, if this score is greater than a certain threshold, mark the square with the \"Em\" label, otherwise do not assign a label to the square. After some testing, we chose a threshold of 0.6, which produces results that better agree with the ground truth. Each classified square in the heatmap also displays the percentage of available data, which is proportional to the reliability index \(n_{i,j}\) described above. Assuming 30 images in a time interval of 15 days, the numbers in the heatmap are given by \(100\cdot n_{i,j}/30\). Notice that this assumption is a rough estimate, so numbers above 100 may appear. Figure 6: Scores given to each square of the grid for each type of event.