/oceancolouR

Package of custom functions for remote sensing data analysis

Primary LanguageRGNU General Public License v3.0GPL-3.0

oceancolouR

This is a collection of frequently used R functions for Ocean Colour Remote Sensing data processing and analysis. This package is in continuing development, but the following list details some (not all) of the functions included.

Chlorophyll-a algorithms:

Frequently used chlorophyll-a algorithms have been added on an as-needed basis. Currently the following are implemented in oceancolouR for some sensors: gsm() ocx() oci() qaa() eof-chl() and hu()

Click here to expand chl-a algorithm details

Sensors available and tested here are MODIS-Aqua 🟦 , SNPP-VIIRS 🟨, SeaWiFS 🟩, Landsat-8 OLI ⬛ , Sentinel-2 MSI 🟪 , or sensor-independent 🟧

  • gsm(): 🟦🟨🟩 R implementation of the GSM algorithm, with traditional coefficients or coefficients calculated with get_gs()
  • ocx() : 🟦🟨🟩⬛🟪 OCX algorithm. OCX coefficients can be optimized with optimize_ocx_coefs()
  • qaa(): 🟩 QAA algorithm (v6) to calculate chlorophyll-a as well as phytoplankton absorption coefficients
  • eof_chl(): EOF (empirical orthogonal function) method to calculate chlorophyll-a (requires sensor and region-dependent training set as input)
  • hu() : 🟧 Hu algorithm
  • oci() : 🟦🟨🟩 OCI algorithm. R implementation of NASA Ocean Biology Processing Group's standard chlorophyll-a product in ocean colour satellite images. For information on standard equations for all sensors see the chlor_a data product page (and for Sentinel-3 OLCI see here)

Binned data functions:

  • read_pixEx(): load output file of SNAP pixEx pixel extraction tool as data.frame
  • read_h5_L3b() and read_h5_L3b_names(): read the contents of a NASA Level-3 binned file in h5 format
  • binlatlon(): calculate NASA L3bin numbers, latitudes and longitudes for various spatial resolutions (see ?gen_nrows for list of accepted spatial resolution strings)

Date functions:

  • week8(), week8_date(): convert to/from standard 8-day week number and date
  • dategrp(): Similar to week8() but for any number of days
  • days_vector(): list julian days for a given year/month
  • get_season(): get season from date, with 4 seasonal definitions available (see ?get_season)

Statistics and plotting:

  • plot_swath(): quickly plot the boundary of a satellite swath to see where it's located on the global map
  • nc_image_stats(): check the percent coverage for a variable within lat/lon boundaries
  • filtered_mean(): calculate the filtered mean (as in Bailey and Werdell, 2006)
  • geoMean(), geoSD(): calculate geometric mean and geometric standard deviation factor
  • haversine(): calculate haversine distance between two points
  • rmse(): Root mean square error
  • sparkle_fill(): fill small gaps (e.g. Moiré pattern) by defining a minimum number of neighbours
  • dms_to_deg() and deg_to_dms() or deg_to_dm(): Convert degrees-minutes or degrees-minutes-seconds to decimal degrees and vice-versa

How to install

remotes::install_github("BIO-RSG/oceancolouR", build_vignettes = TRUE)
#devtools::install_github("BIO-RSG/oceancolouR", build_vignettes = TRUE)

Vignette

To access the vignette in RStudio, type the following in the console:

vignette(topic="introduction", package="oceancolouR")

Datasets

There are numeric vectors of the coordinates used in NASA binned images subset to the Pan-Canadian grid including the Northwest Atlantic, Northeast Pacific and Gulf of Saint Lawrence (approximate boundaries defined below in decimal degrees). The bin numbers and their corresponding latitudes, longitudes, and bathymetry values are included at both 4km and 9km resolution.

* Pan-Canadian grid (pancan):      -147 to -41, 39 to 86  
* Northwest Atlantic (nwa):       -95 to -42, 39 to 82  
* Northeast Pacific (nep):        -140 to -122, 46 to 60  
* Gulf of Saint Lawrence (gosl):  -75 to -49, 41 to 53  

Datasets can be loaded using the following command:
data("region_variable_resolution")
where:
region is either pancan, nwa, nep, or gosl
variable is either bins, lats, lons, or bath
resolution is either 4km or 9km

References and links

EOF:
Laliberté, Julien & Larouche, Pierre & Devred, Emmanuel & Craig, Susanne. (2018). Chlorophyll-a Concentration Retrieval in the Optically Complex Waters of the St. Lawrence Estuary and Gulf Using Principal Component Analysis. Remote Sensing. 10. 10.3390/rs10020265.

GSM:
Maritorena, Stephane & Siegel, David & Peterson, Alan. (2002). Optimization of a semianalytical ocean color model for global-scale application. Applied optics. 41. 2705-14. 10.1364/AO.41.002705.

OCI:
Hu, Chuanmin & Lee, Zhongping & Franz, Bryan. (2012). Chlorophyll a algorithms for oligotrophic oceans: A novel approach based on three-band reflectance difference. Journal of Geophysical Research. 117. C01011. 10.1029/2011JC007395.

Hu, C., Feng, L., Lee, Z., Franz, B. A., Bailey, S. W., Werdell, P. J., & Proctor, C. W. (2019). Improving satellite global chlorophyll a data products through algorithm refinement and data recovery. Journal of Geophysical Research: Oceans, 124, 1524– 1543. https://doi.org/10.1029/2019JC014941

OCx:
O'Reilly, John & Maritorena, S. & Mitchell, B.G. & Siegel, David & Carder, Kendall & Garver, S.A. & Kahru, Mati & Mcclain, Charles. (1998). Ocean color chlorophyll algorithms for SeaWiFS. Journal of Geophysical Research. 103. 937-953. 10.1029/98JC02160.

QAA:
Lee, Zhongping & Carder, Kendall & Arnone, Robert. (2002). Deriving Inherent Optical Properties from Water Color: a Multiband Quasi-Analytical Algorithm for Optically Deep Waters. Applied optics. 41. 5755-72. 10.1364/AO.41.005755.

Regional tuning for OCx (POLY4), GSM (GSM_GC, GSM_GS):
Clay, S.; Pena, A.; DeTracey, B.; Devred, E. Evaluation of Satellite-Based Algorithms to Retrieve Chlorophyll-a Concentration in the Canadian Atlantic and Pacific Oceans. Remote Sens. 2019, 11, 2609.

In situ matchups and filtered mean: Bailey, Sean & Werdell, Jeremy. (2006). A multi-sensor approach for the on-orbit validation of ocean color satellite data products. Remote Sensing of Environment. 102. 12-23. 10.1016/j.rse.2006.01.015.

Integerized Sinusoidal Binning Scheme:
https://oceancolor.gsfc.nasa.gov/docs/format/l3bins/