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.
Monthly climatology of net primary production (NPP) using the Carr 2002 algorithm forced with chla and PAR0 from NASA's Aqua-MODIS sensor, SST from AVHRR Pathfinder, and euphotic zone calculated from the algorithm proposed in Carr 2002.
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. - Jupyter Notebook, included in the latest Anaconda Python distribution.
- CO2SYS algorithm for carbonate system calculations. Once downloaded, place it in the
./resources/external/
directory. - SEAWATER toolbox to calculate seawater density. 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.
./code/
: scripts for downloading, reading, formating and visualising data (provided, see "Scripts Overview")./matlab/
: MATLAB scripts./jupyter/
: Jupyter Notebooks./bash/
: bash scripts
./data/
./raw/
: raw data downloaded from source URLs (not provided, see below for details)../processed/
: processed data generated by code (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 |
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 |
ESA GlobColour project | Ocean colour |
ESA Sea Ice Climate Change Initiative (ESA-CCI) | Sea ice concentration |
ESA Ocean Colour Climate Change Initiative (OC-CCI) | Ocean colour |
General Bathymetric Chart of the Ocean (GEBCO) | Bathymetry |
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 |
NASA Ocean Color website | Ocean colour |
NOAA National Centers for Environmental Information (NCEI) AVHRR Pathfinder SST | Sea surface temperature |
NOAA National Centers for Environmental Information (NCEI) World Ocean Atlas | Ocean biogeochemistry and ocean physics |
Oregon State University's Ocean Productivity Site | Net primary production |
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
- Cloud cover
- 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 using the equations of in Fox et al. (2024), after Morel & Maritorena (2001), Morel et al. (2007) and Buesseler et al. (2020)
- 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)
- Salinity
- Sea ice concentration
- Sea surface temperature (SST)
- NOAA National Centers for Environmental Information (NCEI) AVHRR Pathfinder SST
- Seawater density
- Calculated from salinity and density from World Ocean Atlas 2023 using the SEAWATER toolbox
- Seawater temperature
- Mesozooplankton concentration
The following scripts are available in the ./code/
folder. Notice all datasets produced by the scripts have the arrangement latitudes x longitudes (x depth levels) x 12 months
.
Num | Script name | Script action |
---|---|---|
1 | downloadBGCandPHYSfromCMEMS.ipynb | Notebook to download BGC and PHYS L4 data from CMEMS. Must be run before MATLAB script ncreadBGCandPHYSfromCMEMS.m |
2 | downloadChlaFromOCCCI.m | MATLAB script to download merged-sensor, L3 chla data from OC-CCI. Must be run before MATLAB script ncreadChlaFromNASAandOCCCI.m |
3 | downloadOCfromGlobColour.ipynb | Notebook to download merged-sensor, L3 PAR0 data from GlobColour. Must be run before MATLAB script ncreadPAR0fromGlobColour.m |
4 | downloadSeaIceFromESACCI.ipynb | Notebook to download sea ice concentration climate data record from the AMSR-E and AMSR-2 instruments at 25 km grid spacing from ESA-CCI. Must be run before MATLAB script ncreadSeaIceFromESACCI.m |
5 | ncreadAerosolDustDepositionFromCMIP6.m | MATLAB script to create dustflux_cmip6_ncarcesm2.mat (192 x 288 x 12) |
6 | ncreadBathymetryFromGEBCO.m | MATLAB script to create bathymetry_gebco.mat (1080 x 2160) |
7 | ncreadBGCandPHYSfromCMEMS.m | MATLAB script to create 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) |
8 | ncreadBGCandPHYSfromWOA.m | MATLAB script to create nit_monthly_woa23.mat , phos_monthly_woa23.mat , sil_monthly_woa23.mat , oxy_monthly_woa23.mat , temp_monthly_woa23.mat , sal_monthly_woa23.mat (180 x 360 x 102 x 12) and temp_annual_woa23.mat (180 x 360 x 102) |
9 | ncreadChlaFromNASAandOCCCI.m | MATLAB script to create 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) |
10 | ncreadCloudCoverFromPincus.m | MATLAB script to create cloudcover_pincus.mat (72 x 144 x 12) |
11 | ncreadKdFromNASA.m | MATLAB script to create kd_modis.mat (4320 x 8640 x 12) |
12 | ncreadNPPfromBICEP.m | MATLAB script to create npp_bicep.mat (2160 x 4320 x 12) |
13 | ncreadNPPfromOceanProductivitySite.m | MATLAB script to create npp_cafe_seawifs.mat , npp_cafe_modis.mat , npp_cbpm_modis.mat and npp_vgpm_modis.mat (1080 x 2160 x 12) |
14 | ncreadMLDfromIFREMER.m | MATLAB script to create mld_ifremer.mat (90 x 180 x 12) |
15 | ncreadPAR0fromGlobColour.m | MATLAB script to create par0_globcolour.mat (180 x 360 x 12) |
16 | ncreadPAR0fromNASA.m | MATLAB script to create par0_modis.mat (4320 x 8640 x 12) and par0_seawifs.mat (2160 x 4320 x 12) |
17 | ncreadSeaIceFromESACCI.m | MATLAB script to create seaice_esacci.mat (4320 x 8640 x 12) |
18 | ncreadSSTfromPathfinder.m | MATLAB script to create sst_pathfinder_v5.mat (4096 x 8192 x 12) |
19 | ncreadZooplanktonFromCMIP6.m | MATLAB script to create 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) |
20 | createGridFromBathymetricData.m | MATLAB script to create 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. |
21 | createGriddedCarbonateSystemClimatology.m | MATLAB script that 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) |
22 | createGriddedDensityClimatology.m | MATLAB script that calculates seawater density from temperature and salinity using SEAWATER toolbox and creates rho_calculated_woa23.mat (180 x 360 x 102 x 12) |
23 | createGriddedPAR0climatology.m | MATLAB script that 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 MATLAB scripts ncreadBGCandPHYSfromCMEMS.m , ncreadCloudCoverFromPincus.m and createGridFromBathymetricData.m |
24 | createGriddedZeuClimatology.m | MATLAB script that 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 MATLAB scripts ncreadBGCandPHYSfromCMEMS.m and ncreadKdFromNASA.m |
25 | createGriddedNPPclimatologyFromCarrAlgorithm.m | MATLAB script that 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 MATLAB scripts ncreadChlaFromNASAandOCCCI.m , ncreadPAR0fromNASA.m and ncreadSSTfromPathfinder.m |
26 | regridZooplanktonConcentrationFromCMIP6.m | MATLAB script called by ncreadZooplanktonFromCMIP6.m |
27 | calculatePAR0fromTrigonometricEquations.m | MATLAB script called by createGriddedPAR0climatology.m |
28 | calculateZeuFromKdAndMLD.m | MATLAB script called by createGriddedZeuClimatology.m |
29 | Carr2002algorithm.m | MATLAB script called by createGriddedNPPclimatologyFromCarrAlgorithm.m |
30 | processSensorDataFromNASA.m | MATLAB script called by ncreadChlaFromNASAandOCCCI.m , ncreadKdFromNASA.m and ncreadPAR0fromNASA.m |
31 | prepareDataForPlotting.m | MATLAB script that creates figures to show monthly climatological data (figures with _monthly_ infix) |
32 | plotCrossSourceComparisonMaps.m | MATLAB script that creates figures to show comparisons of the same variable across datasets (figures with _comparison_ infix) |
33 | submit_zoo_regridding.sh | Bash script that submits MATLAB script regridZooplanktonConcentrationFromCMIP6.m to the SLURM job scheduler |