Skip to contents

For each s2_cell location and Date vector, the intersections with NOAA's HMS daily smoke polygons (see ?get_daily_smoke_data) are calculated. By default, intersecting plumes are summarized as the maximum intensity ("Light", "Medium", "Heavy"). They can instead be summed using scores of 0 for "None", 1 for "Light", 2 for "Medium", and 3 for "Heavy", or returned without summarization.

Usage

get_smoke_summary(x, summary = c("max", "sum", "none"), ...)

Arguments

x

a s2_cell_dates vector (see ?s2cd)

summary

how to summarize intersecting smoke plumes. "max" returns the maximum density, "sum" adds density scores, and "none" returns every intersecting density.

...

passed to get_daily_smoke_data() and then stow::stow().

Value

For summary = "max", a list of ordered factors with one value per location-date. For summary = "sum", a list of numeric vectors with one score per location-date. For summary = "none", a list per location of lists per date containing one ordered factor value per intersecting plume. Dates without intersecting plumes return "None", 0, or an empty ordered factor, respectively.

Examples

local({
  withr::local_envvar(
    R_USER_DATA_DIR = fs::path_package("geomarker", "gmrkr--8841"),
    R_GEOMARKER_NO_DOWNLOAD = "true"
  )
  x <- s2cd(
    s2::as_s2_cell(c("8841b39a7c46e25f", "8841a45555555555")),
    dates = list(
      as.Date(c("2024-05-18", "2024-11-06")),
      as.Date(c("2024-06-22", "2024-08-15", "2024-12-30"))
    )
  )
  print(get_smoke_summary(x))
  print(get_smoke_summary(x, summary = "sum"))
  print(get_smoke_summary(x, summary = "none"))
})
#> Using managed local copy: /home/runner/work/_temp/Library/geomarker/gmrkr--8841/R/geomarker/stow/get_daily_smoke_data/a0b2082e826a56a9--hms_smoke20240518.zip
#> Using managed local copy: /home/runner/work/_temp/Library/geomarker/gmrkr--8841/R/geomarker/stow/get_daily_smoke_data/15f8a259cae46360--hms_smoke20241106.zip
#> Using managed local copy: /home/runner/work/_temp/Library/geomarker/gmrkr--8841/R/geomarker/stow/get_daily_smoke_data/2c9288e9e94a0205--hms_smoke20240622.zip
#> Using managed local copy: /home/runner/work/_temp/Library/geomarker/gmrkr--8841/R/geomarker/stow/get_daily_smoke_data/ea006890b27f4395--hms_smoke20240815.zip
#> Using managed local copy: /home/runner/work/_temp/Library/geomarker/gmrkr--8841/R/geomarker/stow/get_daily_smoke_data/7c21804231dc2ea8--hms_smoke20241230.zip
#> [[1]]
#> 2024-05-18 2024-11-06 
#>      Light       None 
#> Levels: None < Light < Medium < Heavy
#> 
#> [[2]]
#> 2024-06-22 2024-08-15 2024-12-30 
#>      Light      Light       None 
#> Levels: None < Light < Medium < Heavy
#> 
#> Using managed local copy: /home/runner/work/_temp/Library/geomarker/gmrkr--8841/R/geomarker/stow/get_daily_smoke_data/a0b2082e826a56a9--hms_smoke20240518.zip
#> Using managed local copy: /home/runner/work/_temp/Library/geomarker/gmrkr--8841/R/geomarker/stow/get_daily_smoke_data/15f8a259cae46360--hms_smoke20241106.zip
#> Using managed local copy: /home/runner/work/_temp/Library/geomarker/gmrkr--8841/R/geomarker/stow/get_daily_smoke_data/2c9288e9e94a0205--hms_smoke20240622.zip
#> Using managed local copy: /home/runner/work/_temp/Library/geomarker/gmrkr--8841/R/geomarker/stow/get_daily_smoke_data/ea006890b27f4395--hms_smoke20240815.zip
#> Using managed local copy: /home/runner/work/_temp/Library/geomarker/gmrkr--8841/R/geomarker/stow/get_daily_smoke_data/7c21804231dc2ea8--hms_smoke20241230.zip
#> [[1]]
#> 2024-05-18 2024-11-06 
#>          1          0 
#> 
#> [[2]]
#> 2024-06-22 2024-08-15 2024-12-30 
#>          2          2          0 
#> 
#> Using managed local copy: /home/runner/work/_temp/Library/geomarker/gmrkr--8841/R/geomarker/stow/get_daily_smoke_data/a0b2082e826a56a9--hms_smoke20240518.zip
#> Using managed local copy: /home/runner/work/_temp/Library/geomarker/gmrkr--8841/R/geomarker/stow/get_daily_smoke_data/15f8a259cae46360--hms_smoke20241106.zip
#> Using managed local copy: /home/runner/work/_temp/Library/geomarker/gmrkr--8841/R/geomarker/stow/get_daily_smoke_data/2c9288e9e94a0205--hms_smoke20240622.zip
#> Using managed local copy: /home/runner/work/_temp/Library/geomarker/gmrkr--8841/R/geomarker/stow/get_daily_smoke_data/ea006890b27f4395--hms_smoke20240815.zip
#> Using managed local copy: /home/runner/work/_temp/Library/geomarker/gmrkr--8841/R/geomarker/stow/get_daily_smoke_data/7c21804231dc2ea8--hms_smoke20241230.zip
#> [[1]]
#> [[1]]$`2024-05-18`
#> [1] Light
#> Levels: None < Light < Medium < Heavy
#> 
#> [[1]]$`2024-11-06`
#> ordered()
#> Levels: None < Light < Medium < Heavy
#> 
#> 
#> [[2]]
#> [[2]]$`2024-06-22`
#> [1] Light Light
#> Levels: None < Light < Medium < Heavy
#> 
#> [[2]]$`2024-08-15`
#> [1] Light Light
#> Levels: None < Light < Medium < Heavy
#> 
#> [[2]]$`2024-12-30`
#> ordered()
#> Levels: None < Light < Medium < Heavy
#> 
#>