format_ncdf: Return an array with ncdf data

View source: R/format_ncdf.R

format_ncdfR Documentation

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
)

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

Details

format_ncdf is used extract information from ncdf file

Value

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

Author(s)

Marc Girondot marc.girondot@gmail.com

See Also

Other ncdf: ind_long_lat()

Examples

## Not run: 
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)

## End(Not run)

HelpersMG documentation built on Sept. 12, 2024, 9:35 a.m.