Learn R Programming

phenology (version 3.57)

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

Description

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

Usage

ind_long_lat(ncdf = stop("The ncdf data must be supplied"), long = NA,
  lat = NA, indice.long = NA, indice.lat = NA)

Arguments

ncdf
a ncdf object
long
longitude in decimal format
lat
latitude in decimal format
indice.long
Index of longitude
indice.lat
Index of latitude

Value

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

Details

ind_long_lat is used to manage ncdf information

Examples

Run this code
url <- "ftp://ftp.cdc.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(paste(Sys.getenv("HOME"), "/sst.day.mean.2012.v2.nc", sep=""))
indices <- ind_long_lat(ncdf=dta2012, lat=5.89, long=-20.56)
coordinates <- ind_long_lat(ncdf=dta2012, indice.lat=20, indice.long=30)

Run the code above in your browser using DataLab