ThoMaS – PACE Hack Week
Juan Ignacio Gossn
Remote Sensing Specialist – Ocean Colour - EUMETSAT
Eumetsat Allee 1, 64295 Darmstadt, Germany
JuanIgnacio.Gossn@eumetsat.int
+ Eleni Kalogeraki, Ilaria Cazzaniga, Malcolm Taberner, Ewa Kwiatkowska, Ben Loveday, Hayley Evers-King, David Dessailly, Anna E. Wyndle di Paola, James G. Allen, Dirk Aurin
PACE Hack Week
August 2024
copernicus.eumetsat.int
ThoMaS - PACE Hack Week
1
1. What’s ThoMaS? Scope
ThoMaS is a toolkit developed to create matchups of bio-geophysical insitu data with satellite ocean colour products from Sentinel-3 OLCI (S3/OLCI).
in SeaBASS format
Standard products from NASA’s OBPG also supported
Others easily configurable, if netCDF or series of netCDFs
copernicus.eumetsat.int
ThoMaS - PACE Hack Week
2
1. What’s ThoMaS? Scope
After running ThoMaS, you will get:
copernicus.eumetsat.int
ThoMaS - PACE Hack Week
3
1. Motivation for having ThoMaS
copernicus.eumetsat.int
ThoMaS - PACE Hack Week
4
1. Some disclaimers: ThoMaS is just a baby!
copernicus.eumetsat.int
ThoMaS - PACE Hack Week
5
2. Some background: match-ups
Ocean colour 👀
Of course we have much more to define… and take care of…
copernicus.eumetsat.int
ThoMaS - PACE Hack Week
6
2. Some background: match-ups
Are we comparing 🍎 with 🍎?
🡪 What is the definition of Rrs?
🡪 Are these two compatible “spectrally”? 🡪 convolution/band-shifting
🡪 Are these two compatible “directionally”? 🡪 BRDF correction
BRDF correction:
Spectral convolution
Burggraaff 2020
D’Alimonte et al.
Morel et al. 2002 supported in ThoMaS
Definition of Rrs
OO Web Book, Mobley, Boss & Roesler
Band-shifting (to pair multispectral to multispectral)
Melin & Sclep 2015 supported in ThoMaS
PACE: Spectral reconstruction
Talone, Zibordi, Pitarch 2024, recently added
copernicus.eumetsat.int
ThoMaS - PACE Hack Week
7
2. Some background: match-ups (spectrally matching insitu to satellite)
An issue with the Melin & Sclep 2015 band-shifting method (designed for multi2multi matching)
copernicus.eumetsat.int
ThoMaS - PACE Hack Week
8
2. Some background: match-ups (spectrally matching insitu to satellite)
Tried Talone, Zibordi and Pitarch 2024 method
This method:
Validated with a concurrent hyperspectral in situ instrument, showing relative differences typically < 5 % between modelled and measured values.
copernicus.eumetsat.int
ThoMaS - PACE Hack Week
9
2. Some background: match-ups (spectrally matching insitu to satellite)
copernicus.eumetsat.int
ThoMaS - PACE Hack Week
10
2. Some background: match-ups
Are we comparing 🍎 with 🍎?
Quality of insitu
ThoMaS still does not consider any quality flag to process insitu data…
Define your extraction statistics!
Define your extraction window size!
Define the matchup statistics!
EUMETSAT’s Matchup Protocols
copernicus.eumetsat.int
ThoMaS - PACE Hack Week
11
2. Some background: match-ups: EUMETSAT extraction protocol
EUMETSAT’s Matchup Protocols: extraction of statistics at macropixel level
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
Set BFOR: 5x5 window
Detection of non-valid pixels
(flagged pixels)
Set BOR: without flagged pixels
Detection of outliers
Set final: without flagged & outlier
Pixels are masked/removed if flagged by any of the following:
CLOUD, CLOUD_AMBIGUOUS, CLOUD_MARGIN, INVALID, COSMETIC, SATURATED, SUSPECT, HISOLZEN, HIGHGLINT, SNOW_ICE, AC_FAIL, WHITECAPS, ADJAC, RWNEG_O2, RWNEG_O3, RWNEG_O4, RWNEG_O5, RWNEG_O6, RWNEG_O7, RWNEG_O8
+ product-specific flags e.g. OC4ME_FAIL
Pixel ‘X’ is considered outlier if:
|value@X - µBOR| < 1.5σBOR
Macropixel is discarded if:
NBOR < 50% NBFOR
Central value: medianfinal
Uncertainty measure (Type B): σfinal
Homogeneity measure: CVfinal
Macropixel is discarded if:
CVfinal(560)>20%
µ 🡪 Mean
σ 🡪 Standard deviation
Window size recommended: 5x5 or 3x3
Tolerable insitu-satellite time difference: 1 hr or 3 hrs
ThoMaS can be run with many other extraction protocols, that you define
copernicus.eumetsat.int
ThoMaS - PACE Hack Week
12
2. Some background: match-ups: Bailey & Werdell protocol
EUMETSAT’s Matchup Protocols: extraction of statistics at macropixel level
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
Set BFOR: 5x5 window
Detection of non-valid pixels
(flagged pixels)
Set BOR: without flagged pixels
Detection of outliers
Set final: without flagged & outlier
Pixels are masked/removed if flagged by any of the following:
ATMFAIL, LAND, HIGLINT, HILT, HISATZEN, STRAYLIGHT, CLDICE, COCCOLITH, HISOLZEN, LOWLW, CHLFAIL, NAVWARN, MAXAERITER, CHLWARN, ATMWARN, SEAICE, NAVFAIL, MODGLINT
+ product-specific flags e.g. OC4ME_FAIL
Pixel ‘X’ is considered outlier if:
|value@X - µBOR| < 1.5σBOR
Macropixel is discarded if:
NBOR < 50% NBFOR
Central value: medianfinal
Uncertainty measure (Type B): σfinal
Homogeneity measure: CVfinal
Macropixel is discarded if:
Median[CV(Rrs(410-551));CV(AOT(869))]>15%
µ 🡪 Mean
σ 🡪 Standard deviation
Window size recommended: 5x5 or 3x3
Tolerable insitu-satellite time difference: 1 hr or 3 hrs
ThoMaS can be run with many other extraction protocols, that you define
copernicus.eumetsat.int
ThoMaS - PACE Hack Week
13
2. Some background: match-ups: what protocol to use?
Should we care about what matchup protocol we use?
[Concha et al. 2021]
YES
copernicus.eumetsat.int
ThoMaS - PACE Hack Week
14
2. Some background: match-ups, performance metrics used
Mean Difference 🡪
Mean Absolute Difference 🡪
Mean Percent Difference 🡪
Mean Absolute Percent Difference 🡪
Log-based Mean Absolute Difference 🡪
Following recommendation by Seegers et al. 2018
copernicus.eumetsat.int
ThoMaS - PACE Hack Week
15
2. Some background: match-ups, performance metrics used
Median Difference 🡪
Median Absolute Difference 🡪
Median Percent Difference 🡪
Median Absolute Percent Difference 🡪
copernicus.eumetsat.int
ThoMaS - PACE Hack Week
16
2. Some background: match-ups, performance metrics used
Spectral Angle Mapper 🡪
Chi-squared 🡪
+ linear regression of two types…
copernicus.eumetsat.int
ThoMaS - PACE Hack Week
17
3. Run the code
Example 9: Casablanca Platform (PACE and VIIRS)
PI: Marco Talone and Frederic Melin
[Zibordi et al. 2002]
copernicus.eumetsat.int
ThoMaS - PACE Hack Week
18
3. Run the code
Example 9: Casablanca Platform (PACE and VIIRS)
1. You want to test the performance of OLCI at the AERONET-OC station Casablanca, South West of Spain (Med Sea) during March to July 2024.
In this case, latLonTimeRanges.csv will be generated automatically by ThoMaS (based on your inputted insitu lat-lon and timestamps + your inputted time tolerance in config_file.ini) and stored under path_output
[global]
path_output: /path/to/Casablanca
SetID: Casablanca
[workflow]
workflow: insitu, SatData, minifiles, EDB, MDB
[AERONETOC]
AERONETOC_pathRaw:/path/to/AERONET_OC_raw
AERONETOC_dateStart: 2024-03-01T00:00:00
AERONETOC_dateEnd: 2024-08-01T00:00:00
AERONETOC_dataQuality: 1.5
AERONETOC_station: Casablanca_Platform
[insitu]
insitu_input: /path/to/Casablanca/Casablanca_Platform_OCDB.csv
insitu_satelliteTimeToleranceSeconds: 3600
insitu_getAncillary: False
insitu_BRDF: M02
[satellite]
satellite_path-to-SatData: /path/to/Casablanca/SatData
satellite_source: NASA_OBPG
satellite_collections: operational
satellite_platforms: NOAA-20, PACE
satellite_resolutions: FR
satellite_BRDF: M02
[minifiles]
minifiles_winSize: 3
[EDB]
EDB_protocols_L2: Bailey_and_Werdell_2006
EDB_winSizes: 3
[MDB]
MDB_time-interpolation: insitu2satellite_NN
MDB_stats_plots: True
MDB_stats_protocol: EUMETSAT_standard_L2
copernicus.eumetsat.int
ThoMaS - PACE Hack Week
19
3. Run the code: command line
If YES.. run by executing this command:
python /path/to/ThoMaS/main.py –cf /path/to/config_file.ini
copernicus.eumetsat.int
ThoMaS - PACE Hack Week
20
3. Run the code: Try the new GUI ☺ 🡪 git pull origin main
copernicus.eumetsat.int
ThoMaS - PACE Hack Week
21
4. Now a DEMO
copernicus.eumetsat.int
ThoMaS - PACE Hack Week
22
4. What you should get at the MDB step
Essentially:
1. Matchup results in netCDF4
2. Matchup results in CSV
3. Matchup plots in PNG
copernicus.eumetsat.int
ThoMaS - PACE Hack Week
23
4. What you should get at the MDB step
NOAA-20/VIIRS
copernicus.eumetsat.int
ThoMaS - PACE Hack Week
24
4. What you should get at the MDB step
PACE/OCI
copernicus.eumetsat.int
ThoMaS - PACE Hack Week
25
4. What you should get at the MDB step
NOAA-20/VIIRS
PACE/OCI
copernicus.eumetsat.int
ThoMaS - PACE Hack Week
26
4. What you should get at the MDB step
NOAA-20/VIIRS
PACE/OCI
copernicus.eumetsat.int
ThoMaS - PACE Hack Week
27
4. What you should get at the MDB step
NOAA-20/VIIRS
PACE/OCI
copernicus.eumetsat.int
ThoMaS - PACE Hack Week
28
4. What you should get at the MDB step
NOAA-20/VIIRS
PACE/OCI
copernicus.eumetsat.int
ThoMaS - PACE Hack Week
29
5. Pre-requisites
Dependencies
Conda will take care of this…
copernicus.eumetsat.int
EUM/OPS-COPER/TEM/15/813104, v2, 3 November 2021
30
6. Getting the code
cd ~
mkdir ThoMaS
cd ThoMaS
git clone --depth 1 https://gitlab.eumetsat.int/eumetlab/oceans/ocean-science-studies/ThoMaS .
Recent updates were done on the code
git pull origin main
copernicus.eumetsat.int
EUM/OPS-COPER/TEM/15/813104, v2, 3 November 2021
31
7. Setting the environment
cd ~
cd ThoMaS
conda env create –f environment.yml
conda activate thomas
libmamba is the best choice for those of you who are stuck in the “Solving environment step”
Questions?: JuanIgnacio.Gossn@eumetsat.int
copernicus.eumetsat.int
EUM/OPS-COPER/TEM/15/813104, v2, 3 November 2021
32