Description Usage Arguments Value Examples
This function computes distances between an arbitrary number of points on the globe
1 | compute_dist(lon, lat, lon0, lat0, Rearth = 6371)
|
lon,lat |
points from which distance is measured (in degree) |
lon0,lat0 |
points to which distance is measured (in degree) |
Rearth |
Earth's radius (defaults to 6371km) |
Distance between points in km
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | ## read in some netcdf data
tas <- readNetCDF(system.file("extdata", "annual_CRUTEMv3_1961-90.nc", package="geoutils"), varname="temp")
lons <- attr(tas, 'lon')
lats <- attr(tas, 'lat')
## compute distance from greenwich
gdist <- compute_dist(lons, lats, 0, 50)
## set up new netcdf object for plotting
gdist <- as.matrix(gdist)
class(gdist) <- 'NetCDF'
attr(gdist, 'lon') <- lons
attr(gdist, 'lat') <- lats
## plot the distances
plot(gdist, type='mean', ti=1)
map(add=T, interior=F)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.