CHARM

This chapter documents the Cloud Run workflow for generating CHARM products and derived habitat prediction datasets.

Purpose

The workflow ingests VIIRS ocean color inputs, applies DINEOF gap-filling and CHARM model logic, and generates gridded bloom prediction products for ERDDAP publication.

The system includes:

  • Cloud Run orchestration
  • DINEOF configuration management
  • CHARM model processing
  • NetCDF template generation
  • ERDDAP-ready publication

Repository structure

charm/
├── config/
│   ├── config.yaml                 # Main runtime configuration
│   ├── dineof/                     # Standard DINEOF configurations
│   └── bf_dineof/                  # Backfill DINEOF configurations
├── deploy_job.sh                   # Build, push, and deploy Cloud Run job
├── Dockerfile                      # Container definition
├── entrypoint.sh                   # Cloud Run entrypoint
├── scripts/
│   ├── control_charm_cron_v1.py    # Workflow controller
│   └── make_charm_cloud_v1.py      # Main CHARM processor
├── src/python/
│   ├── charm_data_process_functions.py
│   ├── charm_dineof_functions.py
│   ├── charm_helper_functions.py
│   └── charm_model_functions.py
└── templates/
    ├── charm_3k_grid.nc
    ├── charm2022_out_tmpl.cdf
    ├── themask.nc
    └── viirs_L3.cdl

Cloud Run jobs

The workflow runs as a Cloud Run job built from a shared container image and dispatched through entrypoint.sh.

Component Purpose
control_charm_cron_v1.py Runtime orchestration and scheduling logic
make_charm_cloud_v1.py Main CHARM product generation
entrypoint.sh Cloud Run startup and mode dispatch

Processing pipeline

Each run follows this sequence:

Cloud Scheduler → Cloud Run Job → Download VIIRS inputs → DINEOF gap-filling → CHARM model processing → Apply templates → Publish to GCS → ERDDAP ingestion

The controller script manages runtime configuration, date handling, input discovery, and execution of the CHARM processing workflow.

DINEOF configuration system

The workflow uses multiple DINEOF initialization files for forecast, nowcast, and backfill processing.

Configuration groups are organized by:

  • chlorophyll-a
  • Rrs_489
  • Rrs_556

Separate configurations exist for:

  • operational processing
  • backfill processing
  • forecast generation
  • nowcast generation

Templates and static assets

The workflow uses static NetCDF templates and mask/grid assets to standardize output structure and metadata.

File Purpose
charm_3k_grid.nc CHARM output grid definition
charm2022_out_tmpl.cdf CHARM NetCDF output template
themask.nc Processing mask
viirs_L3.cdl VIIRS Level-3 CDL template

Codebase

Deployment

Container and Cloud Run deployment configuration.

Workflow scripts

Main CHARM orchestration and processing.

Model and helper libraries

Supporting processing, DINEOF, and model utilities.

DINEOF configuration

Forecast, nowcast, and backfill initialization files.

Backfill DINEOF configuration

Backfill forecast and nowcast initialization files.

Templates and static assets

Reference templates, masks, and static grid assets.

  • viirs_L3.cdl
  • charm_3k_grid.nc
  • charm2022_out_tmpl.cdf
  • themask.nc