The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.

Getting started with TSGenerator 2.0

Scope

TSGenerator 2.0 focuses on currently supported Copernicus HR-VPP Seasonal Trajectories (ST) and Vegetation Phenology and Productivity (VPP). Its core is native R: hdar for WEkEO acquisition and terra for geospatial processing.

The recommended workflow is:

  1. diagnose WEkEO access;
  2. preview/download ST or VPP;
  3. extract polygon-level values;
  4. assess product quality and temporal completeness separately;
  5. optionally impute user/raw series;
  6. model temporal missingness when required.

WEkEO configuration

The offline diagnostic is safe to run during package checks. Online authentication is intentionally not evaluated when the vignette is built because it requires an active Internet connection, the external WEkEO service, and valid user credentials. WEkEO service availability is outside the control of TSGenerator; offline processing and package checks do not depend on it.

check_wekeo()
#> TSGenerator WEkEO acquisition diagnostics
#>             check    ok
#>                 R  TRUE
#>              hdar  TRUE
#>          jsonlite  TRUE
#>  credentials_file FALSE
#>                                                             detail
#>                                                              4.7.0
#>                                                              1.0.7
#>                                                              2.0.0
#>  ~/.hdarc not found (credentials may still be supplied explicitly)
check_wekeo(online = TRUE)

Use hda_client() when credentials need to be supplied explicitly. TSGenerator does not require Python or reticulate for ST/VPP acquisition.

ST acquisition and extraction

WEkEO catalogue queries and downloads are shown but not executed while building the vignette.

st <- download_st(
  start = "2020-04-01",
  end = "2020-04-30",
  tile_id = "30TXM",
  product = c("PPI", "QFLAG"),
  download = FALSE
)

After downloading PPI GeoTIFFs, extract a parcel statistic:

st_ts <- extract_ts(
  x = "HRVPP_ST/PPI",
  polygons = parcels,
  id_col = "Parcel_ID",
  fun = "median"
)

extract_ts() returns tidy records and does not use row names as polygon identifiers.

VPP acquisition and extraction

vpp <- download_vpp(
  start = "2020-01-01",
  end = "2020-12-31",
  tile_id = "30TXM",
  product = c("SOSD", "MAXD", "EOSD", "LENGTH", "MAXV"),
  season = "s1",
  download = FALSE
)
vpp_values <- extract_vpp(
  x = "HRVPP_VPP",
  polygons = parcels,
  id_col = "Parcel_ID",
  fun = "median"
)

extract_vpp() applies product-aware interpretation: date products are represented as dates, whereas spectral/productivity metrics remain numeric with their appropriate units/scaling.

Product quality versus temporal completeness

These are different concepts. Quality definitions are local package data and can be inspected without network access.

quality_info("ST")
#>   Code                  Class Rank AcceptDefault
#> 1    0                No data    0         FALSE
#> 2    1 Filled - extrapolation    1         FALSE
#> 3    2 Filled - interpolation    2         FALSE
#> 4    3                    Low    3          TRUE
#> 5    4                 Medium    4          TRUE
#> 6    5                   High    5          TRUE
#>                                                       Definition
#> 1                                  Time series was not processed
#> 2    Clear-sky observation on one side outside the 91-day window
#> 3 Clear-sky observations on both sides outside the 91-day window
#> 4           1-2 clear-sky land observations in the 91-day window
#> 5           3-8 clear-sky land observations in the 91-day window
#> 6   More than 8 clear-sky land observations in the 91-day window
quality_info("VPP")
#>    Code           Class Rank AcceptDefault
#> 1     0         No data    0         FALSE
#> 2     1 No season found    0         FALSE
#> 3     2          Filled    1         FALSE
#> 4     3        Reserved   NA         FALSE
#> 5     4             Low    2         FALSE
#> 6     5             Low    2         FALSE
#> 7     6             Low    2         FALSE
#> 8     7          Medium    3          TRUE
#> 9     8          Medium    3          TRUE
#> 10    9          Medium    3          TRUE
#> 11   10            High    4          TRUE
#>                                                                       Definition
#> 1                                                  Time series was not processed
#> 2                         No season found although the time series was processed
#> 3     Insufficient clear-sky observations in green-up, green-down and green-peak
#> 4                                                                       Reserved
#> 5                           More than 2 clear-sky observations during green-down
#> 6                           More than 2 clear-sky observations during green-peak
#> 7                             More than 2 clear-sky observations during green-up
#> 8              More than 2 clear-sky observations during green-up and green-peak
#> 9              More than 2 clear-sky observations during green-up and green-down
#> 10           More than 2 clear-sky observations during green-peak and green-down
#> 11 More than 2 clear-sky observations during green-up, green-down and green-peak

Use mask_quality() only when masking is scientifically appropriate. QFLAG is categorical and is not automatically resampled.

For temporal completeness, the following self-contained example distinguishes an expected date absent from the table from a present date whose value is NA.

example_ts <- data.frame(
  ID = c("A", "A", "A", "B", "B", "B"),
  Date = as.Date(c(
    "2020-04-01", "2020-04-11", "2020-05-01",
    "2020-04-01", "2020-04-11", "2020-04-21"
  )),
  Value = c(0.22, NA, 0.61, 0.18, 0.35, 0.52)
)

plan <- temporal_plan(example_ts, expected_step = 10)
summarize_missingness(plan)
#>   ID      start        end expected_step_days n_expected n_observed_dates
#> 1  A 2020-04-01 2020-05-01                 10          4                3
#> 2  B 2020-04-01 2020-04-21                 10          3                3
#>   n_absent_dates n_value_na n_usable date_completeness value_completeness
#> 1              1          1        2              0.75                0.5
#> 2              0          0        3              1.00                1.0
#>   missing_fraction
#> 1              0.5
#> 2              0.0
assess_ts_quality(plan)
#> TSGenerator time-series quality assessment
#> Rows:     2
#> Windows:  full series
#> 
#> Very low      Low   Medium     High 
#>        0        1        0        1

Imputation policy

Imputation is optional and explicit. This example uses only base-R linear interpolation and does not require an external service or optional package.

imputed <- impute_ts(
  example_ts,
  method = "linear",
  series_type = "user",
  complete_grid = TRUE,
  expected_step = 10,
  max_gap = 2
)
imputed
#> TSGenerator imputed time series
#> Method:      linear
#> Series type: user
#> Rows:        7
#> Imputed:     2 values

Because ST is already temporally processed, TSGenerator blocks routine ST re-imputation unless allow_processed = TRUE is deliberately specified.

Live integration check

Live integration checks are release/maintenance diagnostics and are never executed while CRAN builds this vignette.

z <- check_wekeo_integration(download = FALSE)
print(z)
stopifnot(z$ok)

A controlled download = TRUE smoke test can additionally verify that returned GeoTIFFs are readable by terra.

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.