goesaodc_sampleScanRaster: Sample values from a scan raster

Description Usage Arguments Value Examples

View source: R/goesaodc_sampleScanRaster.R

Description

Sample values from a scan raster

Usage

1
2
3
4
5
6
7
8
9
goesaodc_sampleScanRaster(
  raster = NULL,
  lon = NULL,
  lat = NULL,
  radius = 1,
  method = "simple",
  fun = mean,
  na.rm = FALSE
)

Arguments

raster

RasterLayer with a variable.

lon

Longitude position.

lat

Latitude position.

radius

Radius of a buffer around each point (in meters) from which to extract cell values. If the distance between the sampling point and the center of a cell is less than or equal to the buffer, the cell is included.

method

Method of extracting cell values. If 'simple' values for the cell a point falls in are returned. If 'bilinear' the returned values are interpolated from the values of the four nearest raster cells. Defaults to 'simple'.

fun

Function used to summarize cell values if multiple cells fall within the given radius. Defaults to 'mean'.

na.rm

Logical flag determining whether to remove NA values before summarizing them with 'fun'. Defaults to FALSE.

Value

Numeric value extracted from the raster.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
library(MazamaSatelliteUtils)
setSatelliteDataDir("~/Data/Satellite")

bboxOregon <- c(-125, -116, 42, 46.5)

scanFile <- goesaodc_listScanFiles(
  satID = "G17",
  datetime = "2020-09-08 12:00",
  timezone = "America/Los_Angeles"
)

# Create a raster for a scan file
scanRaster <- goesaodc_createScanRaster(
  filename = scanFile,
  bbox = bboxOregon,
  cellSize = 0.05
)

goesaodc_plotScanRaster(
  scanRaster,
  bbox = bboxOregon
)

goesaodc_sampleScanRaster(
  raster = scanRaster,
  lon = -123,
  lat = 46,
  radius = 10000
)

MazamaScience/MazamaSatelliteUtils documentation built on Dec. 17, 2021, 3:20 a.m.