isDaylight: Determine whether times are during daylight within a region

Description Usage Arguments Value Examples

View source: R/utils-time.R

Description

Determine whether times are during daylight within a region

Usage

1
isDaylight(datetime = NULL, timezone = "UTC", bbox = bbox_CONUS)

Arguments

datetime

Datetime in any Ymd H [MS] format or POSIXct.

timezone

Timezone used to interpret datetime. Defaults to UTC.

bbox

Bounding box for the region of interest. Defaults to CONUS.

Value

Logical vector.

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
30
31
32
33
34
35
36
37
library(MazamaSatelliteUtils)
library(MazamaSpatialUtils)

setSatelliteDataDir("~/Data/Satellite")

# Example with bbox from country shape
mx <- subset(SimpleCountries, countryCode == "MX")

mx_bbox <- sp::bbox(mx)

isDaylight(
  datetime = "2019-09-06 12",
  bbox = mx_bbox,
  timezone = "UTC"
) 

# Example with bbox from raster::extent()

scanFile <- goesaodc_downloadScanFiles(
  satID = "G16", 
  datetime = "2019-09-06 18:00", 
  timezone = "UTC"
)

raster <- goesaodc_createScanRaster(
  filename = scanFile,
  cellSize = 0.1,
  dqfLevel = 2
)

extent <- raster::extent(raster)

isDaylight(
  datetime = "2019-09-06 12:00",
  bbox = extent,
  timezone = "UTC"
)

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