Output and visualization API
Output defines snapshot capture and persistence. Observations owns observation sampling ([output.observations]: point events and station series sampled at met-window ends). Visualization provides topology-aware field views and optional Makie rendering for those snapshots.
Output
AtmosTransport.Output Module
OutputTopology-aware diagnostic output for AtmosTransport runtime products.
This module owns the public NetCDF output contract. Runtime code should capture model state with capture_snapshot and write files with write_snapshot_netcdf instead of defining ad-hoc NetCDF layouts in runner code.
The writer is intentionally topology-dispatched:
LatLonMeshwrites regular CF lon/lat coordinates.ReducedGaussianMeshwrites native cell-indexed diagnostics plus a legacy lon/lat raster view for current debug plots.CubedSphereMeshwrites panel-native diagnostics with GEOS-stylelons,lats,corner_lons,corner_lats,cell_area, andcubed_spheremetadata so Panoply and downstream tools have enough geometry context to render C-grid snapshots.
New topologies should add methods for the small internal schema/diagnostic functions in this folder; they should not special-case the runner.
Observation sampling lives in AtmosTransport.Observations.
AtmosTransport.Output.RuntimeOutputMetadata Type
Metadata resolved from the typed physics objects of one runtime invocation.
sourceAtmosTransport.Output.SelectedSnapshotFrame Type
SelectedSnapshotFrameCPU-resident output containing only requested levels and column reductions. nlevel preserves the original vertical coordinate. levels maps stored layers back to model levels; column sums are computed before selecting layers. Tracer storage is VMR × air mass, with no molecular-weight conversion.
AtmosTransport.Output.SnapshotFrame Type
SnapshotFrameCPU-resident snapshot of one model state at one output time.
air_mass and each entry in tracers keep the topology-native storage shape:
LL:
(lon, lat, lev)RG:
(cell, lev)CS:
NTuple{6, Array{T, 3}}with panel interiors(Xdim, Ydim, lev)
Tracer arrays store the model's conservative χ × carrier-air-mass quantity, not mixing ratio or physical kg species. Derived VMR and column diagnostics are computed by write_snapshot_netcdf. tracer_total_mass stores a compensated Float64 sum of that conservative quantity for every tracer. It is kept separately so Float32 visualization payloads cannot degrade global signed mass diagnostics through cancellation or output conversion.
Snapshot storage must be CPU-resident. Use capture_snapshot for model state on any backend; it strips cubed-sphere halos and copies device arrays to the host before constructing the frame.
AtmosTransport.Output.SnapshotWriteOptions Type
SnapshotWriteOptions(; float_type=Float32, deflate_level=0, shuffle=true)Options controlling NetCDF snapshot output.
float_typeis the on-disk type for heavy diagnostic variables.deflate_levelis the NetCDF compression level for heavy payload variables:0disables compression,1is fast/light, and9is maximum compression.shuffleenables the NetCDF shuffle filter when compression is active.
AtmosTransport.Output.capture_snapshot Method
capture_snapshot(model; time_hours=0, halo_width=0, fields=nothing)Capture air-mass and conservative tracer-storage fields from a TransportModel. Without fields, return a full SnapshotFrame. Passing an OutputFieldSpec returns a SelectedSnapshotFrame containing only requested layers and column diagnostics, plus compensated Float64 totals for the selected tracers.
The result is CPU-resident and topology-native. For cubed-sphere states, halo_width strips panel halos before writing. GPU-backed arrays are copied to host memory by Array(...).
AtmosTransport.Output.check_output_targets Method
check_output_targets(spec, output_cfg)Reject snapshot settings that would silently write nothing while [output].enabled is true: a path without any snapshot-schedule key, or snapshot times without a path. An explicitly empty list (hours = []) is a deliberate "no snapshots" (the path then only names the timing CSV of ATMOSTR_TIMERS runs).
AtmosTransport.Output.column_mean_mixing_ratio Method
column_mean_mixing_ratio(air_mass, tracer_storage)Compute the air-mass-weighted vertical mean mixing ratio for one snapshot field.
The returned shape is topology-native horizontal storage:
LL:
(lon, lat)RG:
(cell,)CS:
NTuple{6, Matrix{Float64}}
AtmosTransport.Output.define_cs_horizontal_geometry! Method
define_cs_horizontal_geometry!(ds, mesh::CubedSphereMesh) -> nothingDefine the horizontal geometry of a panel-native cubed-sphere NetCDF file in the open dataset ds: the GEOS-style layout shared by runtime snapshots and cs_native input files. Vertical and time axes are not defined here; each writer owns those.
Dimensions Xdim, Ydim (Nc), Xcorner, Ycorner (Nc + 1) and nf (6). Variables (coordinates and geometry in Float64 whatever the mesh precision):
Xdim,Ydim: panel indices1:Nc, taggeddegrees_east/degrees_north("Fake Longitude/Latitude for GrADS Compatibility", the GEOS-Chem convention) so Panoply and GrADS render a per-panel map;nf(Int32): panel1:6.lons,lats(Xdim, Ydim, nf): cell-centre longitude and latitude [degrees], frompanel_cell_center_lonlatin the mesh's panel convention.corner_lons,corner_lats(Xcorner, Ycorner, nf): cell corners [degrees], frompanel_cell_corner_lonlat.cell_area(Xdim, Ydim, nf)[m²]: the mesh's own cell areas (the areas the runtime multiplies fluxes by), withcoordinates = "lons lats".cubed_sphere(scalar Int32): grid mapping withgrid_mapping_name,cs_definition,cs_coordinate_law,cs_center_law,panel_convention,longitude_of_central_meridian,semi_major_axis = mesh.radius[m] andinverse_flattening = 0. Panel data variables point at it withgrid_mapping = "cubed_sphere"andcoordinates = "lons lats".
The same definition tags are also written as global attributes (Nc, cs_definition, cs_coordinate_law, cs_center_law, panel_convention, grid_mapping_name, longitude_of_central_meridian); readers rebuild the mesh from them.
AtmosTransport.Output.define_product_attributes! Method
define_product_attributes!(ds, mesh, mass_basis, title, contract)Write the ordered common NetCDF attributes shared by snapshots and observations. Product-specific metadata and provenance are written by the caller afterward.
sourceAtmosTransport.Output.define_provenance_attributes! Method
define_provenance_attributes!(ds) -> (; creation_date, git_commit, git_dirty)Write the automated provenance block shared by every NetCDF file AtmosTransport writes (snapshots, observation files, and generated input files) as global attributes of the open dataset ds:
| Attribute | Value |
|---|---|
creation_date | write time, ISO 8601 UTC with a Z suffix |
framework | "AtmosTransport.jl" |
framework_commit | commit of the source tree (AtmosTransport.source_revision()) |
framework_dirty | "clean", "dirty" or "unknown" |
runtime | Julia version, machine triple and operating system |
hostname, user | host name and USER (or USERNAME) |
Every value is best-effort and falls back to "unknown" instead of throwing, so a tree without git still produces a complete block. Returns the creation date and the source-tree state so the caller can compose its history line.
AtmosTransport.Output.layer_mass_per_area Method
layer_mass_per_area(field, mesh)Convert per-cell layer mass [kg cell⁻¹] to mass per horizontal area [kg m⁻²] without changing topology-native storage.
AtmosTransport.Output.read_snapshot_binary Method
read_snapshot_binary(path) -> (; header, grid, frames, mass_basis)Read the cubed-sphere ATMSNAP1 snapshot format. Reconstruct the original mesh precision and preserve the authoritative Float64 tracer totals in the header.
sourceAtmosTransport.Output.runtime_output_spec Method
runtime_output_spec(output_cfg, FT; default_path="", default_cap_hours=8760, fallback_hours=[])Parse the run-time output contract from TOML-compatible [output] settings.
Preferred keys are path, cadence_hours or hours, and split = "single" | "daily". Legacy snapshot_file, snapshot_hours, and snapshot_interval_hours remain accepted.
AtmosTransport.Output.with_netcdf_lock Method
with_netcdf_lock(f)Run f() holding the process-wide NetCDF lock. Every runtime NetCDF write (snapshot files, the snapshot stream, observation streams) goes through it, because netcdf-c is not thread-safe and daily snapshot files are written on a background task.
AtmosTransport.Output.write_snapshot_binary Method
write_snapshot_binary(path, frames, grid; mass_basis=:dry, options=SnapshotWriteOptions(),
physics_attributes=Dict())Write CS snapshots to a self-describing binary file. Skips NetCDF library overhead entirely; pair with scripts/postprocess/binary_to_netcdf.jl for the offline conversion. Throws if grid.horizontal is not a CubedSphereMesh.
AtmosTransport.Output.write_snapshot_netcdf Method
write_snapshot_netcdf(path, frames, grid; mass_basis=:dry, options=SnapshotWriteOptions(),
fields=output_field_spec(), physics_attributes=Dict())Write topology-aware runtime snapshots to NetCDF.
By default the output contains full per-level VMR fields, stored air mass, layer mass-per-area diagnostics, column air mass per area, and tracer column means; fields (an OutputFieldSpec) selects tracers, layers and diagnostics. Every written tracer also gets its Float64 <tracer>_total_mass(time). Reduced-Gaussian files also carry a legacy lon/lat raster view for quick plots. Cubed-sphere files carry panel lon/lat coordinates and a cubed_sphere grid-mapping variable modeled after GEOS-Chem diagnostics.
Observations
Import sampling and retrieval APIs from AtmosTransport.Observations. Its Retrievals, Sources and Sampling submodules separate the column operator, input records and runtime sampling. Their public names are re-exported by Observations.
AtmosTransport.Observations Module
Observation sources, retrieval columns, placement, sampling and NetCDF sinks.
sourceAtmosTransport.Observations.Retrievals.AbstractRetrievalMapping Type
AbstractRetrievalMappingHow the profile values of a retrieval relate to its pressures, and so how the model column is mapped onto them (the projection matrix retrieval_column_weights!): LayerRebin (values are layer means between interfaces) or HatLevelProjection (values on levels, the profile linear in pressure between them). A RetrievalColumn carries one; the operator dispatches on it.
AtmosTransport.Observations.Retrievals.HatLevelProjection Type
HatLevelProjection()Retrieval values sit on N levels and the profile is linear in pressure between them: the OCO-2 and OCO-3 retrievals (20 levels, "defined on layer boundaries", the first at
so retrieval_mapping = "hat_levels".
AtmosTransport.Observations.Retrievals.LayerRebin Type
LayerRebin()Retrieval values are means over N layers between N + 1 interfaces (a TCCON or GOSAT layer grid, TM5-4DVar's 19-layer form of OCO-2, tm5_layer_column). The model column, stretched onto the retrieval column, is rebinned by pressure overlap: inv_rebin (pressure-overlap rebin). Stored as retrieval_mapping = "layer_rebin".
AtmosTransport.Observations.Retrievals.RetrievalColumn Type
RetrievalColumn(pressure_pa, pressure_weight, averaging_kernel, prior_profile,
profile_sigma, surface_pressure_pa[, mapping = LayerRebin()[, prior_column = NaN]])
RetrievalColumn(; pressure_pa, pressure_weight, averaging_kernel, prior_profile,
profile_sigma = Float64[], surface_pressure_pa = first(pressure_pa),
mapping = LayerRebin(), prior_column = NaN)The vertical description of one retrieved column average (a satellite or TCCON sounding) with N retrieval values, ordered from the surface up. The mapping (AbstractRetrievalMapping) says what the values are:
LayerRebin: means overNlayers;pressure_paholds theN + 1layer interfaces;HatLevelProjection: values onN ≥ 2levels, the profile linear in pressure between them (OCO-2/OCO-3);pressure_paholds theNlevel pressures.
Fields:
pressure_pa: the interfaces or levels (Pa, total pressure), surface first, strictly decreasing; the last is the retrieval top (≥ 0);pressure_weight: the pressure weights( N,≥ 0, summing to 1 withinRETRIEVAL_WEIGHT_SUM_TOLERANCE);averaging_kernel: the column averaging kernel( N, normalized, dimensionless:); prior_profile: the retrieval prior( N, dry mole fraction, mol mol⁻¹, in[0, 1]);profile_sigma: optional 1-σ uncertaintyof the model profile on the retrieval layers or levels ( N, mol mol⁻¹, in[0, 1]; empty when absent), the input of the model-error termretrieval_model_error_variance. It is not the retrieval's a-priori uncertainty: the smoothing error is already represented by the averaging kernel;surface_pressure_pa: the retrieval surface pressure (Pa), equal to the first pressure (relative tolerance 1e-6);mapping: theAbstractRetrievalMapping;prior_column: optional, the retrieval's prior column(mol mol⁻¹, in [0, 1];NaNwhen absent), e.g. the OCO-2xco2_apriori. When given, the column is(the MIP protocol's eq. 2); without it . The two differ when the weights and the prior were averaged separately (OCO-2 10-s averages: a few thousandths of a ppm).
Every value but an absent prior_column must be finite. See retrieval_column_weights! for the operator.
AtmosTransport.Observations.Retrievals.mole_fraction_unit_scale Method
mole_fraction_unit_scale(units, label) -> Float64The factor that converts a dry mole fraction stated in units ("mol mol-1", "1", "ppm", "ppb", …; case and blanks ignored) to mol/mol. Throws for a missing or unknown unit, naming label.
AtmosTransport.Observations.Retrievals.oco2_level_form Method
oco2_level_form(mapping::AbstractRetrievalMapping, column::RetrievalColumn{HatLevelProjection})A level retrieval (OCO-2/OCO-3) in the form the operator uses under mapping: unchanged for HatLevelProjection (the levels as given, the default), TM5-4DVar's 19 layers for LayerRebin (tm5_layer_column, the "tm5" mode).
AtmosTransport.Observations.Retrievals.oco2_level_form_from_label Method
oco2_level_form_from_label(label, context) -> AbstractRetrievalMappingThe mapping named "hat" (HatLevelProjection) or "tm5" (LayerRebin on TM5's 19 layers) in configs and on the command line.
AtmosTransport.Observations.Retrievals.retrieval_column_value Method
retrieval_column_value(p_half, air, column::RetrievalColumn, x) -> Float64The simulated column x (dry mole fraction, top first) on the model interface pressures p_half (Pa, top first, total pressures) and air masses air (read by the hat projection only; pass nothing for a LayerRebin column): retrieval_column_weights! and retrieval_prior_offset in one call.
AtmosTransport.Observations.Retrievals.retrieval_column_weights! Method
retrieval_column_weights!(H, s, p_half, air, column::RetrievalColumn) -> HWeights of the averaging-kernel column on the model layers: with the model profile k = 1 at the top),
(retrieval_prior_offset) with the column's prior column prior_column) when it gives one, stretch_model_interfaces!), onto the retrieval's values as its mapping says: the rebin LayerRebin (the column of TM5-4DVar's OCO-2 operator, averaging_kernels.F90, lines 228-235 and 245), or the hat projection of HatLevelProjection, which weights each model layer by its air mass air (kg per cell, top first; the run's dry air mass on a dry basis). Every row of p_half are the model interface pressures (Pa, top first; total pressures, so that they compare with the retrieval's), s a scratch vector of the same length that receives the stretched interfaces. A layer column ignores air; pass nothing for it.
AtmosTransport.Observations.Retrievals.retrieval_layer_count Method
retrieval_layer_count(column::RetrievalColumn) -> IntNumber of retrieval values of a RetrievalColumn: its layers (LayerRebin) or levels (HatLevelProjection).
AtmosTransport.Observations.Retrievals.retrieval_mapping_label Method
The label of a mapping in observation files (retrieval_mapping).
AtmosTransport.Observations.Retrievals.retrieval_model_error_variance Method
retrieval_model_error_variance(column::RetrievalColumn) -> Float64The model-error variance of the averaging-kernel column from the uncertainty profile_sigma), the layers taken independent: profile_sigma. It depends on the record only, so it is fixed for an inversion and the cost stays quadratic.
This is analogous to, not the same as, TM5-4DVar's model error: its CH4 TROPOMI routine (averaging_kernels.F90, line 669, and Satellite.py of the CH4 project) evaluates profile_sigma is not the retrieval's a-priori uncertainty, whose effect (the smoothing error) the averaging kernel already represents.
AtmosTransport.Observations.Retrievals.retrieval_prior_offset Method
retrieval_prior_offset(column::RetrievalColumn) -> Float64
retrieval_prior_offset(h, a, prior) -> Float64The prior term of the averaging-kernel column, which does not depend on the model: prior_column dot_product(pres_weights - W, prior_profile); the raw form always).
AtmosTransport.Observations.Retrievals.retrieval_profile! Method
retrieval_profile!(xr, s, p_half, air, column::RetrievalColumn, x) -> xrThe model profile x (top first) on the retrieval layers or levels (surface first), air as in retrieval_column_weights!; pass nothing for a LayerRebin column, which does not read it). s is scratch for the stretched interfaces. A diagnostic: the column itself is
AtmosTransport.Observations.Retrievals.stretch_model_interfaces! Method
stretch_model_interfaces!(s, p_half, surface_pa, top_pa) -> sTM5-4DVar's stretch of the model column onto a retrieval column (averaging_kernels.F90, lines 213-219): the model interface pressures p_half (Pa, top first, p_half[end] the model surface pressure p_half[1] the model top surface_pa) and the model top on the retrieval top top_pa),
Each model layer keeps its share
AtmosTransport.Observations.Retrievals.tm5_layer_column Method
tm5_layer_column(column::RetrievalColumn{HatLevelProjection}) -> RetrievalColumn{LayerRebin}TM5-4DVar's layer form of a level retrieval (OCO-2/OCO-3 10-s files in proj/tracer/CO2/py/Observations.py, lines 7016-7052, used by Satellite.py, lines 707-717): the N levels become the interfaces of N − 1 layers, the averaging kernel and the prior are interpolated linearly in pressure to the layer midpoints (the mean of the two levels), and the pressure weights are the layer thicknesses profile_sigma is averaged like the kernel. The prior column is TM5's, prior_column of the record is not carried). For comparisons with TM5-4DVAR; the hat projection (HatLevelProjection) is the consistent mapping of level retrievals.
AtmosTransport.Observations.Sources.AbstractAveragingKernelOutput Type
AbstractAveragingKernelOutputWhether an OCO-2 source's soundings also get the averaging-kernel column of the sampled model profile: NoAveragingKernels (the default) or AveragingKernelColumns.
AtmosTransport.Observations.Sources.AbstractObservationMode Type
How a source's records are sampled.
sourceAtmosTransport.Observations.Sources.AbstractObservationSource Type
AbstractObservationSourceWhere sampling requests come from. Concrete sources carry a path template ({YYYYMMDD} or {date}, {YYMMDD}, {YYYY}, {MM}, {DD} substituted per run day; * and ? wildcards in the file name) and declare whether they yield point events (SoundingMode) or station series (SiteMode).
AtmosTransport.Observations.Sources.AbstractQualityFilter Type
Which satellite records become requests.
sourceAtmosTransport.Observations.Sources.AbstractSiteGrouping Type
How ObsPack records are grouped into sites.
sourceAtmosTransport.Observations.Sources.AbstractSiteSchedule Type
AbstractSiteScheduleWhen a station is sampled. Chosen per site from the site table:
| Table keys | Type | Output |
|---|---|---|
| none | EveryWindow | every met-window end, _sites file |
start_time, end_time | TimeRange | every met-window end inside the range, _sites file (NaN outside) |
times | TimeList | one point event per listed UTC time, _soundings file |
AtmosTransport.Observations.Sources.AbstractTableFormat Type
Encoding of a generic point table.
sourceAtmosTransport.Observations.Sources.AutoTableFormat Type
Derive the format from the file extension (.csv, .toml, .nc/.nc4).
AtmosTransport.Observations.Sources.AveragingKernelColumns Type
AveragingKernelColumns(tracers, mapping = HatLevelProjection())averaging_kernel_tracers = [...] on an oco2_lite source: the reader also reads each sounding's retrieval (levels, pressure weights, averaging kernel, prior, prior column; read_oco2_retrieval_columns), and the sampler writes, for each tracer of tracers, the averaging-kernel column <tracer>_ak_column, with the operator of the 4D-Var (retrieval_column_weights!). mapping (averaging_kernel_mapping) is HatLevelProjection ("hat", the levels as given) or LayerRebin ("tm5", TM5-4DVar's 19 layers, tm5_layer_column). The prior term belongs to the retrieved gas, so name the tracer that carries it (total CO2), not components of it.
AtmosTransport.Observations.Sources.CSVTableFormat Type
Comma-separated with a header line; # comments; no quoting. List-valued times use ;.
AtmosTransport.Observations.Sources.EveryWindow Type
Sample the site at every met-window end of the run.
sourceAtmosTransport.Observations.Sources.LocationGrouping Type
One site per distinct (lat, lon, intake height) rounded to 0.01° and 0.1 m, with ids <site_code>_<lat>N_<lon>E_<h>magl in signed decimal degrees.
AtmosTransport.Observations.Sources.NetCDFTableFormat Type
One-dimensional NetCDF variables along the record dimension; CF time units.
AtmosTransport.Observations.Sources.NoAveragingKernels Type
No averaging-kernel columns (the default): the reader reads no retrieval fields.
sourceAtmosTransport.Observations.Sources.NoQualityFilter Type
quality_filter = "none": keep every record (the OCO-2 v11 MIP co-samples all 10-s averages).
AtmosTransport.Observations.Sources.OCO2LiteSource Type
OCO2LiteSource(path_template, quality_filter[, averaging_kernel = NoAveragingKernels()])NASA OCO-2/OCO-3 Lite XCO2 files, or the OCO-2 v11 MIP 10-second average files (same sounding_id, time, latitude, longitude layout). Records passing quality_filter become point events. With averaging_kernel = AveragingKernelColumns(tracers) (opt-in) the reader also reads each record's retrieval and the sampler writes averaging-kernel columns of the named tracers (AveragingKernelColumns).
AtmosTransport.Observations.Sources.ObsPackSource Type
ObsPackSource(path_template, mode, site_grouping)NOAA ObsPack NetCDF dataset files. SiteMode() groups records into fixed stations by site_grouping; SoundingMode() samples every record at its own time.
AtmosTransport.Observations.Sources.ObservationSet Type
ObservationSet(origin, soundings, sites[, dropped_outside_window, skipped_invalid])Every sampling request of a run. build_observation_set sorts soundings by time_seconds (stable) and merges sites so they are unique by id; the constructor itself neither sorts nor deduplicates, and only rejects site series with a TimeList schedule. dropped_outside_window counts the point events outside the transported span; skipped_invalid counts source rows skipped for fill values, invalid coordinates, or the quality filter.
AtmosTransport.Observations.Sources.QualityFlagFilter Type
QualityFlagFilter(variable, max)quality_filter = "flag_max": keep records whose integer flag variable is <= max (Lite files: xco2_quality_flag, 0 = good).
AtmosTransport.Observations.Sources.QualityFlagValues Type
QualityFlagValues(variable, values)quality_filter = "flag_values": keep records whose integer flag variable is one of values. Use it for categorical flags such as the OCO-2 v11 MIP assimilate_flag (0 = not assimilated, 1 = assimilated, 2 = withheld), where <= max cannot select the wanted set.
AtmosTransport.Observations.Sources.SiteCodeGrouping Type
One site per dataset file and distinct intake height. The id is the dataset name (ObsPack files already encode site, platform, and lab), suffixed with _<h>magl only when a file holds several intake heights.
AtmosTransport.Observations.Sources.SiteMode Type
Fixed stations; written at every met-window end.
sourceAtmosTransport.Observations.Sources.SiteRequest Type
SiteRequest(id, lon, lat, elevation_m, intake_height_m, source[, schedule[, altitude_m]])A fixed station. The vertical fields have the meaning of those of SoundingRequest (NaN when unknown; a station has no pressure); the sampler turns them into a VerticalPlacement when it is built. schedule defaults to EveryWindow.
AtmosTransport.Observations.Sources.SoundingMode Type
Time-stamped point events; each record is sampled at its own time.
sourceAtmosTransport.Observations.Sources.SoundingRequest Type
SoundingRequest(id, time_seconds, lon, lat, source[, elevation_m, intake_height_m[, altitude_m, pressure_pa[,
retrieval]]])One point event, sampled at time_seconds after the run origin (Float64 UTC seconds). source indexes the spec's sources. The vertical fields are what the record says about its height, NaN when it says nothing: intake_height_m (m above the ground: the record's intake height, or its altitude minus its elevation), altitude_m (m above sea level), elevation_m (ground, m above sea level) and pressure_pa (Pa). The sampler turns them into a VerticalPlacement once, when it is built (resolve_placement). retrieval is the sounding's RetrievalColumn when its source asks for averaging-kernel columns (AveragingKernelColumns), else nothing.
AtmosTransport.Observations.Sources.TOMLTableFormat Type
[[soundings]] or [[sites]] arrays of tables; times may be a TOML array.
AtmosTransport.Observations.Sources.TableSource Type
TableSource(path_template, mode, format)Generic point list as CSV, TOML, or NetCDF. Point events need id, time (ISO-8601 UTC), lat, lon; sites need id, lat, lon. Both accept elevation (m asl) and intake_height (m above ground) or altitude (m asl, converted with elevation, else placed by resolve_placement). Sites may add start_time/end_time (TimeRange) or times (TimeList).
AtmosTransport.Observations.Sources.TimeList Type
TimeList(times_seconds)Sample the site once at each listed time (seconds after the run origin), like a sounding: blended between the bracketing met-window ends and written to the _soundings file with the intake-layer value.
AtmosTransport.Observations.Sources.TimeRange Type
TimeRange(start_seconds, stop_seconds)Sample the site at every met-window end with start <= t <= stop (seconds after the run origin); records outside the range are written as NaN.
AtmosTransport.Observations.Sources.averaging_kernel_tracers Method
The tracers whose averaging-kernel columns a source asks for (none by default).
sourceAtmosTransport.Observations.Sources.build_observation_set Method
build_observation_set(sources, origin, window_seconds) -> ObservationSet
build_observation_set(sources, origin, dates)Read every source for the days covering the window, merge sites by id, expand site time lists into point events, keep the point events with window_seconds[1] <= t <= window_seconds[2] (seconds after origin; the dates form uses whole days), and sort them by time (stable). A site id that repeats (across rows, daily files, or sources) must keep its location; time lists of a repeated id are merged, and other schedules must be equal. Per-source counts are logged.
AtmosTransport.Observations.Sources.expand_observation_paths Method
expand_observation_paths(template, dates) -> Vector{String}Resolve a source path template for the run days: {YYYYMMDD} (alias {date}), {YYMMDD}, {YYYY}, {MM}, {DD} are substituted per day and * / ? wildcards are expanded in the file name. Returns unique existing paths in order. A path without date tokens must match at least one file; templated paths may resolve to nothing on days without data.
AtmosTransport.Observations.Sources.isvalid_lonlat Method
isvalid_lonlat(lon, lat) -> BoolFinite coordinates with |lat| ≤ 90 and |lon| ≤ 720: fill values such as -999999 are rejected while every ordinary longitude convention passes. Readers filter with this predicate; locate enforces it.
AtmosTransport.Observations.Sources.observation_source_from_cfg Method
observation_source_from_cfg(cfg, label) -> AbstractObservationSourceBuild one source from a [[output.observations.sources]] table. Unknown keys and invalid choices fail with an ArgumentError naming the table.
AtmosTransport.Observations.Sources.pressure_unit_scale Method
pressure_unit_scale(units, label) -> Float64Scale a declared pressure unit (Pa, hPa/mbar or kPa) to pascals. Whitespace and case are ignored; absent or unknown units raise ArgumentError.
AtmosTransport.Observations.Sources.read_observation_requests Method
read_observation_requests(source, source_index, origin, dates) -> (soundings, sites)Expand the source's path template for the run days and read every file into SoundingRequests and SiteRequests (one of the two is empty, depending on the source mode). Times are Float64 seconds since origin. Rows with fill values or impossible coordinates are skipped; a source that resolves to no file at all logs a warning.
AtmosTransport.Observations.Sources.read_oco2_retrieval_columns Method
read_oco2_retrieval_columns(ds, rows; label = "OCO-2 file") -> Vector{RetrievalColumn{HatLevelProjection}}The retrieval of records rows (1-based indices along sounding_id) of an open OCO-2 or OCO-3 Lite file or OCO-2 v11 MIP 10-second file, as level columns (RetrievalColumn with HatLevelProjection): the profile values of these retrievals sit on 20 levels with the profile linear in pressure between them. Read per record:
the level pressures:
pressure_levels (levels, sounding)(Lite files) orsigma_levels (levels)timespsurf (sounding)(MIP files), converted to Pa with theirunits(hPa);pressure_weight,xco2_averaging_kernel(normalized, used as it is, not multiplied by the weights) andco2_profile_apriori(converted to mol/mol with itsunits, ppm);xco2_apriori, the prior column, when the file has it (converted to mol/mol): the column is then. For the 10-s averages it differs from (the weights and the prior were averaged separately) by up to about 0.01 ppm.
The files store the levels from space to the surface; each record is turned surface first (by its pressures, so either order is read correctly). The surface pressure is the bottom level. Every field must be finite and pass the RetrievalColumn checks (weights summing to 1); an invalid record is an error naming its sounding_id.
AtmosTransport.Observations.Sources.record_height_above_ground Method
record_height_above_ground(intake_height, altitude, elevation) -> Float64Height above the ground (m) that a record states by itself: its intake height when finite, else its altitude (m above sea level) minus its ground elevation (m above sea level) when both are finite, else NaN. Evaluated per record: ObsPack files fill intake_height and elevation row by row (the OCO-2 MIP v5.0.1 daily files leave both as fill on aircraft and AirCore rows).
AtmosTransport.Observations.Sources.site_active Method
Whether a site is sampled at the window end t (seconds after the origin).
AtmosTransport.Observations.Sources.valid_pressure Method
valid_pressure(p) -> BoolWhether a record pressure (Pa) can place the record: finite and positive. A pressure at or below zero is an undeclared fill value (-999.9 hPa) and is treated as absent.
sourceAtmosTransport.Observations.Sampling.DEFAULT_VERTICAL_COORDINATES Constant
Height above the true ground first, then pressure: vertical_coordinates = ["height_above_ground", "pressure"].
AtmosTransport.Observations.Sampling.HEIGHT_METHOD_NOT_SAMPLED Constant
Code written for a site outside its time range (no heights computed).
sourceAtmosTransport.Observations.Sampling.INTERP_FLAG_CODES Constant
Integer interp_flag codes of point-event rows: blended between two window ends, sampled one-sided at the later end (window length changed between binaries), or taken from the nearest window end (nearest_window mode).
AtmosTransport.Observations.Sampling.VERTICAL_PLACEMENT_CODES Constant
Integer vertical_placement codes of the observation files, the method that placed each request (see vertical_placement_codes_description):
| Code | Name | Layer chosen by |
|---|---|---|
| 0 | record_height | the record's height above ground (intake_height, or altitude − elevation) |
| 1 | altitude_minus_dem | altitude − DEM ground elevation at the point |
| 2 | pressure | the record's pressure against the interface pressures of the pressure_basis (total by default) |
| 3 | absolute_altitude | altitude against model surface height + layer heights (absolute_altitude_above_agl_m) |
| 4 | lowest_layer | no vertical coordinate, for sources whose records are column or surface products |
AtmosTransport.Observations.Sampling.AboveGroundPlacement Type
Every record at its height above the ground, measured up from the model surface (default).
sourceAtmosTransport.Observations.Sampling.AbsoluteAltitudeAbove Type
AbsoluteAltitudeAbove(min_height_agl_m)absolute_altitude_above_agl_m = h: records at least h m above the ground (free-tropospheric aircraft and AirCore samples) are placed by their pressure when the record has one, else by their altitude above sea level against the model's geopotential heights (model surface height plus layer heights). The altitude is the record's altitude, else its ground elevation (the record's, else the DEM's) plus its intake_height; a record with neither keeps its height above the ground. Records below h keep AboveGroundPlacement. Needs a model surface height (surface_height_file).
AtmosTransport.Observations.Sampling.AbstractAltitudePlacement Type
How records that carry an altitude are placed once their height above the ground is known.
sourceAtmosTransport.Observations.Sampling.AbstractCellLocator Type
AbstractCellLocatorPer-topology containing-cell lookup. The interface is locate(loc, lon, lat) ; locators are immutable and locate is pure, so they may be shared across threads.
AtmosTransport.Observations.Sampling.AbstractLayerTemperature Type
How the layer temperature for hypsometric heights is obtained.
sourceAtmosTransport.Observations.Sampling.AbstractMissingHeightRule Type
AbstractMissingHeightRuleWhat a source's records mean when they give no vertical coordinate at all (no intake_height, altitude or pressure), chosen by the source type (missing_height_rule): LowestLayerWithoutHeight or UnplacedWithoutHeight.
AtmosTransport.Observations.Sampling.AbstractModelSurfaceHeight Type
AbstractModelSurfaceHeightSurface height of the model grid (m above sea level): the ground the model's layer heights are measured from. NoModelSurfaceHeight (default) or ModelSurfaceHeight, read from a per-grid dataset by GriddedIO.read_model_surface_height. Query it with model_surface_height.
AtmosTransport.Observations.Sampling.AbstractObservationOutput Type
Parsed [output.observations]: either NoObservationOutput or a spec.
AtmosTransport.Observations.Sampling.AbstractObservationStream Type
AbstractObservationStreamAppend-only NetCDF sink with the snapshot-stream contract. Concrete streams have path, dataset, count, closed, failed, and queue fields; writes are queued closures op(stream) that run under the shared NetCDF lock.
AtmosTransport.Observations.Sampling.AbstractObservationTimeInterpolation Type
How point events are placed in time between met-window ends.
sourceAtmosTransport.Observations.Sampling.AbstractPlacementCoordinate Type
AbstractPlacementCoordinateA vertical coordinate that can place a record in the model column: HeightAboveGroundCoordinate or PressureCoordinate. VerticalPlacementSpec lists the coordinates a run uses in preference order (vertical_coordinates); resolve_placement places each record by the first one it can.
AtmosTransport.Observations.Sampling.AbstractPointElevation Type
AbstractPointElevationGround elevation (m above sea level) at a point, from a high-resolution digital elevation model: NoPointElevation (default) or GriddedIO.LatLonPointElevation (GriddedIO.read_point_elevation). Query it with point_elevation.
AtmosTransport.Observations.Sampling.AbstractPressureBasis Type
AbstractPressureBasisThe vertical basis of a column's placement (pressure_basis), one choice for the interface pressures a pressure-placed record (or an averaging-kernel column) is compared with and for the hypsometric layer heights a record placed by height is compared with: TotalFromHumidity (default) or DryInterfaces. A record's pressure is the total (ambient) pressure, dry air plus water vapour. The air mass of a dry-basis run gives dry interface pressures,
AtmosTransport.Observations.Sampling.AbstractUnplacedPolicy Type
What the sampler does with requests it cannot place in the column.
sourceAtmosTransport.Observations.Sampling.CellLocation Type
CellLocationContaining model cell for an observation point. cell is the topology's native flat cell index (lat-lon i + (j-1)Nx, reduced Gaussian cell_index, cubed sphere i + (j-1)Nc within panel). column is the linear column index into the device slab holding this topology's state, including the cubed-sphere halo offset, so a gather can address storage[column + (k-1) * ncolumns]. Indices are plain Int so they can be passed straight to Grids helpers. Device index buffers may narrow column to Int32 (every supported resolution fits) but must widen again before multiplying by ncolumns. lon/lat are the cell-centre coordinates in the mesh's own longitude convention (lat-lon follows the mesh interval; reduced Gaussian and cubed sphere use [0, 360)).
AtmosTransport.Observations.Sampling.ConstantLayerTemperature Type
One temperature for every layer (fallback when the binary carries none).
sourceAtmosTransport.Observations.Sampling.DryInterfaces Type
pressure_basis = "dry": compare a record's pressure with the dry interface pressures
AtmosTransport.Observations.Sampling.ErrorOnUnplaced Type
unplaced_records = "error" (default): building the sampler fails, naming the requests.
AtmosTransport.Observations.Sampling.GatherPlan Type
GatherPlan(cells, npanel)Gather order for a batch of cell locations: columns grouped by panel (the cubed sphere needs one contiguous run per panel), the per-panel ranges, and position[i], the gather slot of request i.
AtmosTransport.Observations.Sampling.HeightAboveGroundCoordinate Type
"height_above_ground": the record's height intake_height, else altitude − elevation, else altitude minus the DEM ground elevation at the point, measured up from the model surface with the model's hypsometric layer heights (vertical_placement codes record_height and altitude_minus_dem).
AtmosTransport.Observations.Sampling.LinearWindowInterpolation Type
Blend the two met-window-end samples bracketing each sounding time (default).
sourceAtmosTransport.Observations.Sampling.LowestLayerWithoutHeight Type
The record is a column or surface product: it is sampled in the lowest layer (vertical_placement = lowest_layer). OCO-2 soundings (their value is the column; the intake value is the surface layer) and table rows without height columns (surface points).
AtmosTransport.Observations.Sampling.ModelSurfaceHeight Type
ModelSurfaceHeight(field, path)Per-cell surface height of the model grid (m above sea level), in the mesh's native layout: an (Nx, Ny) matrix on a lat-lon mesh, a vector over the cells on a reduced Gaussian mesh, a 6-tuple of (Nc, Nc) panels on the cubed sphere. path is the per-grid dataset it came from (written to the observation files as provenance).
AtmosTransport.Observations.Sampling.NearestWindowSampling Type
Use the single met-window-end sample nearest to each sounding time.
sourceAtmosTransport.Observations.Sampling.NoModelSurfaceHeight Type
No model surface height configured; model_surface_height returns NaN.
AtmosTransport.Observations.Sampling.NoObservationOutput Type
Default when [output.observations] is absent or enabled = false.
AtmosTransport.Observations.Sampling.NoObservationSampler Type
No-op sampler installed when observation output is absent or disabled.
sourceAtmosTransport.Observations.Sampling.NoPointElevation Type
No DEM configured; point_elevation returns NaN.
AtmosTransport.Observations.Sampling.ObservationCounters Type
Running totals reported in the summary attributes and the end-of-run log.
sourceAtmosTransport.Observations.Sampling.ObservationGatherBuffers Type
ObservationGatherBuffers(reference, nlevel, slots; capacity = 1024)Grow-only scratch for gather_columns!. reference is any state array; device buffers are allocated with similar(reference, …) so they live on the same backend. slots are the tracer storage indices to gather (see tracer_index); an empty slots gathers a single field (see gather_field!). Host mirrors air_host (nlevel, capacity) and tracers_host (nlevel, nslots, capacity) keep the state element type and are valid in columns 1:n after a gather of n requests.
AtmosTransport.Observations.Sampling.ObservationOutputSpec Type
ObservationOutputSpecParsed [output.observations] table. path is a template: _soundings or _sites is inserted before the extension and, with daily partitions, {date} / {YYYYMMDD} / {day} are substituted per input binary exactly as for snapshot output. tracers === nothing means every model tracer. start_time is only consulted when [input].start_date is absent. placement is the VerticalPlacementSpec.
AtmosTransport.Observations.Sampling.ObservationSampler Type
ObservationSamplerRuntime state of observation sampling: the located and vertically placed point events and sites, whether the column's heights and pressures need the humidity, device gather buffers, the held first samples of events awaiting their second sample, the open (and retired daily) output streams, and counters. Built by build_observation_sampler.
AtmosTransport.Observations.Sampling.ObservationTerrain Type
ObservationTerrain(; model_surface = NoModelSurfaceHeight(), dem = NoPointElevation())The static ground fields observation placement may use: the model-grid surface height (AbstractModelSurfaceHeight) and a point DEM (AbstractPointElevation). The runner builds it from [output.observations] through GriddedIO and passes it to build_observation_sampler.
AtmosTransport.Observations.Sampling.PendingSoundings Type
Soundings sampled at the previous window end, waiting for their second sample.
sourceAtmosTransport.Observations.Sampling.PlacementColumn Type
PlacementColumn(nlevel)Scratch for column_layer! and sample_column_layer! on a column of nlevel layers: p_half receives the interface pressures of the pressure basis (those a pressure placement is compared with, and the total pressures of the heights), and humidity holds the column's specific humidity (k = 1 at the top), which the caller fills when the pressure basis needs it (needs_column_humidity).
AtmosTransport.Observations.Sampling.PressureCoordinate Type
"pressure": the record's pressure (ObsPack pressure, a total pressure) against the column's interface pressures, built as the AbstractPressureBasis says (vertical_placement code pressure).
AtmosTransport.Observations.Sampling.ProfileLayerTemperature Type
Per-layer temperatures, kelvin[k] with k = 1 at the top.
AtmosTransport.Observations.Sampling.SiteNetCDFStream Type
SiteNetCDFStream(path, mesh, nlevel, tracer_names, sites, cells, placements; mass_basis, origin,
deflate_level, write_profiles, attributes)Append-only station sink: one record per met-window end with, per site, the mixing ratio in the layer containing the intake height (<tracer>_intake), the lowest-layer value (<tracer>_surface), the chosen layer and its bounds, surface pressure, and optionally the full profiles (<tracer>, p_half, air mass). Sites outside their TimeRange are written as NaN with intake_level = 0. placements holds each site's VerticalPlacement, written as static metadata.
AtmosTransport.Observations.Sampling.SiteRecord Type
SiteRecord(time, nsite, nlevel, ntracer; profiles)One time record for every site, allocated uninitialised for the sampler to fill. values (intake layer) and surface_values are (nsite, ntracer); with profiles = true the record also carries p_half (nlevel + 1, nsite), air_mass_per_area (nlevel, nsite) and profiles (nlevel, nsite, ntracer), otherwise those arrays are empty.
AtmosTransport.Observations.Sampling.SkipUnplaced Type
unplaced_records = "skip": such requests are dropped and counted (n_unplaced_* attributes).
AtmosTransport.Observations.Sampling.SoundingBatch Type
SoundingBatch(; ids, sources, times, latitudes, longitudes, cells, sample_time_prev,
sample_time_next, weights, flags, p_half, air_mass_per_area, tracers,
column_means, elevations, intake_heights, altitudes, pressures, placements,
intake_levels, layer_bottom, layer_top, height_methods, intake_values,
retrieval_values = nothing)Columns of one emitted batch of n events. Profiles are (nlevel, n), p_half is (nlevel + 1, n), tracers (nlevel, ntracer, n), column means and intake values (ntracer, n). Times are seconds since 1970-01-01 UTC. elevations, intake_heights, altitudes and pressures are the records' own values; placements the VerticalPlacement of each row. retrieval_values are the averaging-kernel columns (n_retrieval_tracers, n) of a sampler with averaging-kernel output (NaN where a row has none), or nothing.
AtmosTransport.Observations.Sampling.SoundingNetCDFStream Type
SoundingNetCDFStream(path, mesh, nlevel, tracer_names; mass_basis, origin, deflate_level, attributes)Append-only point-event sink. Each appended batch writes one row per event: identity, time, location, containing cell, bracketing sample times and weight, interface pressures, per-layer air mass per area, each tracer's mixing-ratio profile and column mean, and the intake-layer value. With retrieval_tracers (sources with averaging-kernel columns) it also writes <tracer>_ak_column (Float64, NaN for rows without a retrieval).
AtmosTransport.Observations.Sampling.SurfaceLapseTemperature Type
2 m temperature with a constant lapse rate (K m⁻¹) above the surface, by default STANDARD_LAPSE_RATE, floored at the standard-atmosphere tropopause temperature STANDARD_TROPOPAUSE_TEMPERATURE so tall columns stay physical.
AtmosTransport.Observations.Sampling.TotalFromHumidity Type
pressure_basis = "total" (default): compare a record's pressure with the column's total interface pressures, and a record's height with the hypsometric heights of moist air on them. Specific humidity
with VIRTUAL_TEMPERATURE_FACTOR, 0.61) and A_ifc[1], a total pressure in the met model's hybrid coordinate (level 1 is the top). This inverts the preprocessing's dry conversion pre_ll72 binary (ERA5 L137 merged to 34 levels) the rebuilt total surface pressure differs from the stored one by −0.012 Pa on average and 0.125 Pa at most, where the dry interfaces are 169 Pa low on average and 700 Pa at worst. The humidity is the binary's layer-mean specific humidity at the sampled boundary: qv_start / qv_end of lat-lon binaries preprocessed with output.include_qv = true; on cubed-sphere binaries with the GCHP VDIFF payload the window-start VDIFF qv of the next window (the run's last window end takes the ended window's, one window old). Reduced-Gaussian binaries, and cubed-sphere binaries without the VDIFF payload, carry no humidity. On a moist-basis run the air mass already includes the vapour and its interfaces are total pressures without humidity; the heights there use pressure_basis = "dry".
AtmosTransport.Observations.Sampling.UnplacedWithoutHeight Type
The record should state a height and does not: it cannot be placed (unplaced_records). ObsPack records, where every platform carries a height.
AtmosTransport.Observations.Sampling.VerticalPlacement Type
VerticalPlacement(method, height_agl_m, pressure_pa, model_surface_m)How one request is placed in the column, resolved once by resolve_placement: method is a VERTICAL_PLACEMENT_CODES code; height_agl_m the height above the model surface that selects the layer (NaN for pressure and lowest-layer placement); pressure_pa the pressure that selects it (pressure placement only); model_surface_m the model surface height of the cell (NaN without a surface-height dataset).
AtmosTransport.Observations.Sampling.VerticalPlacementSpec Type
VerticalPlacementSpec(; surface_height_file = nothing, dem_file = nothing, dem_variable = "z",
unplaced = ErrorOnUnplaced(), altitude_placement = AboveGroundPlacement(),
coordinates = DEFAULT_VERTICAL_COORDINATES,
pressure_basis = TotalFromHumidity())The vertical-placement settings of [output.observations]: the per-grid model surface height dataset, an optional point DEM (file and variable), the AbstractUnplacedPolicy, the AbstractAltitudePlacement, the AbstractPlacementCoordinates in preference order (a non-empty tuple without repeats; by default height above ground, then pressure), and the AbstractPressureBasis of pressure placement.
AtmosTransport.Observations.Sampling.VirtualLayerTemperature Type
VirtualLayerTemperature(temperature, humidity)The virtual temperature AbstractLayerTemperature temperature and the specific humidity humidity[k] (kg kg⁻¹ of moist air, k = 1 at the top), with VIRTUAL_TEMPERATURE_FACTOR (placement_heights! with TotalFromHumidity). The humidity is used as it is, the same values as the total pressures.
AtmosTransport.Observations.Sampling.append_site_record! Method
append_site_record!(stream, record) -> countQueue one met-window-end record for every site, then flush if the NetCDF lock is free; each flushed record is synced before completed_times is published. Returns the new reserved record count.
AtmosTransport.Observations.Sampling.append_soundings! Method
append_soundings!(stream, batch) -> countQueue batch after the rows already reserved, then flush if the NetCDF lock is free; each flushed batch is synced before completed_soundings is published. Returns the new reserved row count.
AtmosTransport.Observations.Sampling.begin_observation_day! Method
begin_observation_day!(sampler, date_label, day_index)Called by the runner before the first window boundary of each input binary. Single-file runs open their files on the first call; daily runs close the previous day's files and open the next pair. Rows are written to the files open at emission time. A binary's last window ends at the next day's 00:00, which is still observed before the next binary opens: with linear interpolation a sounding lands in the file of its own day, and each day's sites file ends with the 00:00 sample of the next day (the first file also holds the initial state at t = 0). With nearest_window, soundings in the first half window after 00:00 are emitted at that boundary and land in the previous day's file.
AtmosTransport.Observations.Sampling.below_ground Method
below_ground(placement::VerticalPlacement) -> BoolWhether a placement by height above the ground (record_height, altitude_minus_dem) puts the record more than BELOW_GROUND_TOLERANCE_M (100 m) below the ground. Such records are sampled in the lowest layer; the sampler counts them and warns.
AtmosTransport.Observations.Sampling.build_observation_sampler Method
build_observation_sampler(spec, state, grid; origin, window_seconds, halo_width,
terrain = ObservationTerrain(), has_humidity = false)Read every source for the days covering window_seconds (seconds after origin, half-open), locate the requests on grid.horizontal, place each in the column (resolve_placement with the static ground fields of terrain, see ObservationTerrain), and prepare the device gather buffers. Requests that cannot be placed fail the build or are skipped and counted, as spec.placement.unplaced says. has_humidity says whether the run's binaries carry specific humidity: on a dry-basis run every request needs it for the total interface pressures and the virtual-temperature layer heights of TotalFromHumidity (the default spec.placement.pressure_basis; check_pressure_basis), and the build fails without it unless the basis is DryInterfaces; every window end must then pass humidity to observe_window_boundary!. Output files are opened by begin_observation_day!. NoObservationOutput yields NoObservationSampler().
AtmosTransport.Observations.Sampling.cell_locator Method
cell_locator(mesh; halo_width) -> AbstractCellLocatorBuild the containing-cell locator for mesh. halo_width is the padding of the state arrays that CellLocation.column addresses: lat-lon and reduced-Gaussian state is unpadded; cubed-sphere state defaults to the mesh halo Hp.
AtmosTransport.Observations.Sampling.check_observation_tracer_names Method
check_observation_tracer_names(names; averaging_kernel_tracers = Symbol[])Throw if tracer output names (each tracer with its suffixes, and <tracer>_ak_column for the tracers with averaging-kernel columns) would collide with each other or with built-in variables.
AtmosTransport.Observations.Sampling.check_pressure_basis Method
check_pressure_basis(basis, mass_basis, has_humidity, n_column, label) -> BoolCheck, when the requests are placed, that basis can build the layer heights and interface pressures of n_column requests placed in the column on a run of mass_basis whose binaries carry specific humidity when has_humidity, and return whether sampling needs that humidity (needs_column_humidity with at least one request: TotalFromHumidity on a dry-basis run). Every placed request counts, whatever its coordinate: its layer heights are built (and reported) on the basis. Throws for DryInterfaces on a moist-basis run, and for TotalFromHumidity with requests on a dry-basis run without humidity; label names the config table ("[output.observations]").
AtmosTransport.Observations.Sampling.check_surface_height_layout Method
Throw unless the surface-height layout matches mesh (the sampler checks it once).
AtmosTransport.Observations.Sampling.column_layer! Method
column_layer!(column::PlacementColumn, placement, z_half, air_column, area, g, p_top, basis, mass_basis) -> IntModel layer (k = 1 top) of a VerticalPlacement in one column, the rule shared by the forward sampler and any other caller: by height above the model surface on the hypsometric interface heights z_half, or the lowest layer (as placement_layer); a pressure placement against the interface pressures of the AbstractPressureBasis basis, built into column.p_half from air_column (kg per cell, of mass_basis), the cell area (m²), gravity g, the model-top pressure p_top and, for TotalFromHumidity on a dry basis, column.humidity.
AtmosTransport.Observations.Sampling.column_mean_vmr Method
Air-mass-weighted column mean mixing ratio; NaN when the column holds no air.
sourceAtmosTransport.Observations.Sampling.finish_observations! Method
finish_observations!(sampler)Emit events exactly at the final window end, drop events that never received their second sample, write the summary attributes, and warn about anything that was not sampled. Idempotent.
sourceAtmosTransport.Observations.Sampling.gather_columns! Function
gather_columns!(buf, state, columns, panel_ranges = nothing) -> nGather the air mass and the buffered tracer slots of columns (Int32 linear column indices, see CellLocation.column) from state into buf.air_host[:, 1:n] and buf.tracers_host[:, :, 1:n]. Lat-lon and reduced-Gaussian states ignore panel_ranges; cubed-sphere states require columns grouped by panel with panel_ranges[p] giving panel p's run so that the six ranges tile 1:n in order.
AtmosTransport.Observations.Sampling.gather_field! Function
gather_field!(buf, field, columns, panel_ranges = nothing) -> nGather one per-layer field with the air-mass layout (an array, or a 6-tuple of panel arrays) into buf.air_host[:, 1:n]; buf must have been built with no tracer slots. Used for optional temperature fields.
AtmosTransport.Observations.Sampling.intake_layer_index Method
intake_layer_index(z_half, height) -> IntLayer k with z_half[k+1] <= h < z_half[k] (k = 1 top), h in metres above the model surface. A non-positive height selects the lowest layer; a height above the column top selects layer 1. A NaN height is an ArgumentError: requests without a height are placed explicitly (placement_layer), never by a NaN fallback.
AtmosTransport.Observations.Sampling.interface_pressures! Method
interface_pressures!(p_half, air_column, area, g, p_top)Interface pressures (Pa) from a column of air mass per cell (kg), top down: p_half[1] = p_top, p_half[k+1] = p_half[k] + g·m[k]/area. On a dry-basis state this is the dry partial pressure.
AtmosTransport.Observations.Sampling.layer_heights_agl! Method
layer_heights_agl!(z_half, p_half, temperature, g; R_dry = R_DRY_AIR)Hypsometric interface heights above ground (m) from interface pressures, z_half[end] = 0 at the surface, accumulated upward with the layer temperature from temperature evaluated at the layer's bottom height: VirtualLayerTemperature) of layers of uniform placement_heights! chooses the pressures and the temperature. A non-positive or non-monotone pressure gives an infinite height from that layer upward.
AtmosTransport.Observations.Sampling.locate Function
locate(loc::AbstractCellLocator, lon, lat) -> Union{CellLocation, Nothing}Containing cell of a point given in degrees, in any longitude convention. Returns nothing only when the mesh does not cover the point (regional lat-lon meshes); global meshes always return a cell. Faces follow the half-open convention: a point exactly on a face belongs to the cell to its east or north, except on the mesh's outermost northern and eastern faces. Invalid coordinates (see isvalid_lonlat) throw an ArgumentError.
AtmosTransport.Observations.Sampling.missing_height_rule Method
missing_height_rule(source) -> AbstractMissingHeightRuleHow records of source without any vertical coordinate are placed: LowestLayerWithoutHeight for OCO2LiteSource and TableSource, UnplacedWithoutHeight for ObsPackSource.
AtmosTransport.Observations.Sampling.mixing_ratio_profile! Method
Per-layer mixing ratio tracer/air, NaN where the carrier mass is not positive.
AtmosTransport.Observations.Sampling.model_surface_height Method
model_surface_height(surface, cell::CellLocation) -> Float64Model surface height (m above sea level) of the cell containing an observation; NaN for NoModelSurfaceHeight.
AtmosTransport.Observations.Sampling.needs_column_humidity Method
needs_column_humidity(basis, mass_basis) -> BoolWhether a column's layer heights and interface pressures on the AbstractPressureBasis basis need its specific humidity: on a dry-basis run TotalFromHumidity builds the total pressures and the virtual temperature from it, for every placement (the heights of sample_column_layer!) and for averaging-kernel columns. DryInterfaces, and a moist-basis run, need none.
AtmosTransport.Observations.Sampling.nslots Method
Number of tracer slots a buffer gathers (0 for a field buffer).
sourceAtmosTransport.Observations.Sampling.observation_needs_humidity Method
observation_needs_humidity(sampler) -> BoolWhether observe_window_boundary! needs the specific humidity: the sampler builds its columns' heights and pressures on total pressures (TotalFromHumidity) on a dry-basis run.
AtmosTransport.Observations.Sampling.observation_output_path Method
observation_output_path(spec, mode, date_label, day_index) -> StringResolve the file for mode::AbstractObservationMode. _soundings / _sites is inserted before the extension. Daily runs substitute the day template exactly like output_path_for_day; single-file runs substitute it only when the path carries a {date} / {YYYYMMDD} / {day} token, using the first day's label, and otherwise use the path as given.
AtmosTransport.Observations.Sampling.observation_output_spec Method
observation_output_spec(output_cfg; partition = nothing)Parse [output.observations] from the [output] table. Returns NoObservationOutput() when the subtable is absent or enabled = false, otherwise an ObservationOutputSpec. Unknown keys, a missing path or sources, and invalid choices raise ArgumentError. The file partition (one file vs. one per daily binary) follows [output].split unless partition is given; split is only read when observations are enabled.
AtmosTransport.Observations.Sampling.observe_window_boundary! Method
observe_window_boundary!(sampler, state, time_seconds; next_window_seconds, temperature = nothing,
humidity = nothing)Sample state at a met-window end time_seconds after the run origin. next_window_seconds is the length of the window that starts now (it sets which soundings receive their first sample). temperature, when given, is a per-layer temperature field (K, k = 1 at the top) used for site layer heights, either with the air-mass layout or, on the cubed sphere, as interior-only panels; otherwise the configured constant applies. humidity is the specific humidity (kg kg⁻¹ of moist air, k = 1 at the top) at this window end, in the same layouts; a sampler that builds its columns on total pressures on a dry-basis run (TotalFromHumidity: the layer heights of every row, pressure placement, averaging-kernel columns) requires it and otherwise ignores it. Call once at t = 0 on the initial state and after every window.
AtmosTransport.Observations.Sampling.parse_vertical_placement Method
parse_vertical_placement(cfg, label) -> VerticalPlacementSpecParse the vertical-placement keys (VERTICAL_PLACEMENT_KEYS) of the config table cfg, named label in error messages ("[output.observations]"): surface_height_file, dem_file/dem_variable, unplaced_records, absolute_altitude_above_agl_m, vertical_coordinates and pressure_basis. The caller checks for unknown keys. Keys that would have no effect are errors: dem_variable without dem_file, and dem_file or absolute_altitude_above_agl_m (both act on placements by height) when vertical_coordinates leaves out "height_above_ground". pressure_basis applies to every coordinate (the layer heights are built on it too).
AtmosTransport.Observations.Sampling.placement_heights! Method
placement_heights!(z_half, column::PlacementColumn, basis, mass_basis, p_half, air_column, area, g, p_top,
temperature) -> z_halfHypsometric interface heights above the model surface (m, k = 1 top) of one column, on the vertical basis of the AbstractPressureBasis basis (layer_heights_agl!):
TotalFromHumidityon a dry basis: the total interface pressures from the dry air mass and the specific humiditycolumn.humidity(total_interface_pressures!, intocolumn.p_half) with the virtual temperatureof temperature(VirtualLayerTemperature), the hydrostatic thickness of moist air;otherwise the interface pressures of the air mass,
p_half(filled by the caller): the dry interfaces withfor DryInterfaces, an approximation that puts heights about 2 % low in a humid boundary layer (the dry pressure ratio andinstead of each about 1 % for = 16 g/kg), and on a moist-basis run the total interfaces of the moist air mass with (no humidity is gathered there, so the virtual temperature term, about 1 %, is neglected).
AtmosTransport.Observations.Sampling.placement_layer Method
placement_layer(placement, z_half, p_half) -> IntModel layer (k = 1 top) of a VerticalPlacement in one sampled column: by height above the model surface (intake_layer_index on the hypsometric interface heights z_half), by pressure (pressure_layer_index on the interface pressures p_half), or the lowest layer.
AtmosTransport.Observations.Sampling.placement_pressures! Method
placement_pressures!(p_half, basis, mass_basis, air_column, humidity_column, area, g, p_top) -> p_halfInterface pressures (Pa, k = 1 top) a pressure-placed record is compared with, for a column of air mass per cell (kg) of mass_basis: TotalFromHumidity builds the total pressures from the dry air mass and the specific humidity humidity_column (total_interface_pressures!) on a dry-basis run and takes the moist air mass as it is on a moist-basis run; DryInterfaces gives the dry interfaces of a dry-basis run (interface_pressures!). humidity_column is ignored where no humidity is needed.
AtmosTransport.Observations.Sampling.point_elevation Method
point_elevation(dem, lon, lat) -> Float64Ground elevation (m above sea level) of dem at the point, NaN where the DEM has no value (outside its coverage, fill, or NoPointElevation).
AtmosTransport.Observations.Sampling.pressure_layer_index Method
pressure_layer_index(p_half, p) -> IntLayer k with p_half[k] <= p < p_half[k+1] (k = 1 top). A pressure at or above the surface interface selects the lowest layer; one below the column top selects layer 1. p must be finite and positive (valid_pressure).
AtmosTransport.Observations.Sampling.resolve_placement Method
resolve_placement(spec::VerticalPlacementSpec, missing_height, request, cell, terrain)
-> Union{VerticalPlacement, Nothing}Place a SoundingRequest or SiteRequest in the column of its containing cell by the first of spec.coordinates (AbstractPlacementCoordinate, in preference order) that places it:
HeightAboveGroundCoordinate: the record's height above ground( intake_height, oraltitude − elevationwith the record's or station's elevation;record_height), else= altitudeminus the DEM ground elevation at the point (altitude_minus_dem). The record is placedabove the model surface. PressureCoordinate: the record'spressure(pressure), when it isvalid_pressure(finite and positive).
A record that none of the coordinates place is unplaced (nothing) when it states any vertical coordinate (an intake_height, an altitude, a valid pressure), e.g. an altitude without a ground elevation (no record elevation, no DEM value), or a coordinate the run does not use. One without any vertical coordinate goes to the lowest layer (lowest_layer) under LowestLayerWithoutHeight and is unplaced under UnplacedWithoutHeight (missing_height, from missing_height_rule of the record's source). The model surface height is never used as the true ground.
spec.altitude_placement = AbsoluteAltitudeAbove(h₀) then re-places records placed by a height pressure is one of the coordinates), else by absolute altitude: the stated altitude, else the ground elevation (the record's, else the DEM value at the point) plus intake_height; a record with neither keeps its height above the ground.
AtmosTransport.Observations.Sampling.sample_column_layer! Method
sample_column_layer!(column::PlacementColumn, p_half, z_half, placement, air_column, area, g, p_top,
temperature, basis, mass_basis) -> IntThe layer (k = 1 top) of a VerticalPlacement in one sampled column, from the column alone: the interface pressures of the air mass (interface_pressures! into p_half, p_top; dry pressures on a dry-basis run), the hypsometric interface heights above the model surface on the vertical basis of basis (placement_heights! into z_half, with the AbstractLayerTemperature temperature: total pressures and virtual temperature for TotalFromHumidity on a dry basis), then column_layer!. column.humidity must hold the column's specific humidity whenever the basis needs it (needs_column_humidity), for every placement, since the heights use it. The forward observation sampler and the inversion's placed point observations both choose their layers with this function.
AtmosTransport.Observations.Sampling.samples_observations Method
Whether the runner must visit every met-window end for this sampler.
sourceAtmosTransport.Observations.Sampling.terrain_source Method
terrain_source(field) -> StringWhere a terrain field came from, written to the observation files: the file path, "" for NoModelSurfaceHeight / NoPointElevation. Concrete DEM types add a method.
AtmosTransport.Observations.Sampling.total_interface_pressures! Method
total_interface_pressures!(p_half, dry_air_column, humidity_column, area, g, p_top)Total (dry air plus water vapour) interface pressures (Pa) from a column of dry air mass per cell (kg) and the layers' specific humidity (kg of vapour per kg of moist air), top down: p_half[1] = p_top, p_half[k+1] = p_half[k] + g·m[k] / (area·(1 − q[k])), the hydrostatic weight of the moist air m[k]/(1 − q[k]) (see TotalFromHumidity). Every q must be finite and below 1; small negative values (interpolation undershoot) are used as they are.
AtmosTransport.Observations.Sampling.write_observation_variable! Method
Define a variable, assign its ordered attributes and write its values for observation IO.
sourceAtmosTransport.Observations.Sampling.write_summary_attributes! Method
Queue summary attributes (written at day rotation and at the end of a run).
sourceVisualization
AtmosTransport.Visualization lives in src/Extras/Visualization/. It is non-core, has no tests, and is intended to become its own package. The Makie extension stays in ext/AtmosTransportMakieExt.jl, Julia's extension location. Core modules never import Visualization.
Field selection uses typed values. Pass ColumnMean(), ColumnSum(), LevelSlice(), or SurfaceSlice() as the transform keyword to fieldview; LevelSlice() also requires level. Pass NativeUnit() or PPMUnit() as unit, and pass AllFrames() to frame_indices to select every frame. These selectors are exported by AtmosTransport.Visualization, not by the top-level module. For example:
using AtmosTransport.Visualization
snapshot = open_snapshot("output.nc")
surface = fieldview(snapshot, :co2; transform=SurfaceSlice(), time=1,
unit=PPMUnit())
levels = fieldview(snapshot, :co2; transform=LevelSlice(), level=10, time=1)AtmosTransport.Visualization Module
VisualizationTopology-aware snapshot visualization support.
This module owns the lightweight data layer only: snapshot discovery, field views, unit scaling, and topology-aware rasterization for quick maps. Makie plotting lives in AtmosTransportMakieExt so the model/runtime does not pay a plotting load cost unless a Makie backend is explicitly loaded.
AtmosTransport.Visualization.CubedSphereSnapshotTopology Type
CubedSphereSnapshotTopology(Nc, nlevel, panel_convention[, definition])Cubed-sphere snapshot geometry. Values are stored as (Xdim, Ydim, nf) for a single horizontal field, with nf == 6. definition is the mesh the snapshot was written on (coordinate and center laws, panel convention, longitude offset); it defaults to the panel convention's standard definition.
AtmosTransport.Visualization.HorizontalField Type
HorizontalFieldA topology-native horizontal field view from one snapshot time.
For LL/RG snapshots values is a (lon, lat) matrix. For CS snapshots it is a (Xdim, Ydim, nf) array until rasterized or plotted natively.
AtmosTransport.Visualization.LatLonSnapshotTopology Type
LatLonSnapshotTopology(lons, lats; grid_type=:latlon)Regular lon-lat snapshot geometry. Values are stored as (lon, lat).
AtmosTransport.Visualization.PlotSpec Type
PlotSpec(variable; transform=ColumnMean(), level=nothing, title=nothing, unit=NativeUnit())One panel specification for multi-panel plots and movies.
sourceAtmosTransport.Visualization.RasterField Type
RasterFieldRegular lon-lat representation used by fast debug maps and movies.
sourceAtmosTransport.Visualization.ReducedGaussianSnapshotTopology Type
ReducedGaussianSnapshotTopology(lons, lats, nrings, regridding)Reduced-Gaussian snapshot geometry after the current writer's ring-aware nearest-neighbor projection onto a regular lon-lat diagnostic grid.
sourceAtmosTransport.Visualization.SnapshotDataset Type
SnapshotDatasetMetadata for an AtmosTransport NetCDF snapshot file.
The object intentionally does not hold an open NetCDF handle. Field reads open the file briefly and close it immediately, which is robust for scripts, animations, and long debugging sessions.
sourceAtmosTransport.Visualization.SnapshotRegridCache Type
SnapshotRegridCache()Cache expensive topology-to-raster geometry, especially CS→LL conservative regridders, across frames in snapshot grids and movies.
sourceAtmosTransport.Visualization.as_raster Method
as_raster(field; resolution=(360, 181), cache=SnapshotRegridCache())Return a regular lon-lat RasterField for fast plotting.
LL and current RG diagnostic snapshots are already raster-like. CS fields are conservatively regridded to lon-lat and reuse cache across frames.
AtmosTransport.Visualization.catrine_map_curtains Method
catrine_map_curtains(at_path, gc_dir; kwargs...) -> NamedTupleCreate the CATRINE AtmosTransport/GEOS-Chem column-map and pressure-curtain comparison product. Output is controlled by the out_dir keyword. This specialized visualization requires a Makie backend.
AtmosTransport.Visualization.catrine_map_curtains_3way Method
catrine_map_curtains_3way(at_geos_path, at_era5_path, gc_dir; kwargs...) -> NamedTupleCompare GEOS-Chem with AtmosTransport runs driven by GEOS-IT and ERA5 in one CATRINE column-map and pressure-curtain product. Output is controlled by the out_dir keyword. This specialized visualization requires a Makie backend.
AtmosTransport.Visualization.fieldview Method
fieldview(snapshot, variable; transform=ColumnMean(), time=1, level=nothing, unit=NativeUnit())Load one topology-native horizontal field from a snapshot file.
time may be a one-based frame index or a snapshot hour. For CS snapshots, transform may be ColumnMean(), ColumnSum(), LevelSlice(), or SurfaceSlice(). Stored CS column means support column-only output; level selection uses original model indices and rejects levels that were not written. LL/RG snapshots currently support ColumnMean() only.
AtmosTransport.Visualization.mapplot! Method
mapplot!(axis, field; kwargs...)Render a topology-aware field into an existing Makie axis and return the plot object. A Makie backend must be loaded.
sourceAtmosTransport.Visualization.mapplot Method
mapplot(field; kwargs...) -> FigureRender one topology-aware HorizontalField as a lon-lat map. Load a Makie backend such as CairoMakie before calling this function. Cubed-sphere fields are conservatively rasterized and may reuse a SnapshotRegridCache.
AtmosTransport.Visualization.movie Method
movie(snapshot, variable, output_path; kwargs...) -> StringRender one snapshot variable to an animation and return output_path. A Makie backend must be loaded.
AtmosTransport.Visualization.movie_grid Method
movie_grid(snapshot, specs, output_path; kwargs...) -> StringRender several PlotSpec panels to one animation and return output_path. A Makie backend must be loaded.
AtmosTransport.Visualization.open_snapshot Method
open_snapshot(path) -> SnapshotDatasetRead snapshot metadata and infer its topology.
Supported formats are the current AtmosTransport LL/RG column-mean snapshots and CS panel snapshots written by run_driven_simulation.
AtmosTransport.Visualization.robust_colorrange Method
robust_colorrange(fields; trim=(0.01, 0.99))Compute a robust color range from one or more fields by ignoring non-finite values and clipping to quantiles.
sourceAtmosTransport.Visualization.snapshot_grid Method
snapshot_grid(snapshot, variable; kwargs...) -> FigureRender one snapshot variable at several output times in a shared figure. A Makie backend must be loaded.
source