Get_Bottom_WOA: Download near-bottom climatology data from World Ocean Atlas

View source: R/Get_Bottom_WOA.R

Get_Bottom_WOAR Documentation

Download near-bottom climatology data from World Ocean Atlas

Description

Download and near-bottom climatology data from Nationa Oceanographic Data Center (NODC) World Ocean Atlas 2013 or Regional Climatology and then convert to a raster object

Usage

Get_Bottom_WOA(url, x = NULL, outdir = NULL, plot = FALSE)

Arguments

url

A character string naming the URL of a CSV file to be downloaded

x

Raster* object defining the spatial extent, resolution and projection of climatology data to be retrived. If not provide, returning full data set.

outdir

output directory to write raster file

plot

Logical, whether or not to plot the output raster

Details

This function dowloads the near-bottom climatology from http://www.nodc.noaa.gov/OC5/woa13/woa13data.html or http://www.nodc.noaa.gov/OC5/regional_climate/. The global or regional climatology data at standard depths will be download but only the near-bottom data are retained based on a template raster object.

Value

a raster object

Author(s)

Chih-Lin Wei <chihlinwei@gmail.com>

Examples

# Raster template of Canadian Arctic
data(tmp)

# Download January temperature data as example
Get_Bottom_WOA("https://www.ncei.noaa.gov/data/oceans/woa/WOA18/DATA/temperature/csv/decav/0.25/woa18_decav_t01an04.csv.gz", 
tmp, plot=TRUE) 

#Download monthly near-bottom temperature
urls <- paste("https://www.ncei.noaa.gov/data/oceans/woa/WOA18/DATA/temperature/csv/decav/0.25/woa18_decav_t", 
              c(paste(0, 1:9, sep=""), 10:12), "an04.csv", sep="")

# Raster template of Canadian Arctic
data(tmp)

# Create a fold to save raster file
folder <- "../Arctic_ocean_data/Climatology2" 
dir.create(folder)

library(foreach)
library(doSNOW)

cl<-makeCluster(4) # change 4 to your number of CPU cores
registerDoSNOW(cl) # register the SNOW parallel backend with the foreach package
foreach(i=urls, .packages="OceanData", .export = "urls") %dopar% Get_Bottom_WOA(i, tmp, folder)
stopCluster(cl) # stop a SNOW cluster

chihlinwei/OceanData documentation built on Sept. 26, 2022, 2:47 p.m.