R/functions.R
project_to_hemisphere.RdGiven a global hemispheric field of view defined by a single latitudinal and longitudinal centroid focal point, project geographic points onto the hemishpere.
project_to_hemisphere(lon, lat, lon0, lat0)
| lon | vector of longitudes. |
|---|---|
| lat | vector of latitudes. |
| lon0 | longitude of focus coordinates. |
| lat0 | latitude of focus coordinates. |
returns a data frame.
project_to_hemisphere identifies whether each pair of coordinates in the lat and lon vectors is in a field of view defined by a centroid focal point (lat0, lon0)
and returns a data frame containing the original coordinates and a column indicating if the coordinates are in the field of view (TRUE or FALSE).
lon <- seq(-180, 180, length.out=60) lat <- rep(seq(-90, 90, length.out=30), 2) project_to_hemisphere(lon, lat , 0, 0)#> # A tibble: 60 x 3 #> lon lat inview #> <dbl> <dbl> <lgl> #> 1 -180 -90 FALSE #> 2 -174. -83.8 FALSE #> 3 -168. -77.6 FALSE #> 4 -162. -71.4 FALSE #> 5 -156. -65.2 FALSE #> 6 -149. -59.0 FALSE #> 7 -143. -52.8 FALSE #> 8 -137. -46.6 FALSE #> 9 -131. -40.3 FALSE #> 10 -125. -34.1 FALSE #> # ... with 50 more rows