Publish Trackformer 1.2 model card and runnable guide
Browse files- README.md +88 -21
- examples/predict_trackformer_1_2.py +62 -15
- models/trackformer_1_2/manifest.json +2 -2
- paper/{trackformer_1_2_28_vs_1_1_matched100_mae.png → trackformer_1_2_vs_1_1_matched100_mae.png} +2 -2
- paper/{trackformer_1_2_28_vs_1_1_matched100_metrics.json → trackformer_1_2_vs_1_1_matched100_metrics.json} +11 -11
- trackformer_1_2.py +4 -4
README.md
CHANGED
|
@@ -7,9 +7,9 @@ tags:
|
|
| 7 |
- causal-inference
|
| 8 |
---
|
| 9 |
|
| 10 |
-
# Trackformer 1.2
|
| 11 |
|
| 12 |
-
Trackformer 1.2
|
| 13 |
forecasting model. It forecasts storm motion, maximum sustained wind, central
|
| 14 |
pressure, radius of maximum wind, and R34/R50/R64 wind radii over six-hour
|
| 15 |
leads through +120 h.
|
|
@@ -30,15 +30,30 @@ safety-critical decisions.
|
|
| 30 |
- Native PyTorch and joblib artifacts in a GitHub Release and the Hugging Face
|
| 31 |
model repository.
|
| 32 |
|
| 33 |
-
The public release name is **Trackformer 1.2
|
| 34 |
is intentionally not used as the public product name.
|
| 35 |
|
| 36 |
## Availability
|
| 37 |
|
| 38 |
-
- [GitHub Release: Trackformer 1.2
|
| 39 |
- [Hugging Face model repository](https://huggingface.co/euler314/typhoon-predict)
|
| 40 |
- [Live interactive demo](https://yu314-coder.github.io/typhoon-tracks.html)
|
| 41 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
The public package contains only the Trackformer route/intensity model. No
|
| 43 |
gridded weather-field generator or official forecast product is included as
|
| 44 |
part of the model package. The model weights are distributed as the release
|
|
@@ -46,7 +61,7 @@ archive rather than committed into the Git history.
|
|
| 46 |
|
| 47 |
## What Changed
|
| 48 |
|
| 49 |
-
Trackformer 1.2
|
| 50 |
land/ocean-context intensity candidate. The structure head uses pooled
|
| 51 |
log-radius groups, lead-wise residual calibration, non-negative radius
|
| 52 |
constraints, and a validation-selected ocean-availability gate. The route and
|
|
@@ -75,7 +90,7 @@ best-track labels are used only after the forecast is frozen for verification.
|
|
| 75 |
|
| 76 |
## Inputs
|
| 77 |
|
| 78 |
-
Trackformer 1.2
|
| 79 |
the route context is expanded across the western Pacific and includes the
|
| 80 |
static land/ocean features needed near coastlines. The public tensor contract
|
| 81 |
is:
|
|
@@ -182,26 +197,26 @@ this matched-storm benchmark. The chart below is the canonical comparison;
|
|
| 182 |
lower error is better and every value comes from the same matched 100-storm
|
| 183 |
evaluation. Official forecast products are excluded from model inputs.
|
| 184 |
|
| 185 |
-
. It loads both released neural
|
| 258 |
-
seeds and averages them as one Trackformer 1.2
|
| 259 |
publishes the feature constructors used to build the tensor contracts, rather
|
| 260 |
than requiring callers to reverse-engineer the training code. Install the
|
| 261 |
runtime dependencies with:
|
|
@@ -264,6 +279,58 @@ runtime dependencies with:
|
|
| 264 |
python -m pip install -r requirements.txt
|
| 265 |
```
|
| 266 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 267 |
Load from an extracted GitHub Release bundle:
|
| 268 |
|
| 269 |
```python
|
|
@@ -424,7 +491,7 @@ prevents future or official forecast fields from entering by accident.
|
|
| 424 |
|
| 425 |
[Trackformer 1.1](https://github.com/yu314-coder/typhoon-predict/releases/tag/trackformer-1.1)
|
| 426 |
remains available as a historical baseline. It is not mixed into the
|
| 427 |
-
Trackformer 1.2
|
| 428 |
|
| 429 |
## Limitations
|
| 430 |
|
|
|
|
| 7 |
- causal-inference
|
| 8 |
---
|
| 9 |
|
| 10 |
+
# Trackformer 1.2
|
| 11 |
|
| 12 |
+
Trackformer 1.2 is an experimental, causal western-Pacific tropical-cyclone
|
| 13 |
forecasting model. It forecasts storm motion, maximum sustained wind, central
|
| 14 |
pressure, radius of maximum wind, and R34/R50/R64 wind radii over six-hour
|
| 15 |
leads through +120 h.
|
|
|
|
| 30 |
- Native PyTorch and joblib artifacts in a GitHub Release and the Hugging Face
|
| 31 |
model repository.
|
| 32 |
|
| 33 |
+
The public release name is **Trackformer 1.2**. The internal experiment history
|
| 34 |
is intentionally not used as the public product name.
|
| 35 |
|
| 36 |
## Availability
|
| 37 |
|
| 38 |
+
- [GitHub Release: Trackformer 1.2](https://github.com/yu314-coder/typhoon-predict/releases/latest)
|
| 39 |
- [Hugging Face model repository](https://huggingface.co/euler314/typhoon-predict)
|
| 40 |
- [Live interactive demo](https://yu314-coder.github.io/typhoon-tracks.html)
|
| 41 |
|
| 42 |
+
## Model Showcase
|
| 43 |
+
|
| 44 |
+
Use the live demo for the interactive route and intensity presentation. Use
|
| 45 |
+
the reproducible benchmark chart for model comparison:
|
| 46 |
+
|
| 47 |
+
- [Interactive live demo](https://yu314-coder.github.io/typhoon-tracks.html)
|
| 48 |
+
- [Matched-100 benchmark chart](paper/trackformer_1_2_vs_1_1_matched100_mae.png)
|
| 49 |
+
- [Exact benchmark JSON](paper/trackformer_1_2_vs_1_1_matched100_metrics.json)
|
| 50 |
+
|
| 51 |
+
The chart has separate panels for track error, +120 h intensity/structure
|
| 52 |
+
error, all-lead intensity/structure error, and relative +120 h change. Values
|
| 53 |
+
are printed to three decimals and use the same 100 storms, issue times, and
|
| 54 |
+
causal input boundary. It is a benchmark showcase, not a selected best-case
|
| 55 |
+
storm display.
|
| 56 |
+
|
| 57 |
The public package contains only the Trackformer route/intensity model. No
|
| 58 |
gridded weather-field generator or official forecast product is included as
|
| 59 |
part of the model package. The model weights are distributed as the release
|
|
|
|
| 61 |
|
| 62 |
## What Changed
|
| 63 |
|
| 64 |
+
Trackformer 1.2 keeps the causal route design and adds a promoted
|
| 65 |
land/ocean-context intensity candidate. The structure head uses pooled
|
| 66 |
log-radius groups, lead-wise residual calibration, non-negative radius
|
| 67 |
constraints, and a validation-selected ocean-availability gate. The route and
|
|
|
|
| 90 |
|
| 91 |
## Inputs
|
| 92 |
|
| 93 |
+
Trackformer 1.2 keeps the public causal input families used by Trackformer 1.1;
|
| 94 |
the route context is expanded across the western Pacific and includes the
|
| 95 |
static land/ocean features needed near coastlines. The public tensor contract
|
| 96 |
is:
|
|
|
|
| 197 |
lower error is better and every value comes from the same matched 100-storm
|
| 198 |
evaluation. Official forecast products are excluded from model inputs.
|
| 199 |
|
| 200 |
+

|
| 201 |
|
| 202 |
The source values and input policy are recorded in
|
| 203 |
+
[paper/trackformer_1_2_vs_1_1_matched100_metrics.json](paper/trackformer_1_2_vs_1_1_matched100_metrics.json).
|
| 204 |
|
| 205 |
+
| Metric | Trackformer 1.1 | Trackformer 1.2 | Better in this benchmark |
|
| 206 |
|---|---:|---:|---|
|
| 207 |
+
| Mean track error, all leads (km) | 802.406 | 398.419 | Trackformer 1.2 |
|
| 208 |
+
| Mean track error, +120 h (km) | 1,604.259 | 808.607 | Trackformer 1.2 |
|
| 209 |
+
| Wind MAE, +120 h (kt) | 20.657 | 18.509 | Trackformer 1.2 |
|
| 210 |
+
| Pressure MAE, +120 h (hPa) | 14.932 | 13.637 | Trackformer 1.2 |
|
| 211 |
| RMW MAE, +120 h (km) | 33.016 | 33.035 | Trackformer 1.1, marginally |
|
| 212 |
| R34 MAE, +120 h (km) | 69.357 | 76.112 | Trackformer 1.1 |
|
| 213 |
+
| Wind MAE, all leads (kt) | 18.121 | 17.638 | Trackformer 1.2 |
|
| 214 |
+
| Pressure MAE, all leads (hPa) | 13.044 | 12.755 | Trackformer 1.2 |
|
| 215 |
| RMW MAE, all leads (km) | 26.396 | 26.996 | Trackformer 1.1 |
|
| 216 |
+
| R34 MAE, all leads (km) | 57.253 | 57.079 | Trackformer 1.2 |
|
| 217 |
|
| 218 |
This benchmark supports a strong track improvement and lower wind/pressure
|
| 219 |
+
error. It does **not** support the claim that Trackformer 1.2 is better on
|
| 220 |
every radius metric; RMW remains slightly worse and +120 h R34 is worse. Those
|
| 221 |
limitations are kept visible instead of selecting a more favorable cohort.
|
| 222 |
|
|
|
|
| 226 |
its frozen causal baseline on 9,994 untouched test windows at +120 h. Lower is
|
| 227 |
better.
|
| 228 |
|
| 229 |
+
| Metric at +120 h | Frozen baseline | Trackformer 1.2 candidate |
|
| 230 |
|---|---:|---:|
|
| 231 |
| Maximum wind MAE (kt) | 19.876 | 19.618 |
|
| 232 |
| Central pressure MAE (hPa) | 13.634 | 13.519 |
|
|
|
|
| 262 |
calibration artifact. GGUF is not an appropriate interchange format for this
|
| 263 |
CNN/Transformer weather model.
|
| 264 |
|
| 265 |
+
Download the archive from the [Trackformer 1.2 release](https://github.com/yu314-coder/typhoon-predict/releases/latest),
|
| 266 |
verify its SHA-256 value shown in the release notes, and extract it outside the
|
| 267 |
Git checkout.
|
| 268 |
|
|
|
|
| 270 |
|
| 271 |
The repository includes a checkpoint-compatible inference module in
|
| 272 |
[`trackformer_1_2.py`](trackformer_1_2.py). It loads both released neural
|
| 273 |
+
seeds and averages them as one Trackformer 1.2 model. The same module now
|
| 274 |
publishes the feature constructors used to build the tensor contracts, rather
|
| 275 |
than requiring callers to reverse-engineer the training code. Install the
|
| 276 |
runtime dependencies with:
|
|
|
|
| 279 |
python -m pip install -r requirements.txt
|
| 280 |
```
|
| 281 |
|
| 282 |
+
### Forecasting Workflow
|
| 283 |
+
|
| 284 |
+
The released model is a route/intensity forecaster for a storm that already
|
| 285 |
+
has an issue-time candidate location and observed or analyzed history. It can
|
| 286 |
+
forecast an existing tropical cyclone from the latest issue time. It does not
|
| 287 |
+
contain a separate genesis detector, so it cannot discover a cyclone from an
|
| 288 |
+
empty basin by itself. For a pre-genesis candidate, provide a candidate
|
| 289 |
+
location, a causal pseudo-history, and a clearly labeled fallback structure
|
| 290 |
+
anchor; treat that result as research output, not an autonomous genesis
|
| 291 |
+
alert.
|
| 292 |
+
|
| 293 |
+
1. Download the release archive or let `from_pretrained()` fetch the Hugging
|
| 294 |
+
Face bundle. The archive includes the current `models/trackformer_1_2/`
|
| 295 |
+
weights and train-only normalization statistics.
|
| 296 |
+
2. Choose an issue time `t0`. Every input must be available at `t0` or earlier.
|
| 297 |
+
Do not put JMA, JTWC, ECMWF, GFS, GEFS, DeepMind, or any other positive-lead
|
| 298 |
+
forecast into the packet.
|
| 299 |
+
3. Build the route group. It requires `field [B,6,25,61]`, raw `context
|
| 300 |
+
[B,647]`, and `base_position [B,20,2]`. Build `field` with
|
| 301 |
+
`prepare_route_field` from physical SLP/H500 analyses at `t0`, `t-6 h`,
|
| 302 |
+
and `t-12 h`. Build `context` from the published constructors and use the
|
| 303 |
+
causal incumbent route or the explicitly labeled kinematic fallback.
|
| 304 |
+
4. Build the intensity group when structure output is needed. It requires
|
| 305 |
+
`causal_features [B,1020]` and `anchor_structure [B,20,15]`. Construct the
|
| 306 |
+
feature vector from the 9x54 observed track window, decoded DLM4 analysis
|
| 307 |
+
patches at `t0`, `t-12 h`, `t-24 h`, SST patches at those same times, six
|
| 308 |
+
static terrain samples, nearby-storm/basin/global analysis context, and
|
| 309 |
+
issue-time geography. Use `build_causal_anchor_structure` only as a labeled
|
| 310 |
+
fallback when the frozen incumbent anchor is unavailable.
|
| 311 |
+
5. Optionally add `ocean_features [B,66]` from `build_ocean_features` using
|
| 312 |
+
`[B,3,22]` current, `-12 h`, and `-24 h` ocean summaries plus
|
| 313 |
+
`ocean_available [B]`. This applies the separately validated ocean
|
| 314 |
+
calibration; it is not silently stacked onto the neural intensity output.
|
| 315 |
+
6. Save the groups as one `.npz` packet and run the example command below.
|
| 316 |
+
The script writes route positions, converted latitude/longitude when an
|
| 317 |
+
issue location is supplied, intensity structure, lead hours, and optional
|
| 318 |
+
ocean-calibration results to a compressed `.npz` forecast file.
|
| 319 |
+
|
| 320 |
+
The minimum packet keys are:
|
| 321 |
+
|
| 322 |
+
| Forecast part | Required keys | Output |
|
| 323 |
+
|---|---|---|
|
| 324 |
+
| Route | `field`, `context`, `base_position` | 20 positions at +6 h to +120 h |
|
| 325 |
+
| Intensity/structure | `causal_features`, `anchor_structure` | wind, pressure, RMW, R34/R50/R64 |
|
| 326 |
+
| Optional ocean calibration | `ocean_features`, `ocean_available` | calibrated structure beside the neural result |
|
| 327 |
+
|
| 328 |
+
The public wrapper intentionally does not download raw weather data. Source
|
| 329 |
+
preprocessing must preserve issue-time timestamps, units, missing-data masks,
|
| 330 |
+
and the tensor contracts above. A valid packet for a historical hindcast must
|
| 331 |
+
also exclude all observations after its chosen issue time; later IBTrACS rows
|
| 332 |
+
are verification targets only.
|
| 333 |
+
|
| 334 |
Load from an extracted GitHub Release bundle:
|
| 335 |
|
| 336 |
```python
|
|
|
|
| 491 |
|
| 492 |
[Trackformer 1.1](https://github.com/yu314-coder/typhoon-predict/releases/tag/trackformer-1.1)
|
| 493 |
remains available as a historical baseline. It is not mixed into the
|
| 494 |
+
Trackformer 1.2 weights or ensemble.
|
| 495 |
|
| 496 |
## Limitations
|
| 497 |
|
examples/predict_trackformer_1_2.py
CHANGED
|
@@ -1,15 +1,16 @@
|
|
| 1 |
#!/usr/bin/env python3
|
| 2 |
-
"""Run
|
| 3 |
|
| 4 |
-
The NPZ
|
| 5 |
field [B,6,25,61], context [B,647], base_position [B,20,2]
|
| 6 |
-
or the intensity group:
|
| 7 |
causal_features [B,1020], anchor_structure [B,20,15]
|
| 8 |
|
| 9 |
-
For
|
| 10 |
-
ocean_available [B].
|
| 11 |
-
the forecast issue time or earlier.
|
| 12 |
-
forecast products.
|
|
|
|
| 13 |
"""
|
| 14 |
|
| 15 |
from __future__ import annotations
|
|
@@ -19,35 +20,81 @@ from pathlib import Path
|
|
| 19 |
|
| 20 |
import numpy as np
|
| 21 |
|
| 22 |
-
from trackformer_1_2 import Trackformer12, local_position_to_latlon
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
|
| 24 |
|
| 25 |
def main() -> None:
|
| 26 |
parser = argparse.ArgumentParser(description=__doc__)
|
| 27 |
parser.add_argument("--input", required=True, type=Path, help="causal issue packet .npz")
|
| 28 |
-
parser.add_argument("--output", required=True, type=Path, help="output .npz")
|
| 29 |
-
parser.add_argument("--model-root", type=Path, help="extracted models/trackformer_1_2 directory")
|
| 30 |
parser.add_argument("--device", default=None, help="auto, cpu, mps, or cuda")
|
| 31 |
parser.add_argument("--issue-latitude", type=float, help="optional latitude for route conversion")
|
| 32 |
parser.add_argument("--issue-longitude", type=float, help="optional longitude for route conversion")
|
| 33 |
args = parser.parse_args()
|
| 34 |
|
| 35 |
-
|
| 36 |
-
packet = {key: source[key] for key in source.files}
|
| 37 |
model = Trackformer12.from_pretrained(args.model_root, device=None if args.device in (None, "auto") else args.device)
|
| 38 |
result = model.predict_issue_packet(packet)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
flat: dict[str, np.ndarray] = {}
|
| 40 |
for head, values in result.items():
|
| 41 |
for key, value in values.items():
|
| 42 |
flat[f"{head}_{key}"] = np.asarray(value)
|
| 43 |
-
|
| 44 |
-
|
|
|
|
|
|
|
| 45 |
flat["route_latitude"] = latitude
|
| 46 |
flat["route_longitude"] = longitude
|
| 47 |
args.output.parent.mkdir(parents=True, exist_ok=True)
|
| 48 |
np.savez_compressed(args.output, **flat)
|
|
|
|
|
|
|
| 49 |
print(f"wrote {args.output}")
|
| 50 |
-
|
|
|
|
|
|
|
| 51 |
|
| 52 |
|
| 53 |
if __name__ == "__main__":
|
|
|
|
| 1 |
#!/usr/bin/env python3
|
| 2 |
+
"""Run Trackformer 1.2 on a causal issue packet.
|
| 3 |
|
| 4 |
+
The NPZ may contain the route group:
|
| 5 |
field [B,6,25,61], context [B,647], base_position [B,20,2]
|
| 6 |
+
and/or the intensity group:
|
| 7 |
causal_features [B,1020], anchor_structure [B,20,15]
|
| 8 |
|
| 9 |
+
For optional ocean calibration, also provide ocean_features [B,66] and
|
| 10 |
+
ocean_available [B]. All arrays must be constructed from data available at
|
| 11 |
+
the forecast issue time or earlier. This script never downloads raw data or
|
| 12 |
+
official forecast products. It rejects packet keys that name official forecast
|
| 13 |
+
sources so an accidental positive-lead input fails early.
|
| 14 |
"""
|
| 15 |
|
| 16 |
from __future__ import annotations
|
|
|
|
| 20 |
|
| 21 |
import numpy as np
|
| 22 |
|
| 23 |
+
from trackformer_1_2 import MODEL_VERSION, Trackformer12, local_position_to_latlon
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
FORBIDDEN_SOURCE_TOKENS = (
|
| 27 |
+
"jma", "jtwc", "ecmwf", "gfs", "gefs", "weathernext", "deepmind",
|
| 28 |
+
"weatherlab",
|
| 29 |
+
)
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
def load_causal_packet(path: Path) -> dict[str, np.ndarray]:
|
| 33 |
+
"""Load an NPZ packet and reject obvious official-forecast source keys."""
|
| 34 |
+
|
| 35 |
+
with np.load(path, allow_pickle=False) as source:
|
| 36 |
+
packet = {key: source[key] for key in source.files}
|
| 37 |
+
forbidden = [
|
| 38 |
+
key for key in packet
|
| 39 |
+
if any(token in key.lower() for token in FORBIDDEN_SOURCE_TOKENS)
|
| 40 |
+
]
|
| 41 |
+
if forbidden:
|
| 42 |
+
raise ValueError(
|
| 43 |
+
"packet contains forbidden official-forecast source keys: "
|
| 44 |
+
+ ", ".join(sorted(forbidden))
|
| 45 |
+
)
|
| 46 |
+
return packet
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
def scalar_metadata(packet: dict[str, np.ndarray], key: str) -> float | None:
|
| 50 |
+
"""Return a scalar issue-location metadata value when one is present."""
|
| 51 |
+
|
| 52 |
+
value = packet.get(key)
|
| 53 |
+
if value is None:
|
| 54 |
+
return None
|
| 55 |
+
array = np.asarray(value)
|
| 56 |
+
if array.size != 1:
|
| 57 |
+
raise ValueError(f"{key} must contain exactly one scalar value")
|
| 58 |
+
return float(array.reshape(-1)[0])
|
| 59 |
|
| 60 |
|
| 61 |
def main() -> None:
|
| 62 |
parser = argparse.ArgumentParser(description=__doc__)
|
| 63 |
parser.add_argument("--input", required=True, type=Path, help="causal issue packet .npz")
|
| 64 |
+
parser.add_argument("--output", required=True, type=Path, help="output forecast .npz")
|
| 65 |
+
parser.add_argument("--model-root", type=Path, help="extracted models/trackformer_1_2 directory; omit to use Hugging Face")
|
| 66 |
parser.add_argument("--device", default=None, help="auto, cpu, mps, or cuda")
|
| 67 |
parser.add_argument("--issue-latitude", type=float, help="optional latitude for route conversion")
|
| 68 |
parser.add_argument("--issue-longitude", type=float, help="optional longitude for route conversion")
|
| 69 |
args = parser.parse_args()
|
| 70 |
|
| 71 |
+
packet = load_causal_packet(args.input)
|
|
|
|
| 72 |
model = Trackformer12.from_pretrained(args.model_root, device=None if args.device in (None, "auto") else args.device)
|
| 73 |
result = model.predict_issue_packet(packet)
|
| 74 |
+
if not result:
|
| 75 |
+
raise ValueError(
|
| 76 |
+
"issue packet has no complete forecast group; provide route keys "
|
| 77 |
+
"(field, context, base_position) and/or intensity keys "
|
| 78 |
+
"(causal_features, anchor_structure)"
|
| 79 |
+
)
|
| 80 |
flat: dict[str, np.ndarray] = {}
|
| 81 |
for head, values in result.items():
|
| 82 |
for key, value in values.items():
|
| 83 |
flat[f"{head}_{key}"] = np.asarray(value)
|
| 84 |
+
issue_latitude = args.issue_latitude if args.issue_latitude is not None else scalar_metadata(packet, "issue_latitude")
|
| 85 |
+
issue_longitude = args.issue_longitude if args.issue_longitude is not None else scalar_metadata(packet, "issue_longitude")
|
| 86 |
+
if "route" in result and issue_latitude is not None and issue_longitude is not None:
|
| 87 |
+
latitude, longitude = local_position_to_latlon(result["route"]["position_100km"], issue_latitude, issue_longitude)
|
| 88 |
flat["route_latitude"] = latitude
|
| 89 |
flat["route_longitude"] = longitude
|
| 90 |
args.output.parent.mkdir(parents=True, exist_ok=True)
|
| 91 |
np.savez_compressed(args.output, **flat)
|
| 92 |
+
print(f"model: Trackformer {MODEL_VERSION}")
|
| 93 |
+
print(f"device: {model.device}")
|
| 94 |
print(f"wrote {args.output}")
|
| 95 |
+
for head, values in result.items():
|
| 96 |
+
shapes = ", ".join(f"{key}={np.asarray(value).shape}" for key, value in values.items())
|
| 97 |
+
print(f"{head}: {shapes}")
|
| 98 |
|
| 99 |
|
| 100 |
if __name__ == "__main__":
|
models/trackformer_1_2/manifest.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
{
|
| 2 |
-
"model_name": "Trackformer 1.2
|
| 3 |
"release_tag": "trackformer-1.2.28",
|
| 4 |
"status": "promoted_research_candidate",
|
| 5 |
"task": "causal western-Pacific tropical-cyclone track and intensity forecasting",
|
|
@@ -39,7 +39,7 @@
|
|
| 39 |
"r50_mae_km": 25.417385,
|
| 40 |
"r64_mae_km": 14.766924
|
| 41 |
},
|
| 42 |
-
"
|
| 43 |
"maximum_wind_mae_kt": 19.617579,
|
| 44 |
"central_pressure_mae_hpa": 13.518673,
|
| 45 |
"mean_radius_mae_km": 28.943916,
|
|
|
|
| 1 |
{
|
| 2 |
+
"model_name": "Trackformer 1.2",
|
| 3 |
"release_tag": "trackformer-1.2.28",
|
| 4 |
"status": "promoted_research_candidate",
|
| 5 |
"task": "causal western-Pacific tropical-cyclone track and intensity forecasting",
|
|
|
|
| 39 |
"r50_mae_km": 25.417385,
|
| 40 |
"r64_mae_km": 14.766924
|
| 41 |
},
|
| 42 |
+
"trackformer_1_2": {
|
| 43 |
"maximum_wind_mae_kt": 19.617579,
|
| 44 |
"central_pressure_mae_hpa": 13.518673,
|
| 45 |
"mean_radius_mae_km": 28.943916,
|
paper/{trackformer_1_2_28_vs_1_1_matched100_mae.png → trackformer_1_2_vs_1_1_matched100_mae.png}
RENAMED
|
File without changes
|
paper/{trackformer_1_2_28_vs_1_1_matched100_metrics.json → trackformer_1_2_vs_1_1_matched100_metrics.json}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
{
|
| 2 |
-
"comparison": "Trackformer 1.1 vs Trackformer 1.2
|
| 3 |
"storm_count": 100,
|
| 4 |
"issue_rule": "sorted common storms with current, t-12 h, and t-24 h causal analysis snapshots; earliest available test initialization per storm",
|
| 5 |
"leads_hours": [
|
|
@@ -45,7 +45,7 @@
|
|
| 45 |
"rmw_mae_all_leads_km": 26.396,
|
| 46 |
"r34_mae_all_leads_km": 57.253
|
| 47 |
},
|
| 48 |
-
"
|
| 49 |
"mean_track_error_km_all_leads": 398.419,
|
| 50 |
"mean_track_error_km_120h": 808.607,
|
| 51 |
"median_track_error_km_all_leads": 305.711,
|
|
@@ -62,19 +62,19 @@
|
|
| 62 |
},
|
| 63 |
"interpretation": {
|
| 64 |
"better_at_120h": [
|
| 65 |
-
"
|
| 66 |
-
"
|
| 67 |
],
|
| 68 |
"better_all_leads": [
|
| 69 |
-
"
|
| 70 |
-
"
|
| 71 |
-
"
|
| 72 |
-
"
|
| 73 |
],
|
| 74 |
"not_better_at_120h": [
|
| 75 |
-
"
|
| 76 |
-
"
|
| 77 |
],
|
| 78 |
-
"claim_boundary": "This matched benchmark does not support a claim that Trackformer 1.2
|
| 79 |
}
|
| 80 |
}
|
|
|
|
| 1 |
{
|
| 2 |
+
"comparison": "Trackformer 1.1 vs Trackformer 1.2, matched 100-storm held-out test",
|
| 3 |
"storm_count": 100,
|
| 4 |
"issue_rule": "sorted common storms with current, t-12 h, and t-24 h causal analysis snapshots; earliest available test initialization per storm",
|
| 5 |
"leads_hours": [
|
|
|
|
| 45 |
"rmw_mae_all_leads_km": 26.396,
|
| 46 |
"r34_mae_all_leads_km": 57.253
|
| 47 |
},
|
| 48 |
+
"trackformer_1_2": {
|
| 49 |
"mean_track_error_km_all_leads": 398.419,
|
| 50 |
"mean_track_error_km_120h": 808.607,
|
| 51 |
"median_track_error_km_all_leads": 305.711,
|
|
|
|
| 62 |
},
|
| 63 |
"interpretation": {
|
| 64 |
"better_at_120h": [
|
| 65 |
+
"trackformer_1_2 wind",
|
| 66 |
+
"trackformer_1_2 pressure"
|
| 67 |
],
|
| 68 |
"better_all_leads": [
|
| 69 |
+
"trackformer_1_2 track",
|
| 70 |
+
"trackformer_1_2 wind",
|
| 71 |
+
"trackformer_1_2 pressure",
|
| 72 |
+
"trackformer_1_2 R34"
|
| 73 |
],
|
| 74 |
"not_better_at_120h": [
|
| 75 |
+
"trackformer_1_2 RMW",
|
| 76 |
+
"trackformer_1_2 R34"
|
| 77 |
],
|
| 78 |
+
"claim_boundary": "This matched benchmark does not support a claim that Trackformer 1.2 wins every output."
|
| 79 |
}
|
| 80 |
}
|
trackformer_1_2.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
"""Public Trackformer 1.2
|
| 2 |
|
| 3 |
The release checkpoints are trained on causal issue-time inputs. This module
|
| 4 |
does not download or accept JMA/JTWC/ECMWF/GFS/GEFS forecast products. It
|
|
@@ -32,7 +32,7 @@ from scipy.ndimage import maximum_filter, minimum_filter
|
|
| 32 |
LEADS = 20
|
| 33 |
LEAD_HOURS = tuple(range(6, 121, 6))
|
| 34 |
STRUCTURE_DIM = 15
|
| 35 |
-
MODEL_VERSION = "1.2
|
| 36 |
ROUTE_CONTEXT_DIM = 647
|
| 37 |
INTENSITY_FEATURE_DIM = 1020
|
| 38 |
INTENSITY_INPUT_DIM = 1320
|
|
@@ -997,7 +997,7 @@ class _ResidualCurveModel(nn.Module):
|
|
| 997 |
|
| 998 |
|
| 999 |
class Trackformer12:
|
| 1000 |
-
"""Load and run the released Trackformer 1.2
|
| 1001 |
|
| 1002 |
def __init__(self, model_root: str | Path, device: str | torch.device | None = None):
|
| 1003 |
self.model_root = self._resolve_root(Path(model_root))
|
|
@@ -1222,7 +1222,7 @@ class Trackformer12:
|
|
| 1222 |
__all__ = [
|
| 1223 |
"FIELD_HEIGHT", "FIELD_WIDTH", "INTENSITY_FEATURE_DIM", "INTENSITY_INPUT_DIM", "LEADS", "LEAD_HOURS",
|
| 1224 |
"OCEAN_FEATURE_DIM", "ROUTE_CONTEXT_DIM", "ROUTE_LATITUDES", "ROUTE_LONGITUDES",
|
| 1225 |
-
"ROUTE_SYSTEM_CHANNELS", "STRUCTURE_DIM", "Trackformer12",
|
| 1226 |
"build_base_position", "build_causal_anchor_structure", "build_causal_structure_features",
|
| 1227 |
"build_intensity_context_features", "build_kinematic_base_position", "build_ocean_features",
|
| 1228 |
"build_nearby_interaction_features", "build_patch_summary", "build_route_context",
|
|
|
|
| 1 |
+
"""Public Trackformer 1.2 inference API.
|
| 2 |
|
| 3 |
The release checkpoints are trained on causal issue-time inputs. This module
|
| 4 |
does not download or accept JMA/JTWC/ECMWF/GFS/GEFS forecast products. It
|
|
|
|
| 32 |
LEADS = 20
|
| 33 |
LEAD_HOURS = tuple(range(6, 121, 6))
|
| 34 |
STRUCTURE_DIM = 15
|
| 35 |
+
MODEL_VERSION = "1.2"
|
| 36 |
ROUTE_CONTEXT_DIM = 647
|
| 37 |
INTENSITY_FEATURE_DIM = 1020
|
| 38 |
INTENSITY_INPUT_DIM = 1320
|
|
|
|
| 997 |
|
| 998 |
|
| 999 |
class Trackformer12:
|
| 1000 |
+
"""Load and run the released Trackformer 1.2 causal members."""
|
| 1001 |
|
| 1002 |
def __init__(self, model_root: str | Path, device: str | torch.device | None = None):
|
| 1003 |
self.model_root = self._resolve_root(Path(model_root))
|
|
|
|
| 1222 |
__all__ = [
|
| 1223 |
"FIELD_HEIGHT", "FIELD_WIDTH", "INTENSITY_FEATURE_DIM", "INTENSITY_INPUT_DIM", "LEADS", "LEAD_HOURS",
|
| 1224 |
"OCEAN_FEATURE_DIM", "ROUTE_CONTEXT_DIM", "ROUTE_LATITUDES", "ROUTE_LONGITUDES",
|
| 1225 |
+
"MODEL_VERSION", "ROUTE_SYSTEM_CHANNELS", "STRUCTURE_DIM", "Trackformer12",
|
| 1226 |
"build_base_position", "build_causal_anchor_structure", "build_causal_structure_features",
|
| 1227 |
"build_intensity_context_features", "build_kinematic_base_position", "build_ocean_features",
|
| 1228 |
"build_nearby_interaction_features", "build_patch_summary", "build_route_context",
|