Public Python API
Everything exported by baro.met. The first group is what most users need;
the second is for writing a source of one's own or working on cubes directly.
met
Fast weather retrieval along aircraft trajectories.
ERA5 on model or pressure levels and forecast fields from Météo-France and Open-Meteo, interpolated with explicit coverage and no silent extrapolation. Surface queries accept fixed sites or trajectories without altitude.
Enricher
Interpolate a gridded source along trajectories.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
Source
|
Gridded source, e.g. :func: |
required |
cache_dir
|
str | Path | None
|
Optional on-disk cache of every byte read (immutable data only), shared
between runs, calls and processes: a later call downloads only what no
earlier call has read. It is attached to |
None
|
mode
|
Mode
|
|
'flight'
|
domain
|
Domain | None
|
Fixed domain for every cube. By default the points of each time slice are split along the source's tiling, and each group gets the box of its own points. |
None
|
margin_deg
|
float
|
Margin around the points when the domain is derived from them. |
0.5
|
level_margin
|
int
|
Extra levels kept above and below the bracketing levels. |
1
|
io_workers
|
int
|
Concurrent range requests, and cubes fetched ahead of interpolation. |
16
|
vertical
|
VerticalMethod
|
|
'log'
|
on_uncovered
|
Literal['warn', 'raise', 'flag']
|
What to do with points outside the period the source covers (e.g.
before the start of an archive): |
'warn'
|
Source code in packages/barograph-met/src/baro/met/enrich.py
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 | |
enrich(time_utc, lat, lon, *, altitude_ft=None, pressure_pa=None)
Fields at each point. Give barometric (pressure) altitude in ft or pressure in Pa.
Source code in packages/barograph-met/src/baro/met/enrich.py
EnrichResult
dataclass
Interpolated fields (NaN where flags != 0) and run statistics.
Source code in packages/barograph-met/src/baro/met/enrich.py
valid
property
Mask of the points with a value (no flag set).
WeatherSession
Reuse decoded weather across successive point queries, without extrapolation.
source supplies a fixed set of fields. Optional fields selects a
subset through its select_fields capability (currently GridSource);
unsupported sources must be configured with their own field selection.
vertical is required: choose "linear" or "log" in pressure.
The LRU budget bounds retained array payload, including coordinates, not
Python overhead or temporary cubes held by the active enrichment call.
Calls on one session are serialized; its normal source I/O stays parallel.
Treat a session as a snapshot: call :meth:clear to refresh decoded mutable
forecasts or ERA5T. The existing on-disk byte cache retains its own rules.
Do not mutate the source configuration while using the session.
Source code in packages/barograph-met/src/baro/met/session.py
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 | |
cache_info()
Retained array bytes, entry count and lifetime LRU counters.
Source code in packages/barograph-met/src/baro/met/session.py
clear()
Release decoded arrays after any active call; preserve lifetime counters.
sample(time_utc, lat, lon, *, pressure_pa)
Sample 1-D points using nanosecond time and explicit pressure in Pa.
Missing coverage retains Enricher flags; callers must check valid
before interpreting missing meteorology as a physical disappearance.
Time interpolation divides integer timedelta differences, never floating
epoch hours, preserving subsecond weights at modern dates.
Source code in packages/barograph-met/src/baro/met/session.py
WeatherWindowProvider
Fetch just the native weather windows requested by a forward model.
Fields are fixed at construction. The default includes CoCiP's optical
depth; when absent from the source it is computed from the complete upper
cirrus column by :func:materialize_weather, requiring optional pycontrails.
Returned containers are borrowed snapshots: their arrays are read-only;
callers must not replace coordinates, fields or metadata. Engine exports
make independent arrays. The byte budget counts retained array payload,
excluding Python overhead, active downloads, exports and caller references.
Calls are serialized. Use clear() to refresh decoded mutable data;
the underlying immutable byte cache keeps its existing policy.
Source code in packages/barograph-met/src/baro/met/windows.py
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 | |
cache_info()
Retained payload, entries and lifetime hit/miss/eviction counters.
Source code in packages/barograph-met/src/baro/met/windows.py
clear()
Release decoded windows, retaining byte caches and lifetime counters.
for_diffcocip(demand)
Driver callback: lon/lat degrees, pressure hPa, seconds since 2000.
Downloads run on the host outside JAX compilation/autodifferentiation. The driver remains responsible for complete evolution/lower-probe demands and for retrying a step when new support is required.
Source code in packages/barograph-met/src/baro/met/windows.py
get(request)
Return native met/radiation grids fully covering request.
Cache hits use actual coordinate coverage, including native bracketing neighbours. Misses use the usual targeted readers; no preadvection or whole archive retrieval is performed. Failures are never cached.
Source code in packages/barograph-met/src/baro/met/windows.py
ArcoRadiationSource
Hourly ERA5 flux averages, represented at interval midpoints in W/m².
ARCO stores one-hour energies (J/m²) at interval ends. This source divides them by 3600 and moves the interpolation coordinate back 30 minutes, exactly once. It preserves ERA5's signed net-flux convention. These are top-of-atmosphere fields, not surface irradiance. Only requested fields and occupied latitude blocks are read through the existing range reader.
grid_source permits local mirrors/tests; it must use the ERA5 ARCO
time and spatial axes. The default opens the public pressure-level store.
Source code in packages/barograph-met/src/baro/met/arco_surface.py
stats
property
Underlying transfer counters, including byte-cache hits.
coverage()
Effective interpolation coverage after the ERA5 midpoint shift.
Source code in packages/barograph-met/src/baro/met/arco_surface.py
cube_keys(t0)
Midpoint samples bracketing the actual query time.
Source code in packages/barograph-met/src/baro/met/arco_surface.py
fetch(key, domain, *, fields=None)
Read a midpoint field without downloading unrelated pressure variables.
Source code in packages/barograph-met/src/baro/met/arco_surface.py
tiling(key)
Block-sized latitude bands shared with the range reader.
EvolutionResult
dataclass
Forward result; age_limit_reached is conservative, never extinction.
Diagnostics contain only executed step ends; trailing extinct steps from
the dense scan are omitted. energy_forcing_j sums the same hard EF.
Source code in packages/barograph-met/src/baro/met/diffcocip.py
ArpegeSource
ARPEGE isobaric fields.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
resolution
|
Resolution
|
|
'01'
|
fields
|
dict[str, str] | None
|
Output name -> ARPEGE short name (default |
None
|
levels
|
Sequence[int] | None
|
Isobaric levels (hPa) allowed; default: all published levels. |
None
|
run
|
RunPolicy | datetime64 | datetime
|
|
'latest'
|
base_url
|
str
|
Where files live (HTTP base URL, local mirror directory, or a store). |
ARPEGE_BASE_URL
|
index_dir
|
str | Path | None
|
Directory caching the per-file message indexes (strongly recommended; defaults to the enricher's cache when it has one). |
None
|
Notes
The files of a published run never change: with a cache (:meth:use_cache)
every GRIB message read is kept on disk and never downloaded again.
Source code in packages/barograph-met/src/baro/met/arpege.py
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 | |
stats
property
Transfer counters of the underlying store.
coverage(max_age_s=600.0)
From the oldest published run to the last lead time of the newest one.
Source code in packages/barograph-met/src/baro/met/arpege.py
cube_keys(t0)
Cubes bracketing [t0, t0 + 1 h), both from the run chosen by :meth:run_for.
Source code in packages/barograph-met/src/baro/met/arpege.py
fetch(key, domain, p_range, *, level_margin=1, executor=None)
One validity time of one run over domain, levels bracketing p_range (Pa).
Source code in packages/barograph-met/src/baro/met/arpege.py
file_key(run, lead_h)
Path of the GRIB2 file holding lead_h hours of run.
Source code in packages/barograph-met/src/baro/met/arpege.py
published_runs()
Runs currently published (rolling ~14-day window), oldest first.
Source code in packages/barograph-met/src/baro/met/arpege.py
run_for(t0)
Run whose files hold both ends of the interval starting at t0.
Source code in packages/barograph-met/src/baro/met/arpege.py
serves(t0)
True if both ends of the interval starting at t0 are published.
Source code in packages/barograph-met/src/baro/met/arpege.py
tiling(key)
use_cache(cache)
Keep every message read in cache; message indexes go there too by default.
Source code in packages/barograph-met/src/baro/met/arpege.py
OpenMeteoSource
Bases: _ArchiveSource
Isobaric fields of one Open-Meteo archived model.
This is a stitched forecast archive, not an ERA5-like reanalysis. Original
run identities and forecast lead times are not retained (CubeKey.run
and CubeKey.lead are None). ecmwf_ifs025 provides 3-hourly data;
the enricher interpolates linearly between native valid times.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
str
|
Open-Meteo model folder, e.g. |
'meteofrance_arpege_europe'
|
fields
|
dict[str, str] | None
|
Output name -> key of :data: |
None
|
levels
|
Sequence[int] | None
|
Isobaric levels (hPa) allowed; default: all archived levels. |
None
|
base_url
|
str
|
The public bucket, or a local mirror directory with the same layout. |
OPENMETEO_BASE_URL
|
tile_deg
|
float
|
Size of the geographic tiles read and cached (degrees). |
5.0
|
cache_mb
|
float
|
Memory budget of the tile LRU. |
1024.0
|
merge_adjacent_tiles
|
bool
|
Group touching tiles into one request (default True). Set False for sparse trajectories on fine grids: each occupied tile gets its own domain and pressure range, with the enricher's interpolation margin. |
True
|
Source code in packages/barograph-met/src/baro/met/openmeteo.py
454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 | |
fetch(key, domain, p_range, *, level_margin=1, executor=None)
One native time step over domain with the levels bracketing p_range (Pa).
Source code in packages/barograph-met/src/baro/met/openmeteo.py
OpenMeteoSurfaceSource
Bases: _ArchiveSource
Native surface fields of an Open-Meteo archived model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
str
|
Native folder, default |
'meteofrance_arome_france0025'
|
fields
|
dict[str, str] | None
|
Output name -> key in OPENMETEO_SURFACE_VARIABLES. Default u10/v10/t2m, precipitation, rain and gusts. Only these variables/dependencies are read. |
None
|
base_url
|
str
|
Public bucket or local mirror. Archive forecasts extend to metadata coverage. |
OPENMETEO_BASE_URL
|
tile_deg
|
float
|
Geographic tile edge in degrees (default 0.25 for sparse surface queries). |
0.25
|
merge_adjacent_tiles
|
bool
|
Merge touching occupied tiles into one request (default False, preserving sparse point reads). Tile caches still reuse neighbouring interpolation cells. |
False
|
cache_mb
|
float
|
Tile LRU memory budget in megabytes. |
1024.0
|
Notes
Rain is max(precipitation - snowfall_water_equivalent, 0) at each native
grid point. Both archived amounts are already totals over the preceding
native period; never difference them again. Gusts are the preceding-period
maximum. Fetch returns native fields; SurfaceEnricher preserves these periods.
Heights are above model terrain; there is no terrain/bias correction.
Run/lead times are unavailable for this stitched archive.
Source code in packages/barograph-met/src/baro/met/openmeteo_surface.py
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 | |
coverage()
Common native endpoint coverage (oldest chunks may be partly empty).
Source code in packages/barograph-met/src/baro/met/openmeteo_surface.py
enrich(time, lat, lon, *, cache=None)
Convenience query; use SurfaceEnricher for a persistent cache directory.
Source code in packages/barograph-met/src/baro/met/openmeteo_surface.py
fetch(key, domain, *, fields=None)
Read one native timestamp over the requested domain, without pressure.
Source code in packages/barograph-met/src/baro/met/openmeteo_surface.py
AromeSurfaceSource
Hourly surface fields from one explicit AROME initialization (0..51 h).
fields maps output names to u10, v10, t2m, precipitation or gusts.
Precipitation is a preceding-hour amount, derived from cumulative totals
within the same run. Gusts retain the reported preceding-hour maximum.
Only the requested GRIB messages are downloaded; their immutable ranges
and per-file indexes use the shared range cache. No altitude is required.
published_runs describes files visible now, never historical availability.
Source code in packages/barograph-met/src/baro/met/arome_surface.py
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 | |
latest(valid_time, **kwargs)
classmethod
Newest run whose required files are available now for valid_time.
observed_at records when publication was checked. It is not a
historical publication timestamp and cannot establish a past cutoff.
Source code in packages/barograph-met/src/baro/met/arome_surface.py
AromePISource
Bases: _ImmediateSource
AROME-PI surface forecasts every 15 minutes, preserving one hourly run.
resolution selects the native 0.025° or 0.01° grid. The finer grid does
not provide mean u/v wind; its defaults are t2m, precipitation and gusts.
The 0.025° defaults also include u10/v10; rain is optional on either grid.
token may be a callable for credential renewal. API keys use the default
auth='apikey'; OAuth access tokens require auth='bearer'.
Source code in packages/barograph-met/src/baro/met/immediate.py
PiafSource
Bases: _ImmediateSource
Deterministic PIAF precipitation, native 5-minute amounts up to 195 minutes.
Both run cadence and output step are five minutes. Despite its WCS name containing RATE, the supported product contains interval amounts in mm, verified against the GRIB parameter, units and statistical interval.
Source code in packages/barograph-met/src/baro/met/immediate.py
SurfaceEnricher
Retrieve surface weather at fixed sites or trajectories in one batch.
Points sharing a native interval are grouped by occupied geographic tiles;
only requested fields and their interpolation neighbours are read. Supply
cache_dir for persistent byte-range caching. Inputs are UTC datetime64
(Unix nanoseconds are accepted), latitude and longitude arrays of equal
length. No altitude or pressure argument is needed.
Source code in packages/barograph-met/src/baro/met/surface.py
200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 | |
enrich(time, lat, lon)
Interpolate instants; preserve the enclosing native totals and maxima.
Source code in packages/barograph-met/src/baro/met/surface.py
SurfaceResult
dataclass
Surface query values and native support/provenance for every output.
Period fields retain full native interval totals/maxima even at fractional
query times. interval_start and interval_end are per-field arrays;
instant fields have both equal to query time. run is NaT and lead
NaT where a stitched archive has discarded the original run identity.
Source code in packages/barograph-met/src/baro/met/surface.py
valid
property
Points with every requested field available.
SourceChain
Sources of the same fields, tried in order for each interval.
Source code in packages/barograph-met/src/baro/met/chain.py
stats
property
Transfer counters of every chained source.
coverage()
Union of the chained sources' periods.
Source code in packages/barograph-met/src/baro/met/chain.py
cube_keys(t0)
Keys of the first source serving [t0, t0 + step), tagged with its id.
Source code in packages/barograph-met/src/baro/met/chain.py
fetch(key, domain, p_range, *, level_margin=1, executor=None)
Fetch from the source the key was routed to.
Source code in packages/barograph-met/src/baro/met/chain.py
tiling(key)
Tiling of the source the key was routed to.
Domain
dataclass
Latitude/longitude box; longitudes may be expressed beyond 180 (no wrap inside).
Source code in packages/barograph-met/src/baro/met/domain.py
from_points(lat, lon, margin=0.5)
classmethod
Smallest box around the points (shortest longitude arc), plus margin degrees.
Source code in packages/barograph-met/src/baro/met/domain.py
to_json()
Flag
Bases: IntFlag
Bit flags describing why a value is missing.
Source code in packages/barograph-met/src/baro/met/kernel.py
DataUnavailableError
UncoveredPointsWarning
SampleOptions
dataclass
How to interpolate on the vertical.
vertical: "log" (linear in ln p, default) or "linear" in p.
surface_pressure: "actual" (column pressures from the cube's
surface pressure) or "standard" (101325 Pa everywhere, i.e. a fixed
altitude->level table).
Source code in packages/barograph-met/src/baro/met/kernel.py
materialize_weather(source, request, *, fields=('u', 'v', 't', 'q', 'omega'), tau_cirrus=False, units=None, executor=None)
Read a pressure-level window, extending only cirrus dependencies upward.
source must map the requested aliases to native variables. Deriving
tau_cirrus additionally requires t and ciwc, the complete native
pressure-level axis, and optional pycontrails. Its height convention is
pycontrails' ISA approximation unless geopotential is configured.
Hybrid-level conversion is deliberately not implicit.
Source code in packages/barograph-met/src/baro/met/materialize.py
materialize_radiation(source, request, *, fields=None)
Read only bracketing ERA5 midpoint fluxes on the requested domain.
Source code in packages/barograph-met/src/baro/met/materialize.py
run_diffcocip(flight, provider, params, *, max_age_s)
Evolve one flight with demand-driven weather, stopping at extinction/cap.
provider supplies native-grid dicts in diffcocip's documented units.
It may use Barograph caches and return larger coverage than requested.
Requests include lower meteorological probes and wake downwash. Trial
steps outside coverage are discarded and replayed with complete weather.
The input flight follows diffcocip's dict contract (altitude in metres).
This host driver does not support autodifferentiation or smoothing.
Provider responses must describe one consistent meteorological dataset:
extending a window must not change values at previously covered nodes.
Longitudes use [-180, 180]; seam crossings can request a wide domain.
max_age_s is mandatory and overrides the corresponding params value.
Source code in packages/barograph-met/src/baro/met/diffcocip.py
arco_model_levels(*, levels=None, base_url=ARCO_BASE_URL, fields=None)
ARCO-ERA5 L137 model levels (0.25 deg, hourly) + surface pressure from the PL store.
levels restricts the hybrid levels used (default: all 137).
Source code in packages/barograph-met/src/baro/met/sources.py
arco_pressure_levels(*, levels=None, base_url=ARCO_BASE_URL, fields=None)
ARCO-ERA5 pressure levels (0.25 deg, hourly); levels in hPa (default: all 37).
Source code in packages/barograph-met/src/baro/met/sources.py
track_components(u, v, track_deg)
Along-track (tailwind > 0) and cross-track (from left to right > 0) wind.
Source code in packages/barograph-met/src/baro/met/kernel.py
pressure_from_altitude_ft(h_ft)
Static pressure (Pa) for a pressure altitude in feet.
set_host_limit(host, limit)
Change the cap for host (takes effect for hosts not contacted yet).
Source code in packages/barograph-met/src/baro/met/limits.py
Building blocks
met
Fast weather retrieval along aircraft trajectories.
ERA5 on model or pressure levels and forecast fields from Météo-France and Open-Meteo, interpolated with explicit coverage and no silent extrapolation. Surface queries accept fixed sites or trajectories without altitude.
Source
Bases: Protocol
What the enricher needs from a gridded source.
Source code in packages/barograph-met/src/baro/met/base.py
stats
property
Transfer counters of the source's stores.
coverage()
cube_keys(t0)
fetch(key, domain, p_range, *, level_margin=1, executor=None)
Read one cube; raise :class:DataUnavailableError if it does not exist.
Source code in packages/barograph-met/src/baro/met/base.py
tiling(key)
SurfaceSource
Bases: Protocol
Native gridded surface-source contract, separate from pressure fields.
Source code in packages/barograph-met/src/baro/met/surface.py
SurfaceCube
dataclass
Native valid-time surface fields on an ascending regular lat/lon grid.
Source code in packages/barograph-met/src/baro/met/surface.py
sample(lat, lon, *, fields=None)
Bilinearly interpolate the grid without horizontal extrapolation.
Source code in packages/barograph-met/src/baro/met/surface.py
SurfaceVariable
dataclass
Unit, height above ground and native temporal meaning of one field.
height_m is NaN when no finite height applies, as for a
top-of-atmosphere radiative boundary.
Source code in packages/barograph-met/src/baro/met/surface.py
CubeKey
dataclass
Validity time of a cube and, for forecasts, the run it belongs to.
Source code in packages/barograph-met/src/baro/met/base.py
lead
property
Forecast lead time, or None for analyses and stitched forecast archives.
Cube
dataclass
One hour of gridded fields on a regional grid, levels top to bottom.
Source code in packages/barograph-met/src/baro/met/domain.py
nbytes
property
Memory held by the fields and surface pressure.
WeatherCube
dataclass
Bases: RadiationCube
Pressure-level grid with dimensions (lon, lat, level_hpa, time).
A cube may contain wind only; CoCiP exports require u, v, t, q, omega,
tau_cirrus. Optical depth must be supplied after a correct full-column
calculation; it cannot safely be derived from a cropped pressure slab.
Source code in packages/barograph-met/src/baro/met/weather.py
coordinates
property
Engine coordinates, including pressure in hPa.
shape
property
Required array shape in export axis order.
specs
property
Pressure-level fields and units.
__post_init__()
Validate the pressure axis and inherited grid contract.
Source code in packages/barograph-met/src/baro/met/weather.py
RadiationCube
dataclass
TOA flux grid with explicitly resolved timestamps.
Arrays have dimensions (lon, lat, time). time_semantics must be
valid (instantaneous flux) or interval_midpoint (mean flux assigned
to its averaging-interval midpoint). Interval-end or accumulated radiation
must be converted upstream. No engine export shifts these timestamps.
Source code in packages/barograph-met/src/baro/met/weather.py
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 | |
coordinates
property
Coordinates in native engine dimension order.
coverage
property
Inclusive coordinate bounds, without implying extrapolation support.
shape
property
Required array shape in export axis order.
specs
property
Recognized variables, canonical and engine units.
__post_init__()
Validate axes, shape, units, and timestamp semantics.
Source code in packages/barograph-met/src/baro/met/weather.py
to_diffcocip()
Export the NumPy dict accepted by diffcocip, without importing JAX.
Every interpolation axis needs at least two points. The engine's time bridge uses seconds since 2000; grids before this epoch are rejected. Metadata stays available on this container, not in the engine dict.
Source code in packages/barograph-met/src/baro/met/weather.py
to_pycontrails(*, require_cocip=True)
Export an optional pycontrails MetDataset with resolved time metadata.
Import pycontrails and xarray only on this call. Radiation's time
coordinate is marked as resolved, preventing a second engine shift.
Set require_cocip=False to export partial fields for preprocessing.
Source code in packages/barograph-met/src/baro/met/weather.py
WeatherRequest
dataclass
Region, UTC time bounds and pressure range (Pa) requiring interpolation.
Includes neighbouring native times and pressure levels, without imposing a fixed integration horizon. Callers supply margins for lower probes, sedimentation and evolution; a window is not a bound on future motion.
Source code in packages/barograph-met/src/baro/met/materialize.py
WeatherDemand
dataclass
Exact probe coordinates to cover, including interpolation neighbours.
points columns are longitude degrees, latitude degrees, pressure hPa,
and seconds since 2000-01-01. Radiation ignores the pressure column.
A provider returns complete diffcocip met/radiation dictionaries covering
all probes in this request. Radiation values must be W/m² at midpoints.
Spatial/time bounds are requests, never permission to extrapolate.
Source code in packages/barograph-met/src/baro/met/diffcocip.py
bounds
property
Minimum/maximum requested coordinates, in diffcocip units.
PycontrailsWeather
Supply lazy native pressure grids and optional resolved radiation grids.
datasets creates pycontrails MetDataset objects with no field reads.
Source constructors may already have read coordinate metadata. Fields are
read only when the consumer evaluates an indexed array. The retained-cache
budget excludes source buffers, tau-column temporaries, xarray/consumer
caches and caller-held arrays; it is not a process memory limit.
Metadata comes from source attributes or explicit provenance; unknown
metadata stays unknown. Radiation times are already resolved by its source.
Use native CoCiP with interpolation_bounds_error=True and
compute_tau_cirrus_in_model_init=False to preserve strict coverage and
lazy cirrus reads. Missing/nonfinite weather raises, never means extinction.
Only final source time chunks qualify for bridge retention; recent ERA5T
is always materialized anew. Do not mutate source configuration in use.
Source code in packages/barograph-met/src/baro/met/pycontrails.py
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 | |
cache_info()
Bounded retention and cumulative successful field materialization counters.
Source code in packages/barograph-met/src/baro/met/pycontrails.py
clear()
Drop bridge-owned arrays; consumer/xarray caches may retain their copies.
datasets(start, end)
Construct metadata-only lazy datasets covering the requested UTC interval.
Times are bracketed with each source's own cadence and origin. Spatial
and pressure axes remain native; a global longitude axis is closed at
its periodic seam. An omitted radiation source returns None.
Source code in packages/barograph-met/src/baro/met/pycontrails.py
GridSource
An hourly, regular lat/lon zarr store with a level dimension.
vertical lists all levels of the store's level axis, in the store's
order (top to bottom). Cubes carry only the levels needed to bracket the
requested pressures, read with block-level range requests. With a cache
(:meth:use_cache), the field chunks of hours older than final_after
are kept on disk; metadata and recent (ERA5T) hours are always re-read.
Source code in packages/barograph-met/src/baro/met/sources.py
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 | |
stats
property
Transfer counters of every underlying byte store.
configure_decoded_cache(max_bytes)
Bound decoded Blosc reuse to final field chunks, using final_after.
Field views share this reader and its budget. Recent ERA5T chunks never qualify. Surface pressure in a separate reader has its own budget.
Source code in packages/barograph-met/src/baro/met/sources.py
coverage()
Published period, from the store's valid_time_start/valid_time_stop.
For ARCO-ERA5 the model-level store lags ERA5T (about three months).
Source code in packages/barograph-met/src/baro/met/sources.py
cube_keys(t0)
Analyses at t0 and one hour later (no run: reanalysis).
fetch(key, domain, p_range, *, level_margin=1, executor=None)
Read one hour over domain with the levels bracketing p_range (Pa).
Source code in packages/barograph-met/src/baro/met/sources.py
select_fields(names)
Independent field view sharing stores and byte caches with this source.
Only listed output fields are fetched. Cache eligibility retains all original fields, so attaching a cache through a view cannot narrow the parent's cache policy. Configure shared stores before concurrent use.
Source code in packages/barograph-met/src/baro/met/sources.py
tiling(key)
Latitude bands of about one Blosc block (every longitude), the same for every hour.
Read once from the header of one fixed chunk (the first published hour), so every call and process probes the same, cacheable, few KiB.
Source code in packages/barograph-met/src/baro/met/sources.py
time_index(hour)
Index of hour on the store's time axis, verified against the time array.
The axis is assumed hourly and contiguous; each time chunk is checked once (a few KiB) before its indices are trusted.
Source code in packages/barograph-met/src/baro/met/sources.py
use_cache(cache)
Keep the final hours' field chunks in cache (see the class docstring).
Source code in packages/barograph-met/src/baro/met/sources.py
Tiling
dataclass
Regular tiling of a grid: tile (i, j) starts at lat0 + i * lat_step.
lon_step=None means tiles span every longitude (ARCO-ERA5 bands).
merge_adjacent=False groups points by their own tile, keeping long
connected trajectories from requesting large mostly empty rectangles.
Source code in packages/barograph-met/src/baro/met/tiling.py
n_cols
property
Number of tile columns around the globe.
RangeCache
Immutable byte-range cache rooted at root (see the module docstring).
Source code in packages/barograph-met/src/baro/met/rangecache.py
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 | |
get(namespace, key, start, stop, fetch)
Bytes [start, stop) of key, fetching only the missing sub-ranges.
fetch(a, b) downloads [a, b); a shorter answer marks the end of
the object, and the result is then truncated there like a range read.
Source code in packages/barograph-met/src/baro/met/rangecache.py
get_full(namespace, key, fetch_all)
The whole object key, fetched once.
Source code in packages/barograph-met/src/baro/met/rangecache.py
lookup(namespace, key, start, stop)
Bytes [start, stop) of key if they are all on disk, else None.
For callers that deduplicate their own concurrent fetches (the
Open-Meteo page reader); they keep what they fetched with :meth:put.
Source code in packages/barograph-met/src/baro/met/rangecache.py
object_dir(namespace, key)
Folder of one object of one namespace.
put(namespace, key, start, data)
Keep data, the bytes of key from start on.
VerticalCoordinate
dataclass
Full-level pressures A + B * ps for a set of native level identifiers.
Source code in packages/barograph-met/src/baro/met/vertical.py
needs_surface_pressure
property
True for hybrid levels (pressures depend on the surface pressure).
pressure(ps)
Full-level pressure (Pa); ps broadcasts on a trailing level axis.
select_bracketing(p_min, p_max, ps_min, ps_max, margin=1)
Positions of the levels needed to bracket pressures in [p_min, p_max].
The level pressures move with ps: a level is kept if, for some
ps in [ps_min, ps_max], it can be the level just above or just
below a target pressure. margin extra levels are added on each side.
Source code in packages/barograph-met/src/baro/met/vertical.py
subset(positions)
The levels at positions.
model_levels(ids=None)
ERA5 L137 full levels (default: all 137, hybrid index 1 = model top).
Source code in packages/barograph-met/src/baro/met/vertical.py
pressure_levels(hpa)
Isobaric levels given in hPa (must be strictly increasing).
Source code in packages/barograph-met/src/baro/met/vertical.py
sample(cube, lat, lon, pressure, options=None)
Interpolate every cube field at the given positions (pressure in Pa).