This project provides a set of functions for processing NetCDF files, specifically for cropping and analyzing ocean color data using the GSM (Global Solar Maps) method. The main functionalities include cropping NetCDF files to specified geographical bounds and processing them to obtain chlorophyll concentrations.
Simon Oiry
- GSM_Update.Rmd: An R Markdown file containing the scripts and functions necessary for processing the data.
The following R packages are required:
ncdf4
tidyverse
terra
qchlorophyll
oceancolouR
parallel
tictoc
To install the required packages, you can use the following commands in R:
install.packages(c("ncdf4", "tidyverse", "terra", "qchlorophyll", "parallel", "tictoc"))
# For oceancolouR, install from GitHub
remotes::install_github("BIO-RSG/oceancolouR", build_vignettes = TRUE)
This function crops NetCDF files to specified geographical boundaries.
Arguments:
path
: Path to the directory containing NetCDF files.xmin
,xmax
,ymin
,ymax
: Geographical bounds for cropping.saveNC
: Logical, whether to save the cropped files as NetCDF.
This function processes the cropped images to generate chlorophyll maps.
Arguments:
path
: Path to the directory containing cropped TIFF files.lower_bounds
,upper_bounds
: Bounds for the GSM function.lambda
: Wavelengths used by the GSM function.
This function handles the entire processing pipeline, from cropping to generating chlorophyll maps.
Arguments:
path
: Path to the directory containing raw NetCDF files.path_cropped
: Path to the directory for saving cropped TIFF files.lower_bounds
,upper_bounds
,lambda
: Parameters for the GSM function.xmin
,xmax
,ymin
,ymax
: Geographical bounds for cropping.saveNC
: Logical, whether to save the cropped files as NetCDF.
To use the batch processing function, you can run the following command in R:
Batch_processing(path ="Data/CCI_v5/NC")
path
: Path location of raw NetCDF files. (default =Data/CCI_v5/NC
)path_cropped
: Path location of cropped TIFF files. (default =Data/CCI_v5/Cropped_TIF
)xmin
: Minimum longitude to crop the image. (default =-180
)xmax
: Maximum longitude to crop the image. (default =180
)ymin
: Minimum latitude to crop the image. (default =64
)ymax
: Maximum latitude to crop the image. (default =90
)saveNC
: Logical, whether to save NetCDF files at the cropping step. (default =FALSE
)lower_bounds
: Lower bounds used by the GSM function. (default =c(0, 0.0001, 0.0001)
)upper_bounds
: Upper bounds used by the GSM function. (default =c(64, 2, 0.1)
)lambda
: Wavelengths used by the GSM function. (default =c(412, 443, 490, 510, 560, 665)
)
Specify the license under which the project is distributed.