Skip to contents

Project Status: WIP – Initial development is in progress, but there has not yet been a stable, usable release suitable for the public. Package version R-CMD-check lint cov

Group Project for the Spatiotemporal Exposures and Toxicology group with help from friends πŸ˜ƒ 🀠 🌎

[!WARNING] Breaking changes are in progress. Do not use this branch to build beethoven. The Snakemake pipeline and directory structure are undergoing breaking changes. This branch remains under development and is not ready for installation or production pipeline execution.

Workflow

beethoven develops an ensemble air quality modeling workflow: download source data, calculate covariates at monitoring sites and prediction locations, fit base and meta learners, and generate predictions.

The root Snakefile loads config/config.yaml and the rules in inst/rules/; the current rules dispatch R scripts from inst/scripts/ through the named beethoven Conda environment.

The default rule all currently targets output/train/feat/db_train_feat_sptmpl.qs, the manifest for the merged training features. Its dependencies run initialization, all nine download rules, AQS monitoring-site preparation, and hourly, daily, static, and derived covariate calculations before the training merge. Later stages run when explicitly requested: fit_meta fits the ensemble through the meta learner, and predict_grid_meta targets grid prediction. Static covariate preparation for the grid remains pending.

The download tier retrieves AQS, GEOS-CF, HRRR, HMS, GMTED, Koppen-Geiger, ecoregions, gRoads, and population data. The training calculation tier uses hourly AQS observations, ten selected GEOS-CF variables, twenty HRRR variables, daily HMS smoke polygons, all five static sources, and derived spacetime covariates. The amadeusdb package performs SedonaDB extraction and joins, writing Parquet datasets with paths saved in .qs manifests. HRRR and static extraction use amadeus and write their results with arrow; four static sources pass a single Parquet path directly between rules. The modelling tier fits Spark XGBoost base and meta learners, saves native fold models, and generates out-of-fold training predictions. The prediction tier reloads those models and averages fold predictions within each repeat at grid sites.

The diagram below shows the broader ensemble design. The current fitting rules use Spark XGBoost for both base and meta learners.

beethoven workflow
beethoven workflow

Directory structure

The project combines R package functions with Snakemake rules and stage-specific scripts. The compact outline shows the current workflow files and main package directories. Pipeline configuration, rules, scripts, and containers are excluded from the built R package by .Rbuildignore; run the workflow from a repository checkout.

beethoven/
β”œβ”€β”€ Snakefile                        # Configuration and rule includes
β”œβ”€β”€ run.sh                           # SLURM, Apptainer, and Conda launcher
β”œβ”€β”€ .github/
β”‚   └── workflows/
β”œβ”€β”€ R/                               # Functions
β”œβ”€β”€ config/
β”‚   └── config.yaml                  # Dates, paths, grid resolution
β”œβ”€β”€ inst/
β”‚   β”œβ”€β”€ conda/
β”‚   β”‚   └── beethoven.yml            # Geospatial and Spark environment
β”‚   β”œβ”€β”€ devel/                       # Spark development examples
β”‚   β”œβ”€β”€ rules/
β”‚   β”‚   β”œβ”€β”€ a01_initiate.smk         # Initialize dates and years
β”‚   β”‚   β”œβ”€β”€ b01_download.smk         # Download hourly, daily, and static sources
β”‚   β”‚   β”œβ”€β”€ c01_calculate.smk        # Calculate monitoring-site covariates
β”‚   β”‚   β”œβ”€β”€ d01_model.smk            # Spatial CV and Spark models
β”‚   β”‚   β”œβ”€β”€ e01_grid.smk             # Prepare grid and covariates
β”‚   β”‚   └── f01_predict.smk          # Predict with base and meta learners
β”‚   └── scripts/
β”‚       β”œβ”€β”€ a01_initiate.R           # Generate dates and chunks
β”‚       β”œβ”€β”€ b01_aqs.R                # Download hourly AQS observations
β”‚       β”œβ”€β”€ b02_geos.R               # Download hourly GEOS-CF collections
β”‚       β”œβ”€β”€ b03_hrrr.R               # Download hourly HRRR f00/f01 surface files
β”‚       β”œβ”€β”€ b10_hms.R                # Download daily HMS smoke polygons
β”‚       β”œβ”€β”€ b30_gmted.R              # Download seven GMTED elevation statistics
β”‚       β”œβ”€β”€ b31_koppengeiger.R       # Download Koppen-Geiger climate classes
β”‚       β”œβ”€β”€ b32_ecoregions.R         # Download EPA Level III ecoregion shapefiles
β”‚       β”œβ”€β”€ b33_groads.R             # Download Americas roads geodatabase
β”‚       β”œβ”€β”€ b34_population.R         # Download 2020 population-density GeoTIFF
β”‚       β”œβ”€β”€ c01_aqs.R                # Prepare hourly monitoring-site observations
β”‚       β”œβ”€β”€ c02_geos.R               # Extract and join GEOS-CF Parquet batches
β”‚       β”œβ”€β”€ c03_hrrr.R               # Extract HRRR variables and join groups of five
β”‚       β”œβ”€β”€ c10_hms.R                # Write daily HMS Parquet batches
β”‚       β”œβ”€β”€ c30_gmted.R              # Extract GMTED statistics across buffers
β”‚       β”œβ”€β”€ c31_koppengeiger.R       # Calculate spatial climate-class covariates
β”‚       β”œβ”€β”€ c32_ecoregions.R         # Calculate spatial ecoregion covariates
β”‚       β”œβ”€β”€ c33_groads.R             # Calculate and merge roads covariates by buffer
β”‚       β”œβ”€β”€ c34_population.R         # Calculate and merge population by buffer
β”‚       β”œβ”€β”€ c40_spacetime.R          # Derive monitoring-site spacetime covariates
β”‚       β”œβ”€β”€ c99_merge.R              # Merge features to Parquet
β”‚       β”œβ”€β”€ d01_cvbase.R             # Generate base spatial CV indices
β”‚       β”œβ”€β”€ d02_base.R               # Fit Spark XGBoost base learners
β”‚       β”œβ”€β”€ d03_cvmeta.R             # Generate meta spatial CV indices
β”‚       β”œβ”€β”€ d04_meta.R               # Fit Spark XGBoost meta learners
β”‚       β”œβ”€β”€ e01_grid.R               # Generate H3 grid polygons
β”‚       β”œβ”€β”€ e02_geos.R               # Extract and join grid GEOS-CF Parquet batches
β”‚       β”œβ”€β”€ e03_hrrr.R               # Extract and join grid HRRR variables
β”‚       β”œβ”€β”€ e10_hms.R                # Extract daily grid HMS covariates
β”‚       β”œβ”€β”€ e40_spacetime.R          # Derive grid spacetime covariates
β”‚       β”œβ”€β”€ e99_merge.R              # Merge grid covariates to Parquet
β”‚       β”œβ”€β”€ f01_base.R               # Predict saved base models at grid sites
β”‚       └── f02_meta.R               # Predict saved meta models at grid sites
β”œβ”€β”€ man/                             # Function documentation (generated by roxygen2)
β”œβ”€β”€ tests/
β”‚   β”œβ”€β”€ testdata/                    # Fixture test data
β”‚   └── testthat/                    # Unit and integration tests
└── vignettes/                       # Educational material and tutorials

Naming and output policy

Script letters identify workflow tiers: a initialization, b downloads, c monitoring-site calculations, d modelling, e grid preparation, and f prediction. Within the b, c, and e tiers, numeric ranges group scripts as follows:

Script numbers Group Examples
00–09 Hourly data and hourly index preparation b01_aqs.R, c02_geos.R, c03_hrrr.R, e01_grid.R
10–19 Daily data b10_hms.R, c10_hms.R, e10_hms.R
20–29 Annual data Planned: NLCD (20), NEI (21), and TRI (22).
30–39 Static data b30_gmted.R, b31_koppengeiger.R, b32_ecoregions.R, b33_groads.R, b34_population.R
40–49 Derived covariates c40_spacetime.R, e40_spacetime.R
99 Merge c99_merge.R, e99_merge.R

Keep each source’s number consistent across tiers where it is used: GEOS is 02, HRRR is 03, HMS is 10, GMTED through population use 30–34, and spacetime is 40. The planned annual tier will expand NLCD and NEI to yearly values and include annual TRI data; annual rules are not yet implemented. Population currently uses a fixed 2020 snapshot in the static tier. Derived covariates are calculated from locations, dates, or other inputs and can vary over time. The spacetime scripts produce hourly data and therefore enter the hourly merge inputs. The numeric groups do not change the sequential numbering of initialization, modelling, or prediction scripts. Snakemake sections use labelled dashed comment separators padded to 88 characters.

Workflow data artifacts use this order:

<representation>_<domain>_<role>[_<source-or-learner>][_<method>]_<extent>
  • domain: train for monitoring-site data, including assessment sites; grid for prediction locations.
  • role: sites for locations, index for site-time rows before covariates, obs for observed outcomes, feat for covariates, and pred for model predictions.
  • source-or-learner: a source such as aqs, geos, or hms, or a learner stage such as base or meta. Omit the source for the merged feature dataset.
  • method: required for prediction datasets. oof means held-out predictions stacked across folds; mean means the equal-weight fold mean within each repeat. Neither method averages across repeats.
  • extent: sp for spatial, tmpl for temporal intermediates, and sptmpl for spatiotemporal data.
  • representation: sf, df, dt, and mat identify in-memory structures; tbl identifies a lazy table. db identifies a path or vector of paths to an on-disk dataset. chr, int, and list identify metadata or collections. Intermediate objects may add descriptive qualifiers before the extent.

grid identifies the locations; pred identifies model-generated values. Covariates at grid sites use grid_feat, and predictions at those sites use grid_pred. Keep the R artifact name, Snakemake input/output key, and serialized filename stem identical. When a script converts representations, change only the representation prefix, for example dt_grid_index_sptmpl written to db_grid_index_sptmpl.parquet.

Static covariate artifacts use _sp: db_train_feat_<source>_sp, with corresponding df_, dt_, or list_ names for in-memory data and collections. The fixed 2020 population snapshot is spatial under this convention. The combined training dataset remains db_train_feat_sptmpl because its rows represent site-time observations, with static values repeated across matching times. GMTED’s internal cache files retain the shorter gmted_<code>_<radius>.parquet names; its manifest and rule keys use the full convention.

A db_*.parquet file stores the data itself. Koppen-Geiger, ecoregions, gRoads, and population each declare one such file as their rule output and pass its path directly to the training merge. A db_*.qs file stores a path or vector of paths to a Parquet dataset; GMTED retains this manifest because join_variables() returns the generated file paths. Consumers use snakemake@input[[...]] directly for Parquet outputs and qs2::qs_read() for path manifests.

Prediction manifests sit alongside a data/ subdirectory; Spark overwrites only data/. Model metadata retain list_base_xgb_model and list_meta_xgb_model, containing the fold index, ordered predictor names, outcome, and learner stage. Native model files retain rset_NNN_fold_NN.ubj. Prediction columns retain base_NNN and meta_NNN in both training and grid datasets so saved models receive the expected features.

CV artifacts use list_<learner>_cv_idx and list_base_params_static; evaluation artifacts use dt_<learner>_xgb_eval. Initialization and download metadata retain their *_init_* and list_dl_* names because they are shared across domains.

output/
β”œβ”€β”€ init/                       # Dates, years, and date chunks
β”œβ”€β”€ download/                   # Download manifests; source files remain in input/
β”œβ”€β”€ train/
β”‚   β”œβ”€β”€ sites/                  # sf_train_sites_sp.qs
β”‚   β”œβ”€β”€ obs/                    # db_train_obs_aqs_sptmpl.parquet
β”‚   β”œβ”€β”€ feat/                   # Spatiotemporal manifests and spatial source files
β”‚   β”‚   β”œβ”€β”€ db_train_feat_gmted_sp.qs
β”‚   β”‚   β”œβ”€β”€ db_train_feat_koppengeiger_sp.parquet
β”‚   β”‚   β”œβ”€β”€ db_train_feat_ecoregions_sp.parquet
β”‚   β”‚   β”œβ”€β”€ db_train_feat_groads_sp.parquet
β”‚   β”‚   β”œβ”€β”€ db_train_feat_population_sp.parquet
β”‚   β”‚   β”œβ”€β”€ geos/               # GEOS batches and join/ data
β”‚   β”‚   β”œβ”€β”€ hrrr/               # HRRR variable Parquet files and join/ data
β”‚   β”‚   β”œβ”€β”€ hms/                # HMS batches
β”‚   β”‚   β”œβ”€β”€ gmted/              # Statistic/buffer cache files and join/ data
β”‚   β”‚   β”œβ”€β”€ spacetime/          # Derived hourly spacetime data
β”‚   β”‚   └── merge/              # Joined training Parquet data
β”‚   └── pred/
β”‚       β”œβ”€β”€ base/oof/           # db_train_pred_base_oof_sptmpl.qs and data/
β”‚       └── meta/oof/           # db_train_pred_meta_oof_sptmpl.qs and data/
β”œβ”€β”€ grid/
β”‚   β”œβ”€β”€ sites/                  # sf_grid_sites_sp.qs
β”‚   β”œβ”€β”€ index/                  # db_grid_index_sptmpl.parquet
β”‚   β”œβ”€β”€ feat/                   # db_grid_feat[_<source>]_sptmpl.qs
β”‚   β”‚   β”œβ”€β”€ geos/               # GEOS batches and join/ data
β”‚   β”‚   β”œβ”€β”€ hrrr/               # HRRR variable Parquet files and join/ data
β”‚   β”‚   β”œβ”€β”€ hms/                # HMS batches
β”‚   β”‚   β”œβ”€β”€ spacetime/          # Derived hourly spacetime data
β”‚   β”‚   └── merge/              # Joined grid Parquet data
β”‚   └── pred/
β”‚       β”œβ”€β”€ base/mean/          # db_grid_pred_base_mean_sptmpl.qs and data/
β”‚       └── meta/mean/          # db_grid_pred_meta_mean_sptmpl.qs and data/
β”œβ”€β”€ model/{base,meta}/          # Native .ubj models and list_*_xgb_model.qs
β”œβ”€β”€ cv/{base,meta}/             # CV indices; shared parameters in cv/base/
└── eval/{base,meta}/           # Evaluation tables

Use prepare_<domain>_<role>[_<source>] for data-preparation rules, prepare_<learner>_cv for CV, fit_<learner> for fitting, and predict_grid_<learner> for grid prediction. The script prefixes a through f continue to identify workflow stages. The workspace devel.R contains interactive development checks and is not a pipeline stage. Archived workflows and standalone historical experiments are outside this naming policy.

Pipeline

Tier Script prefix Rules Principal outputs
initiate a initiate Date and year objects under output/init/.
download b download_aqs, download_geos, download_hrrr, download_hms Download manifests under output/download/.
download b download_gmted, download_koppengeiger, download_ecoregions, download_groads, download_population Static-source download manifests under output/download/.
train c prepare_train_obs_aqs Monitoring locations under output/train/sites/ and observations under output/train/obs/.
train c prepare_train_feat_geos, prepare_train_feat_hrrr, prepare_train_feat_hms Source covariates and path manifests under output/train/feat/.
train c prepare_train_feat_gmted output/train/feat/db_train_feat_gmted_sp.qs, referencing the joined spatial data under gmted/join/.
train c prepare_train_feat_koppengeiger, prepare_train_feat_ecoregions, prepare_train_feat_groads, prepare_train_feat_population One db_train_feat_<source>_sp.parquet file per source under output/train/feat/.
train c prepare_train_feat_spacetime Derived hourly covariates under output/train/feat/spacetime/ and their path manifest.
train c prepare_train_feat output/train/feat/db_train_feat_sptmpl.qs, referencing output/train/feat/merge/.
model d prepare_base_cv, prepare_meta_cv CV indices under output/cv/{base,meta}/; shared parameters under output/cv/base/.
model d fit_base, fit_meta OOF predictions under output/train/pred/{base,meta}/oof/, models under output/model/{base,meta}/, and metrics under output/eval/{base,meta}/.
grid e prepare_grid_sites H3 polygons under output/grid/sites/ and site-time rows under output/grid/index/.
grid e prepare_grid_feat_geos, prepare_grid_feat_hrrr, prepare_grid_feat_hms Source covariates and path manifests under output/grid/feat/.
grid e prepare_grid_feat_spacetime Derived hourly covariates under output/grid/feat/spacetime/ and their path manifest.
grid e prepare_grid_feat output/grid/feat/db_grid_feat_sptmpl.qs, referencing output/grid/feat/merge/.
predict f predict_grid_base output/grid/pred/base/mean/db_grid_pred_base_mean_sptmpl.qs.
predict f predict_grid_meta output/grid/pred/meta/mean/db_grid_pred_meta_mean_sptmpl.qs, when explicitly targeted.

Initialization supplies dates and years to the download and preparation rules. AQS preparation declares and reads all nine download manifests, so it currently waits for the four hourly/daily sources and all five static downloads before producing the training sites. Training covariate rules depend on those sites; grid preparation follows model fitting. Static download rules also depend on the initialized dates, although their scripts use fixed source selections.

The static download scripts use the following selections and subdirectories beneath chr_config_dir:

Script Source selection Subdirectory Extracted format
b30_gmted.R Seven statistics at 7.5 arc-seconds gmted/ Arc/Info grids in *_grd directories
b31_koppengeiger.R Present, 0.0083 degrees koppengeiger/ GeoTIFF rasters
b32_ecoregions.R EPA Level III US ecoregions ecoregions/ Shapefiles
b33_groads.R Americas, Geodatabase groads/ .gdb geodatabase
b34_population.R 2020 population density, 30 second, GeoTIFF population/ GeoTIFF raster

All five scripts retain their ZIP archives (remove_zip = FALSE), extract the downloaded data, and save download summaries as output/download/list_dl_<source>.qs with hash = FALSE. The amadeus downloaders place archives in each source’s zip_files/ directory and extracted data in data_files/. GEOS-CF, gRoads, and population read their NASA Earthdata token from input/.hidden/chr_nasa_earthdata_token.txt, relative to the repository working directory.

The c30_gmted.R through c34_population.R scripts calculate static covariates at the monitoring sites. Their outputs enter the static list in c99_merge.R, matching observations by site_id.

Script Calculation Rule output under output/train/feat/
c30_gmted.R Seven elevation statistics at each configured buffer radius db_train_feat_gmted_sp.qs
c31_koppengeiger.R Climate-class indicators at site locations db_train_feat_koppengeiger_sp.parquet
c32_ecoregions.R Ecoregion covariates at site locations db_train_feat_ecoregions_sp.parquet
c33_groads.R Roads covariates at each configured buffer radius db_train_feat_groads_sp.parquet
c34_population.R Population density from the fixed 2020 raster at each configured buffer radius db_train_feat_population_sp.parquet

GMTED writes a cache file for each statistic/radius combination, reuses existing files, and joins the selected files by site_id into output/train/feat/gmted/join/. gRoads and population combine their radius-specific tables with beethoven::reduce_merge() using all.x = TRUE and all.y = TRUE. Koppen-Geiger, ecoregions, and gRoads remove the descriptive metadata column before saving. The four single-file writers use their declared snakemake@output paths and do not create additional .qs manifests.

Static calculation rules and merge inputs for the grid remain pending. The grid tier must supply the corresponding static predictors before predicting models trained with those features.

b02_geos.R downloads GEOS-CF into <chr_config_dir>/geos/<collection>/. Both extraction scripts read those same collection directories, which contain .nc4 files directly, without a data_files subdirectory. Filenames follow GEOS-CF.v01.rpl.<collection>.<YYYYMMDD>_<HHMM>z.nc4; the hourly-average collections use timestamps from 0030 through 2330.

Training and grid extraction retain the same ten GEOS-CF variables:

Collection Active variables
aqc_tavg_1hr_g1440x721_v1 CO, NO2
chm_tavg_1hr_g1440x721_v1 PM25_RH35_GCC, PM25bc_RH35_GCC, PM25du_RH35_GCC, PM25ni_RH35_GCC, PM25oc_RH35_GCC, PM25soa_RH35_GCC, PM25ss_RH35_GCC, PM25su_RH35_GCC

This selection retains total PM2.5, seven component diagnostics, and two combustion-related gases. Other candidates remain commented in the extraction scripts. Reducing the active set from 52 to 10 reduces extraction and join work; downloads still retrieve the complete files for both collections.

Both GEOS extraction scripts use batches of up to 240 files and full outer joins by site_id, time, and level. Training joins groups of at most ten variables into temporary Parquet datasets, joins those into persistent geos/join/ output, and removes the temporary directory after success. Grid extraction instead joins all ten variables for one 240-hour window at a time, writing each window under output/grid/feat/geos/join/<start>_<end>/. The grid manifest collects paths from every window. sedona_geos() discovers source files before skipping existing variable/time batches; the input collection directories and source files are still required. Changing the input directory alone does not invalidate cached batches. Only the ten active variables feed the joins.

GEOS and HMS scripts in both domains load the Conda environment’s libgdal.so.39 before extraction. HMS uses batches of up to 50 files. Both feature merges pass GEOS, HRRR, and derived spacetime covariates as hourly data and HMS as daily data to amadeusdb::join_covariates(). The training merge also passes GMTED, Koppen-Geiger, ecoregions, gRoads, and population as static inputs; the grid merge still uses static = NULL. Rules declare the four single-file static Parquet outputs directly. For datasets handed off through .qs manifests, the referenced batch Parquet files remain script-managed outputs; native model files are also written without separate output declarations.

The HRRR download rule calls b03_hrrr.R for CONUS 2d surface files, covering all 24 hourly cycles and forecast hours f00 and f01. Files are saved beneath <chr_config_dir>/hrrr/conus/. Both c03_hrrr.R and e03_hrrr.R extract nineteen f00 variables and one-hour total precipitation from f01, using radius = 0. They pass the full metadata layer_name strings to process_hrrr() and set GDAL_DATA and GRIB_RESOURCE_DIR to the named Conda environment’s GDAL data directory. Each variable is written to a Parquet file spanning the configured dates; existing variable files are reused.

Training HRRR joins groups of at most five variables into temporary Parquet datasets, then joins those groups into output/train/feat/hrrr/join/. Grid HRRR currently joins the complete variable list directly into output/grid/feat/hrrr/join/. Both use site_id and time as join keys and save the resulting paths in their source manifests.

The final grid feature merge follows the GEOS 240-hour windows. It slices the grid index, HRRR, spacetime, and daily HMS inputs before joining each window, then writes the results under output/grid/feat/merge/<start>_<end>/. GRID_MERGE_MEMORY_LIMIT defaults to 64gb; execution partitions use SLURM_CPUS_PER_TASK, with a fallback of 4.

Grid generation uses the North Carolina county example bundled with sf, storing H3 cell IDs as site_id at the configured resolution. It declares and reads the meta-model metadata, although grid construction does not use its contents; this dependency places grid preparation after meta-model fitting.

Spark modelling

d01_cvbase.R loads the merged training-data paths and inspects the Parquet schema through SedonaDB. It sets Sample_Measurement as the outcome and excludes the outcome, site_id, time, and level from predictors.

Both CV scripts project monitoring locations to CRS 5070 and use five spatial folds, square 100,000-meter cells, and a 50,000-meter buffer. Repeat counts come from int_base_iter and int_meta_iter. The saved indices contain analysis and assessment site_id values by repeat and fold; Spark selects all available times for those sites.

The fitting and prediction scripts source R/spark.R. fit_xgb_spark() fits one model per repeat and fold, saves its native booster under output/model/<learner>/, and predicts assessment sites. Fold predictions are stacked by row within each repeat; repeat columns are joined into one OOF dataset. Base OOF columns, together with lon and lat, are the meta-learner predictors. The returned list contains prediction paths, metrics, and model metadata, saved separately by the scripts.

predict_xgb_spark() reloads the native fold models and assembles predictors in the saved order. It averages fold predictions within each repeat, retaining one base_NNN or meta_NNN column per repeat. Base grid predictions feed the meta grid prediction step. Feature assembly uses dense vectors to preserve explicit zeros. Grid prediction does not require the outcome column and ignores the optional fitting row limit.

All four fitting/prediction scripts read input/.hidden/chr_spark_local.txt and input/.hidden/chr_spark_home.txt to connect to an existing Spark cluster; run.sh does not start it. XGBOOST_JARS, when set, supplies JAR paths; otherwise Spark requests XGBOOST_MAVEN_PACKAGE.

Spark setting Current value or default Use
SPARK_CORES_MAX 64 by default and in both fitting scripts Maximum cores requested for the Spark application.
SPARK_EXECUTOR_CORES 2 Executor cores, read by the shared helper.
SPARK_EXECUTOR_MEMORY 2g by default; both fitting scripts set 4g Memory per executor.
SPARK_SHUFFLE_PARTITIONS 32 by default; both fitting scripts set 128 Spark SQL shuffle partitions.
XGB_NUM_WORKERS Maximum cores divided by executor cores, rounded down, with a minimum of 1; both fitting scripts set 32 XGBoost workers.
XGB_NTHREAD Executor cores (2 by default) Threads per XGBoost worker; also sets spark.task.cpus.
XGBOOST_MAVEN_PACKAGE ml.dmlc:xgboost4j-spark_2.13:3.4.0 Package requested when XGBOOST_JARS is unset.
XGB_NUM_ROUND 50 by default; both fitting scripts set 100 Boosting rounds per fold fit.
XGB_SEED 20260904 XGBoost estimator seed; it is not passed to the spatial CV generators.
XGB_MAX_ROWS 0 Optional SQL row limit; zero uses all rows.

Both prediction scripts currently set SPARK_CORES_MAX = 128 and SPARK_EXECUTOR_MEMORY = "8g"; these differ from the fitting settings above.

spark_environment() reads the settings into a list used explicitly by fit_xgb_spark(). Worker and thread overrides are applied to the estimator. Validation requires executor cores not to exceed maximum cores, threads per worker not to exceed executor cores, and workers times threads not to exceed maximum cores. The objective is reg:squarederror, evaluation metric is rmse, tree method is hist, maximum depth is 8, learning rate is 0.1, and row/column sampling fractions are 0.8. The stored normalize and metric fields in the common parameter list are not passed into this helper.

Configuration and execution

Setting Current value Use
chr_config_daterange 2018-01-01 through 2019-12-31 Inclusive dates for downloading and processing data.
chr_config_dir beethoven/beethoven/input/ Shared download root for all nine sources, resolved relative to $HOME by the rules. GEOS extraction reads its collection subdirectories beneath this root.
int_config_radii 1000, 5000, 10000 Buffer radii in meters used by training GMTED, gRoads, and population calculations. HMS monitoring-site calculation explicitly passes radius = 0.
int_grid_res 6 H3 resolution for grid preparation.
int_base_iter 25 Number of repeated spatial CV partitions for base learners.
int_meta_iter 10 Number of repeated spatial CV partitions for meta learners.

run.sh enables both --use-apptainer and --use-conda. All current script rules declare the named Conda environment beethoven; none selects a container image.

The Conda rules name an existing environment rather than a YAML file for automatic creation. inst/conda/beethoven.yml records R 4.6, Java 17, native geospatial libraries, and build tools, with notes for manual R package installation. The scripts require the corresponding R packages, including amadeus, amadeusdb, beethoven, sedonadb, arrow, qs2, spatialsample, sparklyr, and DBI. GEOS-CF, HRRR, HMS, and GMTED downloading, plus HRRR extraction, also require mirai; grid generation requires h3jsr.

The container definitions and build scripts remain under inst/container/def/ and inst/container/sh/. Both main definitions install beethoven from NIEHS/beethoven@mm-1013, sparklyr, Spark, and arrow. The covariates definition installs amadeus from NIEHS/amadeus@mm-aqs-1019 for hourly AQS support. The models image includes CUDA support; current Spark fitting specifies the CPU.

run.sh requests one SLURM allocation on the geo partition with 20 CPUs and 250 GB of memory. Logs are written to slurm/beethoven_<jobid>.out and .err. The Snakemake core limit comes from the first script argument, then SLURM_CPUS_PER_TASK, then a fallback of 1. The launcher does not request GPUs or pass --nv. Spark fitting connects from this allocation to the separately configured cluster, whose executor settings are independent of the launcher allocation.

GEOS-CF, HRRR, and HMS downloads each start 33 local mirai workers and call their respective amadeus download functions directly. The three pools can total 99 workers if their rules run concurrently, in addition to AQS and the parent processes. Each script sets rate_limit = 2 / int_ndaemons; the current amadeus runner multiplies this interval by the daemon count, giving each worker a nominal two-second request interval. The combined nominal rate is therefore 16.5 requests per second per pool, subject to transfer duration and throttle bursts.

GMTED starts seven local mirai workers, one per requested statistic, with the downloader’s default rate limit. The other four static download scripts do not start worker pools. Each HRRR extraction script starts 100 mirai workers and stops them before joining its variable files. The GEOS/HMS extraction scripts use amadeusdb and do not start mirai pools. Spatial CV preparation and Spark fitting also do not start mirai pools. The download and HRRR extraction rules declare no thread resources corresponding to those local pools, so Snakemake’s core limit does not directly cap their child-process counts. Inputs, outputs, runtime state, logs, Spark warehouse files, and container images are ignored by Git.

Contribution

To contribute developments or modifications, open a Pull request into the main branch with a detailed description of the proposed changes. Pull requests must pass all status checks, and then will be approved or rejected by beethoven’s authors.

Utilize Issues to notify the authors of bugs, questions, or recommendations. Identify each issue with the appropriate label to help ensure a timely response.