ind_long_lat: Return or the index in ncdf object from lat/longitude or...

ind_long_latR Documentation

Return or the index in ncdf object from lat/longitude or inverse

Description

Return or the index in ncdf object from lat/longitude or reverse.

Usage

ind_long_lat(
  ncdf = stop("The ncdf data must be supplied"),
  long = NULL,
  lat = NULL,
  indice.long = NULL,
  indice.lat = NULL,
  label.longitude = "lon",
  label.latitude = "lat"
)

Arguments

ncdf

An object read from package ncdf4, ncdf or RNetCDF

long

Longitude in decimal format

lat

Latitude in decimal format

indice.long

Index of longitude

indice.lat

Index of latitude

label.longitude

Name of argument for longitude, default is lon

label.latitude

Name of argument for latitude, default is lat

Details

ind_long_lat is used to manage ncdf information

Value

Or the index in ncdf object from lat/longitude or inverse

Author(s)

Marc Girondot marc.girondot@gmail.com

See Also

Other ncdf: format_ncdf()

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)
library("ncdf4")
dta2012 <- nc_open(dest)
indices <- ind_long_lat(ncdf=dta2012, lat=5.89, long=-20.56)
coordinates <- ind_long_lat(ncdf=dta2012, indice.lat=20, indice.long=30)
# library("RNetCDF")
# dta2012 <- open.nc(dest)
# indices <- ind_long_lat(ncdf=dta2012, lat=5.89, long=-20.56)
# coordinates <- ind_long_lat(ncdf=dta2012, indice.lat=20, indice.long=30)
# ncdf library is depreciated in CRAN
# library("ncdf")
# dta2012 <- open.ncdf(dest)
# indices <- ind_long_lat(ncdf=dta2012, lat=5.89, long=-20.56)
# coordinates <- ind_long_lat(ncdf=dta2012, indice.lat=20, indice.long=30)

## End(Not run)

HelpersMG documentation built on Oct. 5, 2023, 5:08 p.m.