Learn R Programming

HelpersMG (version 6.2)

format_ncdf: Return an array with ncdf data

Description

Return a list with two elements: data is an array and time is the POSIX.lt time.
Or if label.time is NULL or if bathy is TRUE, a bathy object.
If varid is NULL, it shows the available variable and dimensions of the file.
Bathymetry data can be download here:
https://www.gebco.net/data_and_products/gridded_bathymetry_data/#global

Usage

format_ncdf(
  ncdf,
  label.latitude = "latitude",
  label.longitude = "longitude",
  label.time = "time",
  varid = NULL,
  longitude1 = NA,
  latitude1 = NA,
  longitude2 = NA,
  latitude2 = NA,
  package = "ncdf4",
  bathy = TRUE
)

Value

A list with two element: data is an array and time is the POSIX.lt time

Arguments

ncdf

An object read from package ncdf4 or a file name of ncdf file

label.latitude

Label of latitude

label.longitude

Label of longitude

label.time

Label of time

varid

Name of variable to extract

longitude1

Longitude for first corner

latitude1

latitude for first corner

longitude2

Longitude for second corner

latitude2

latitude for second corner

package

If ncdf is a file, give the package to use to open the file

bathy

If TRUE, return a bathy object

Author

Marc Girondot marc.girondot@gmail.com

Details

format_ncdf is used extract information from ncdf file

See Also

Other ncdf: ind_long_lat()

Examples

Run this code
if (FALSE) {
url <- "https://downloads.psl.noaa.gov/Datasets/noaa.oisst.v2.highres/"
url <- paste0(url, "sst.day.mean.2012.v2.nc")
dest <- paste(Sys.getenv("HOME"), "/sst.day.mean.2012.v2.nc", sep="")
download.file(url, dest)
format_ncdf(dest)
}

Run the code above in your browser using DataLab