API#

AIFS on Modal.

aifs_modal.apply_trajectory_chunks(ds)#

Set per-variable chunk encoding for efficient trajectory queries.

One chunk along init_time; full size along lead_time, ensemble_member, and pressure; 241×240 spatial tiles (≈60°×60°, three near-equal tiles per hemisphere). The full forecast trajectory at any location is a single chunk read.

Parameters:

ds (Dataset)

Return type:

Dataset

aifs_modal.forecast_exists(date, storage_bucket, *, outputs_repo=None, outputs_prefix=None, outputs_branch='main', n_members=None, storage_type='tigris')#

Return True if a forecast for date already exists in the output store.

Matches the storage parameters of aifs_modal.run_forecast() and can be called locally (outside Modal) to skip spinning up an app for a forecast that is already complete.

Parameters:
  • date (datetime.datetime) – Initialisation date (UTC, on a 6-hourly boundary).

  • storage_bucket (str) – Bucket name for the icechunk output store.

  • outputs_repo (str, optional) – ArrayLake repository name. Requires ARRAYLAKE_API_TOKEN in env.

  • outputs_prefix (str, optional) – Key prefix within the bucket.

  • outputs_branch (str, optional) – Branch to check. Default "main".

  • n_members (int, optional) – If set, returns True only when the stored forecast already has at least this many ensemble members. None treats any complete forecast as present.

  • storage_type ({"tigris", "s3", "r2", "gcs", "azure"}, optional) – Storage backend. Default "tigris".

Return type:

bool