Lon2Index: Obtain the index of positions for a region in longitudes

Description Usage Arguments Value Examples

View source: R/Lon2Index.R

Description

This auxiliary function returns the index of position of a region of longitudes in a given vector of longitudes.

Usage

1
Lon2Index(lon, lonmin, lonmax)

Arguments

lon

vector of longitudes values.

lonmin

a numeric value indicating the minimum longitude of the region (understand as the left marging of the region).

lonmax

a numeric value indicating the maximum longitude of the region (understand as the right mariging of the region).

Value

the index of positions of all values inside the region in the vector lon.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
lon <- 1 : 360
pos <- Lon2Index(lon, lonmin = -20, lonmax = 20)
lon[pos]
pos <- Lon2Index(lon, lonmin = 340, lonmax = 20)
lon[pos]
lon <- -180 : 180
pos <- Lon2Index(lon, lonmin = -20, lonmax = 20)
lon[pos]
pos <- Lon2Index(lon, lonmin = 340, lonmax = 20)
lon[pos]

ClimProjDiags documentation built on Jan. 7, 2021, 5:10 p.m.