Description Usage Arguments Value Author(s) Examples
We insert lat and lon coordinates (note the order: not lon and lat) and provide grid information as parameter 'grid'. 'grid' is a nested list, which contains sub-lists denoted as 'lon' and 'lat'. The sub-list 'lon' has to contain numeric values denoted as 'lonw' (westerly boundary of the grid), 'lone' (easterly boundary of the grid), and 'dlon' (delta-longitude; distance between two grid cells). The sub-list 'lat' has to contain numeric values denoted as 'latn' (northern boundary of the grid), 'lats' (southern boundary of the grid), 'dlat' (delta-latitude), and 'nlat' (the number of grid cells in latitudal direction). THE ORIGIN OF THE GRID IS CONSIDERED TO BE IN THE TOP LEFT CORNER.
1 | latlon2cell(lat, lon, grid)
|
lat |
numeric (single value or 1d array); latitude coordinate |
lon |
numeric (single value or 1d array); longitude coordinate |
grid |
grid definition (see description or example for structure) |
list('x'=..., 'y'=...); list of x- and y-coordinates of the grid cells
Daniel Neumann, daniel.neumann@io-warnemuende.de
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | # grid definition
grid <- list(lon = list(lonw=-5.0, lone=10.0, dlon=0.5),
lat = list(lats=49.0, latn=65.0, dlat=0.5, nlat=(65.0-49.0)/0.5))
# OR
# grid <- get.infos.grids.hbm.basic()$coarse
# some coordinates
lon <- c(-4.9, -4.1, 5.6)
lat <- c(64.9, 64.9, 53.2)
# get grid cells
grid_cells <- latlon2cell(lat, lon, grid)
# result should be:
# - grid_cells$x: 1, 2, 22
# - grid_cells$y: 1, 1, 24
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.