Skip to contents

Measures liveness directly, via a real cmr_find_granules() search over a recent lookback window, rather than trusting UMM-C's collection-level ends_at_present flag. That flag's reliability turns out to depend heavily on the provider: a spot-check found PO.DAAC leaves it FALSE on ~95% of its collections (including many demonstrably still-active ones), while LAADS sets it reliably for most of its catalog (see cmr_find_collections()'s docs). This function sidesteps that unreliability by checking real recent granule activity instead.

Usage

cmr_collection_liveness(
  short_name,
  provider = NULL,
  lookback_days = 60,
  delay = 0.2
)

Arguments

short_name

One or more CMR collection short names, as a character vector – or a data.frame/tibble with a short_name column (and optionally a provider column), such as cmr_find_collections()/cmr_all_collections() output. This lets you pipe a filtered collection search straight in, e.g. cmr_all_collections(provider = "POCLOUD") |> dplyr::filter(!ends_at_present) |> cmr_collection_liveness().

provider

Optional CMR provider id(s): a single value applied to every short_name, or a vector the same length as short_name. Ignored (with the data.frame's own provider column used instead) if short_name is a data.frame that has one, unless you pass provider explicitly.

lookback_days

How many days back from today to search for granules. Default 60. Low-cadence collections (annual composites, etc.) can show zero granules in 60 days while still genuinely active – raise this if you suspect that, or cross-check recent_granule_count against the collection's typical production cadence before concluding it's dead.

delay

Seconds to pause between requests when short_name has more than one element. Politeness default, not a documented CMR rate limit; set to 0 to disable.

Value

A tibble::tibble() with one row per short_name: short_name, provider (NA if not supplied), lookback_days, recent_granule_count (subject to cmr_find_granules()'s page_size cap – a count of 2000 may mean "at least 2000", not exactly 2000), and is_live (recent_granule_count > 0).

See also

Other collection functions: cmr_all_collections(), cmr_find_collections()

Examples

# \donttest{
cmr_collection_liveness("MUR-JPL-L4-GLOB-v4.1")
#> # A tibble: 1 × 5
#>   short_name           provider lookback_days recent_granule_count is_live
#>   <chr>                <chr>            <dbl>                <int> <lgl>  
#> 1 MUR-JPL-L4-GLOB-v4.1 NA                  60                   59 TRUE   
cmr_collection_liveness(c("VJ146A4", "MOD021KM"), provider = "LAADS")
#>   (33904 granules across 17 pages)
#> # A tibble: 2 × 5
#>   short_name provider lookback_days recent_granule_count is_live
#>   <chr>      <chr>            <dbl>                <int> <lgl>  
#> 1 VJ146A4    LAADS               60                    0 FALSE  
#> 2 MOD021KM   LAADS               60                33904 TRUE   

# straight from a filtered collection search
cmr_all_collections(provider = "POCLOUD") |>
  dplyr::filter(!ends_at_present, is.na(temporal_end), granule_count > 0) |>
  cmr_collection_liveness()
#> page 1: 982/982 collections fetched
#>   (8678 granules across 5 pages)
#>   (254394 granules across 128 pages)
#>   (6484 granules across 4 pages)
#>   (20664 granules across 11 pages)
#>   (8592 granules across 5 pages)
#>   (8421 granules across 5 pages)
#>   (8664 granules across 5 pages)
#>   (6060 granules across 4 pages)
#>   (143070 granules across 72 pages)
#>   (7878 granules across 4 pages)
#> Warning: retrieved 122 of 123 matching granules (unexpected truncation -- please report this)
#>   (20761 granules across 11 pages)
#>   (8664 granules across 5 pages)
#>   (256664 granules across 129 pages)
#>   (11814 granules across 6 pages)
#>   (4857 granules across 3 pages)
#>   (2116 granules across 2 pages)
#>   (8579 granules across 5 pages)
#>   (8386 granules across 5 pages)
#>   (28688 granules across 15 pages)
#> Warning: retrieved 57 of 60 matching granules (unexpected truncation -- please report this)
#> Warning: retrieved 122 of 123 matching granules (unexpected truncation -- please report this)
#>   (28428 granules across 15 pages)
#>   (8722 granules across 5 pages)
#>   (8722 granules across 5 pages)
#>   (6279 granules across 4 pages)
#>   (6279 granules across 4 pages)
#>   (5661 granules across 3 pages)
#>   (5692 granules across 3 pages)
#> Warning: retrieved 59 of 60 matching granules (unexpected truncation -- please report this)
#>   (3925 granules across 2 pages)
#>   (3925 granules across 2 pages)
#>   (3925 granules across 2 pages)
#> Warning: retrieved 149996 of 258007 matching granules (unexpected truncation -- please report this)
#>   (149996 granules across 75 pages)
#>   (70059 granules across 36 pages)
#>   (70059 granules across 36 pages)
#>   (3924 granules across 2 pages)
#>   (3924 granules across 2 pages)
#>   (6580 granules across 4 pages)
#>   (60154 granules across 31 pages)
#>   (8684 granules across 5 pages)
#>   (58749 granules across 30 pages)
#>   (14318 granules across 8 pages)
#>   (41574 granules across 21 pages)
#>   (6061 granules across 4 pages)
#> # A tibble: 331 × 5
#>    short_name               provider lookback_days recent_granule_count is_live
#>    <chr>                    <chr>            <dbl>                <int> <lgl>  
#>  1 CYGNSS_L1_V3.2           POCLOUD             60                  403 TRUE   
#>  2 MUR-JPL-L4-GLOB-v4.1     POCLOUD             60                   59 TRUE   
#>  3 VIIRS_N20-STAR-L2P-v2.80 POCLOUD             60                 8678 TRUE   
#>  4 SWOT_L2_LR_SSH_2.0       POCLOUD             60                    0 FALSE  
#>  5 SWOT_L2_HR_PIXC_D        POCLOUD             60               254394 TRUE   
#>  6 ASCATB-L2-Coastal        POCLOUD             60                  856 TRUE   
#>  7 ASCATC-L2-Coastal        POCLOUD             60                  855 TRUE   
#>  8 MUR25-JPL-L4-GLOB-v04.2  POCLOUD             60                   59 TRUE   
#>  9 SWOT_L2_LR_SSH_D         POCLOUD             60                 6484 TRUE   
#> 10 MODIS_T-JPL-L2P-v2019.0  POCLOUD             60                20664 TRUE   
#> # ℹ 321 more rows
# }