Standardise longitude values to a selected prime meridian convention
Source:R/nctools_spatial.R
checkLongitude.RdConverts longitude values to either the [-180, 180] convention or the
[0, 360] convention.
Arguments
- x
Numeric vector of longitude values.
- primeMeridian
Character string specifying the target longitude convention. Use
"center"for longitudes in the[-180, 180]range and"left"for longitudes in the[0, 360]range.- sort
Logical. If
TRUE, sort the output values after conversion.- ...
Additional arguments. Currently unused.
Details
Longitude values are modified only when needed. For primeMeridian = "center", values greater than 180 are shifted by subtracting 360. For
primeMeridian = "left", negative values are shifted by adding 360.