TSGenerator

TSGenerator 2.0 logo

CRAN version Zenodo DOI MIT License R CMD check

WEkEO data access (not an endorsement) Copernicus data source (not an endorsement)

TSGenerator 2.0 is an R package for acquiring, extracting, quality-assessing, and analysing Copernicus HR-VPP Seasonal Trajectories (ST) and Vegetation Phenology and Productivity (VPP) products.

The 2.0 architecture is built around three explicit components:

Python/reticulate, raster, the discontinued VI workflow, and the old QFLAG2 preprocessing chain are not part of the 2.0 core.

Unified Shiny application

TSGenerator 2.0 includes a single integrated graphical workflow for users who prefer not to program directly:

library(TSGenerator)
runTSapp()

The application follows Acquire → Prepare/Extract → Quality → Analyze → Export and calls the same public R API used in scripts. Results & Export records available session outputs, acquisition provenance, reproducible R code, and session information. Selected historical mini-apps remain temporarily callable for compatibility, while discontinued VI/QFLAG2 interfaces are blocked.

Installation

Install the stable release from CRAN:

install.packages("TSGenerator")

For development versions, install from the GitHub development branch:

install.packages("remotes")
remotes::install_github("avalero92/TSGenerator", ref = "cran-preparation")

A WEkEO account is required only for online ST/VPP searches and downloads. These operations also require an active Internet connection and depend on the availability of the external WEkEO service, which is outside the control of TSGenerator. Credentials can be supplied to hda_client() or managed by hdar through ~/.hdarc. Offline processing, local diagnostics, and package checks do not require WEkEO access.

Quick start

1. Check WEkEO

library(TSGenerator)

check_wekeo()
# For a live authenticated diagnostic:
# check_wekeo(online = TRUE)

2. Preview or download ST

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

# Set download = TRUE and output_dir = "HRVPP_ST" to download.

download_st() uses the current HR-VPP ST dataset and supports PPI and ST-QFLAG. Long requests are divided into service-compatible temporal windows.

3. Preview or download VPP

vpp_search <- download_vpp(
  start = "2020-01-01",
  end = "2020-12-31",
  tile_id = "30TXM",
  product = c("SOSD", "MAXD", "EOSD", "LENGTH"),
  season = "s1",
  download = FALSE
)

VPP metadata and scaling are handled by product. Date parameters such as SOSD/MAXD/EOSD are not treated like spectral or productivity values.

Geospatial extraction

ST time series

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

The result is a tidy tsg_time_series with ID, Date, Layer, and Value. extract_ts() validates polygon IDs and CRS and preserves the source raster grid.

VPP parameters

vpp <- extract_vpp(
  x = "HRVPP_VPP",
  polygons = parcels,
  id_col = "Parcel_ID",
  fun = "median"
)

The result identifies Year, Season, Product, Unit, and source Layer. Date products populate Date; numeric products populate Value.

Product quality

Copernicus product quality is deliberately separate from temporal completeness.

quality_info("ST")
quality_info("VPP")

q_summary <- summarize_quality(qflag, type = "ST")

st_masked <- mask_quality(
  x = st_raster,
  quality = qflag_raster,
  type = "ST",
  min_quality = 4
)

Quality flags are categorical. TSGenerator does not bilinearly resample QFLAG rasters.

Time-series completeness

plan <- temporal_plan(
  st_ts,
  expected_step = 10
)

missing <- summarize_missingness(plan)
quality <- assess_ts_quality(plan)

summarize_missingness() distinguishes absent expected dates from explicit NA values. assess_ts_quality() classifies completeness; its classes are TSGenerator diagnostics and must not be confused with Copernicus QFLAG classes.

Optional imputation

completed <- impute_ts(
  user_series,
  method = "linear",
  series_type = "user",
  complete_grid = TRUE,
  expected_step = 10,
  max_gap = 2
)

ST is already temporally processed, so additional ST imputation is blocked by default. It requires the explicit allow_processed = TRUE override when scientifically justified.

Missingness modelling

fit <- model_missingness(
  missingness_data,
  year_col = "Year",
  doy_col = "DOY",
  value_col = "Value"
)

plot_missingness(fit)

The 2.0 API separates the GAM model from plotting. Year is categorical by default and DOY can use a cyclic smooth.

Main 2.0 API

Module Functions
WEkEO hda_client(), check_wekeo(), check_wekeo_integration()
Acquisition download_st(), download_vpp()
Geospatial geospatial_plan(), extract_ts(), extract_vpp()
Product quality quality_info(), classify_quality(), summarize_quality(), mask_quality()
Temporal quality temporal_plan(), summarize_missingness(), assess_ts_quality()
Imputation impute_ts()
Diagnostics model_missingness(), plot_missingness()
Apps runTSapp()

Migrating from TSGenerator 1.x

The principal replacements are:

TSGenerator 1.x TSGenerator 2.0
Download.STPPI() download_st()
Download.HRVPP() download_vpp()
get.Series.mean() extract_ts(..., fun = "mean")
get.Series.median() extract_ts(..., fun = "median")
get.Series.VPP() extract_vpp()
QFLAG2.Mask() mask_quality() for current ST/VPP QFLAG
quality.Series() assess_ts_quality()
general.Quality() assess_ts_quality()
count_missing() summarize_missingness()
TsImpute() impute_ts()
GAM.missing() / GAM.plot() model_missingness() / plot_missingness()

The old VI/QFLAG2 workflow (Download.VI(), get.Stack(), get.Clean.IV(), renames.image.IV()) is legacy-only because it targets discontinued products/workflows. Historical source is retained under legacy/ for traceability, not as the recommended 2.0 workflow.

See vignette("migration-1x-to-2x", package = "TSGenerator") after installation for the detailed migration guide.

Validation before release

The development branch includes offline tests and an opt-in live WEkEO integration harness. Maintainers should run:

devtools::document()
testthat::test_local()
devtools::check(document = FALSE, manual = FALSE)

check_wekeo(online = TRUE)
z <- check_wekeo_integration(download = FALSE)
stopifnot(z$ok)

A controlled real-download smoke test should also be completed before a release candidate.

Vignettes

Authors and affiliations

Contact

Alexey Valero-Jorge — avalero@cita-aragon.es

Citation and DOI

Current maintenance version: 2.0.1. Cite the archived software release using its version-specific Zenodo DOI:

Valero-Jorge, A., Casterad Seral, M. A., & Alcalá Nalvaiz, J.-T. (2026). TSGenerator 2.0.1: Tools for Copernicus HR-VPP Vegetation Time-Series Processing (Version 2.0.1) [Computer software]. Zenodo. https://doi.org/10.5281/zenodo.23620160

TSGenerator 2.0.1 DOI

GitHub release: https://github.com/avalero92/TSGenerator/releases/tag/v2.0.1

Historical citation — TSGenerator 2.0.0:

Valero-Jorge, A., Casterad Seral, M. A., & Alcalá Nalvaiz, J.-T. (2026). TSGenerator 2.0.0: Tools for Copernicus HR-VPP Vegetation Time-Series Processing (Version 2.0.0) [Computer software]. Zenodo. https://doi.org/10.5281/zenodo.23265767

DOI

The historical DOI above identifies the archived 2.0.0 release. The scientific publications below are separate research outputs and should be cited additionally when relevant.

Scientific publications

TSGenerator has been presented and applied in scientific research involving Copernicus HR-VPP products and vegetation time-series processing.

TSGenerator software publication

Valero-Jorge, A., Casterad, M. A., & Alcalá, J.-T. (2026). TSGenerator: librería R de código abierto para el procesado integrado de productos fenológicos HR-VPP de Copernicus. Congresos UEx, Actas de Congresos, 2. https://doi.org/10.17398/3101-7177.2.123

Research using TSGenerator

Valero-Jorge, A., Casterad, M. A., & Alcalá, J.-T. (2025). Evaluating the Influence of Missing Data from the Crop Vegetation Index Time Series on Copernicus HR-VPP Phenological Products. Engineering Proceedings, 94(1), 4. https://doi.org/10.3390/engproc2025094004

Data sources and acknowledgements

TSGenerator supports processing of Copernicus HR-VPP products and uses WEkEO for online data access. References to Copernicus and WEkEO identify data sources and services; they do not imply institutional endorsement of TSGenerator.

Funding

TSGenerator was created within the LAIKcA I+D+i project PID2021-124029OR-I00, funded by MICIU/AEI/10.13039/501100011033 and FEDER/EU. Alexey Valero Jorge acknowledges grant PRE2022-102328 funded by MICIU/AEI/10.13039/501100011033 and FSE+.

License

MIT. See LICENSE.