All examples
Scientific computing

Station anomalies with exact coordinate alignment

Reconcile A/B and B/A station order explicitly, retain temperature difference units and refuse a positional scientific mismatch.

Download .aner source
contextual_coordinates.aner
// Two station files have equal shapes but different coordinate order.
import aner.tensor

let current = tensor.semantic([[10.0], [20.0]], "station", List("A", "B"), "degC")
let baseline = tensor.semantic([[12.0], [9.0]], "station", List("B", "A"), "degC")
// Reindexing explicitly reconciles the declared coordinate identities.
let aligned = baseline.reindex_like(current)
let anomaly = current.subtract(aligned)

print("Baseline aligned to A, B")
print(aligned.value(0, 0))
print(aligned.value(1, 0))
print("Station anomalies")
print(anomaly.value(0, 0))
print(anomaly.value(1, 0))
print(anomaly.unit())
print("Coordinate order is preserved")
print(anomaly.coordinates())
print("First current temperature in Kelvin")
print(current.convert("K").value(0, 0))

Make it your experiment.

With Aner installed, save this program as examples/contextual_coordinates.aner inside a folder for your experiment. Open a terminal in that folder, then check and run the program.

Terminal
aner check examples/contextual_coordinates.aner
aner run examples/contextual_coordinates.aner

The aner command must be on your PATH. Follow the installation guide if your terminal cannot find it.

Use the compatible native Aner development engine and VS Code helper 0.1.38 or newer. These deterministic examples execute on CPU Float64. Native contextual operations preserve declared identities and scientific contracts; supported backends and limits are operation specific. No network or external service is required. Intentional failure sources linked from each guide are negative tests, not successful tutorial programs.

Iris and Wine are teaching datasets with their own attribution. Example outcomes are not comparative benchmarks or evidence of clinical validity.

Dataset sources & attribution
Install Aner