This repository contains a collection of MATLAB scripts that I have developed for reading, formatting and visualising freely-available oceanographic datasets stored in .nc
(NetCDF) files. It includes tools to organise data into a four-dimensional structure: latitudes x longitudes x depth levels x 12 months
, essentially creating a climatology. This structure facilitates further data processing, such as data-model validation or model input preparation. Developed across various projects, I actively maintain and update these scripts to meet evolving research needs.
To use the content of this repository, ensure you have the following.
- MATLAB version R2021a or later installed.
- Third-party functions downloaded from MATLAB's File Exchange:
worstcase
,m_map
,brewermap
andsubaxis
. Once downloaded, place these in the./resources/external/
directory. - CO2SYS algorithm for carbonate system calculations. Once downloaded, place it in the
./resources/external/
directory. copernicusmarine
toolbox, essential for downloading oceanographic data from the Copernicus Marine Environmental Monitoring Service (CMEMS). Installation instructions are in this related repository.- Jupyter Notebook, included in the latest Anaconda Python distribution.
./code/
: contains the MATLAB scripts (and additional Jupyter Notebooks and shell scripts) for downloading, reading, formating and visualising data (provided, see "Scripts Overview")../data/
./raw/
: raw data downloaded from source URLs (not provided, see below for details)../processed/
: processed data generated by MATLAB scripts (not provided, see below for details).
./resources/
./external/
: third-party resources for plotting and functions (see "Requirements" section)../internal/
: custom MATLAB functions generated specifically for plotting (provided).
./figures/
: figures generated from processed data (provided).
Due to large file sizes and variety of licenses that limit re-distribution of data in various ways, raw data are not hosted in the ./data/raw/
folder. Instead, the links for manually obtaining these data (as .nc
files) are provided in the "Data Sources" section below as well as within the MATLAB scripts in the ./code/
folder. If manual access is difficult, we iclude scripts to download data programmatically. Note that data URLs may change over time, potentially interrupting access. The processed data created by the MATLAB scripts (.mat
) are placed in the ./data/processed/
folder but cannot be provided due to their large size.
The oceanographic datasets used in this repository are sourced from the following open-access resources:
Open-access resource | Sector |
---|---|
Copernicus Marine Environmental Monitoring Service (CMEMS) Data Store | Ocean biogeochemistry, ocean physics and ocean colour data |
Earth System Grid Federation (ESGF) | Climate data from Coupled Model Intercomparison Projects phase 6 (CMIP6) |
ESA Biological Pump and Carbon Exchange Processes (BICEP) project | Ocean colour and ocean biogeochemistry data |
ESA GlobColour project | Ocean colour data |
ESA Ocean Colour Climate Change Initiative (OC-CCI) | Ocean colour data |
General Bathymetric Chart of the Ocean (GEBCO) | Bathymetry data |
Global Ocean Data Analysis Project (GLODAP) | Ocean biogeochemistry, physics and carbonate system variables |
Institut Français de Recherche pour l'Exploitation de la Mer (IFREMER) Mixed Layer Depth Climatology website | Mixed layer depth data |
NASA Ocean Color website | Ocean colour data |
NOAA National Centers for Environmental Information (NCEI) AVHRR Pathfinder SST | Sea surface temperature data |
NOAA National Centers for Environmental Information (NCEI) World Ocean Atlas | Ocean biogeochemistry and ocean physics data |
Oregon State University's Ocean Productivity Site | Net primary production data |
The specific oceanographic datasets accessed and processed by this repository include:
- Aeolian dust deposition
- Bathymetry
- Carbonate system variables (carbonate ion concentration, omega calcite and omega aragonite)
- Chlorophyll a (chla) concentration
- Diffuse attenuation coefficient at 490 nm (kd(490))
- Euphotic layer depth (zeu)
- Calculated from (1) kd(490) from CMEMS global BGC reanalysis or NASA Aqua-MODIS sensor, and (2) MLD from CMEMS global BGC reanalysis or IFREMER
- Mixed layer depth (MLD)
- Net primary production (NPP)
- Oregon State University's Ocean Productivity Site (VGPM, CbPM, CAFE)
- BICEP
- CMEMS global BGC reanalysis
- Carr (2002) model
- Nutrients (nitrate, silicate, phosphate and dissolved oxygen concentration)
- Photosynthetic active radiation at the surface ocean (PAR0)
- NASA Aqua-MODIS sensor
- NASA SeaWiFS sensor
- GlobColour merged sensors
- Calculated using astronomic/trigonometric equations and data inputs of sea ice fraction from CMEMS global PHYS reanalysis and cloud cover fraction from Pincus et al. (2008)
- Sea surface temperature (SST)
- NOAA National Centers for Environmental Information (NCEI) AVHRR Pathfinder SST
- Seawater temperature
- Mesozooplankton concentration
The following scripts are available in the ./code/
folder. Notice all datasets produced are latitudes x longitudes (x depth levels) x 12 months
.
Num | Script name | Script action |
---|---|---|
1 | downloadBGCandPHYSfromCMEMS.ipynb | Downloads BGC and PHYS L4 data from CMEMS. Must be run before script 6 |
2 | downloadChlaFromOCCCI.m | Downloads merged-sensor, L3 chla data from OC-CCI. Must be run before script 8 |
3 | downloadOCfromGlobColour.ipynb | Downloads merged-sensor, L3 PAR0 data from GlobColour. Must be run before script 14 |
4 | ncreadAerosolDustDepositionFromCMIP6.m | Creates dustflux_cmip6_ncarcesm2.mat (192 x 288 x 12) |
5 | ncreadBathymetryFromGEBCO.m | Creates bathymetry_gebco.mat (1080 x 2160) |
6 | ncreadBGCandPHYSfromCMEMS.m | Creates chla_cmems_bgc.mat , kd_cmems_bgc.mat , mld_cmems_phys.mat , icefrac_cmems_phys.mat (1080 x 2160 x 12) and temp_cmems_phys.mat (1080 x 2160 x 50 x 12) |
7 | ncreadBGCandPHYSfromWOA.m | Creates nit_monthly_woa23.mat , phos_monthly_woa23.mat , sil_monthly_woa23.mat , temp_monthly_woa23.mat , oxy_monthly_woa23.mat (180 x 360 x 102 x 12) and temp_annual_woa23.mat (180 x 360 x 102) |
8 | ncreadChlaFromNASAandOCCCI.m | Creates chla_modis.mat (4320 x 8640 x 12), chla_seawifs.mat (2160 x 4320 x 12) and chla_occci.mat (4320 x 8640 x 12) |
9 | ncreadCloudCoverFromPincus.m | Creates cloudcover_pincus.mat (72 x 144 x 12) |
10 | ncreadKdFromNASA.m | Creates kd_modis.mat (4320 x 8640 x 12) |
11 | ncreadNPPfromBICEP.m | Creates npp_bicep.mat (2160 x 4320 x 12) |
12 | ncreadNPPfromOceanProductivitySite.m | Creates npp_cafe_seawifs.mat , npp_cafe_modis.mat , npp_cbpm_modis.mat and npp_vgpm_modis.mat (1080 x 2160 x 12) |
13 | ncreadMLDfromIFREMER.m | Creates mld_ifremer.mat (90 x 180 x 12) |
14 | ncreadPAR0fromGlobColour.m | Creates par0_globcolour.mat (180 x 360 x 12) |
15 | ncreadPAR0fromNASA.m | Creates par0_modis.mat (4320 x 8640 x 12) and par0_seawifs.mat (2160 x 4320 x 12) |
16 | ncreadSSTfromPathfinder.m | Creates sst_pathfinder_v5.mat (4096 x 8192 x 12) |
17 | ncreadZooplanktonFromCMIP6.m | Creates mesozoo_cmip6_pisces.mat (64 x 128 x 75), mesozoo_cmip6_cobalt.mat (180 x 360 x 35) and mesozoo_cmip6_medusa.mat (64 x 128 x 75) |
18 | createGridFromBathymetricData.m | Creates grid_GEBCO_2160_1080.mat (1080 x 2160 x 500) and grid_GEBCO_360_180.mat (180 x 360 x 500). Must be run after script 5. |
19 | createGriddedCarbonateSystemClimatology.m | Calculates carbonate system variables using CO2SYS and creates co3ion_co2sys.mat , omegacalcite_co2sys.mat and omegaaragonite_co2sys.mat (180 x 360 x 33 x 12) |
20 | createGriddedPAR0climatology.m | Calculates PAR0 from cloud and ice cover data and creates par0_monthly_calculated.mat (180 x 360 x 12) and par0_daily_calculated.mat (180 x 360 x 365). Must be run after scripts 6, 9 and 18 |
21 | createGriddedZeuClimatology.m | Calculates zeu from kd(490) and MLD and creates zeu_calculated_kdcmems_mldcmems_pointonepercentpar0.mat , zeu_calculated_kdmodis_mldcmems_pointonepercentpar0.mat (1080 x 2160 x 12). Must be run after scripts 6 and 10 |
22 | createGriddedNPPclimatologyFromCarrAlgorithm.m | Calculates NPP from chla, PAR0 and SST and creates npp_carr2002_seawifs_pathfinder_zeuc02.mat , npp_carr2002_seawifs_pathfinder_zeub97.mat , npp_carr2002_modis_pathfinder_zeuc02.mat and npp_carr2002_modis_pathfinder_zeub97.mat (180 x 360 x 12). Must be run after scripts 8, 15 and 16 |
23 | regridZooplanktonConcentrationFromCMIP6.m | Called by script 17 |
24 | calculatePAR0fromTrigonometricEquations.m | Called by script 20 |
25 | Carr2002algorithm.m | Called by script 22 |
26 | processSensorDataFromNASA.m | Called by scripts 8, 10 and 15 |
27 | prepareDataForPlotting.m | Creates figures to show monthly climatological data (figures with _monthly_ infix) |
28 | plotCrossSourceComparisonMaps.m | Creates figures to show comparisons of the same variable across datasets (figures with _comparison_ infix) |
29 | compareInterpolationMethods.m | Applies two different interpolation methods to fill data gaps (especially relevant in polar latitudes) and visualises the output |
30 | submit_zoo_regridding.sh | Submits script 23 to the SLURM job scheduler |
If you use this repository in your research, please cite it as:
Rufas, A. (2024). annarufas/ocean-data-lab: Initial release (v1.0.0) [collection]. Zenodo. https://doi.org/10.5281/zenodo.14544997