Priors¶
The prior mean emission from a gridded inventory (EDGAR, GFEI, EPA), averaged over the analysis T-cells, and the v1 per-tile background for column observations. Tier 0. load_inventory needs pip install 'plumax[io]'.
priors
¶
Priors for the inversions (Tier 0 prerequisites).
- :func:
load_inventory— a gridded inventory's area-mean flux on the analysis T-cells, as the prior mean emission [kg m⁻² s⁻¹]. - :func:
per_tile_background— v1 background for column observations, the median within square tiles of the analysis frame.
per_tile_background
¶
per_tile_background(columns: Float[ndarray, ' obs'], receptors: Float[ndarray, 'obs 2'], *, tile_m: float = 10000.0) -> Float[np.ndarray, ' obs']
Median of the observations in each square tile, given to every receptor.
b_n = median{ y_m : tile(𝐱_m) = tile(𝐱_n) }, tile(𝐱) = (⌊x / ℓ⌋, ⌊y / ℓ⌋).
The median is not moved by a plume covering less than half a tile.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
columns
|
Float[ndarray, ' obs']
|
Observed columns y_n, any units. |
required |
receptors
|
Float[ndarray, 'obs 2']
|
Receptor positions 𝐱_n = (x, y) in frame metres. |
required |
tile_m
|
float
|
Tile edge ℓ [m]. |
10000.0
|
Returns:
| Type | Description |
|---|---|
Float[ndarray, ' obs']
|
Background b_n per receptor, in the units of |
Raises:
| Type | Description |
|---|---|
GridMismatchError
|
If |
PlumaxError
|
If |
Examples:
Two tiles, one with a plume pixel the median ignores:
>>> import numpy as np
>>> receptors = np.array(
... [[1e3, 0.0], [2e3, 0.0], [3e3, 0.0], [12e3, 0.0], [15e3, 0.0]]
... )
>>> columns = np.array([1880.0, 1880.0, 1960.0, 1900.0, 1900.0])
>>> per_tile_background(columns, receptors).tolist()
[1880.0, 1880.0, 1880.0, 1900.0, 1900.0]
One tile spanning the scene gives the scene median:
>>> per_tile_background(columns, receptors, tile_m=1e6).tolist()
[1900.0, 1900.0, 1900.0, 1900.0, 1900.0]
Source code in src/plumax/priors/_src/background.py
load_inventory
¶
load_inventory(path: str | Path, *, frame: LocalFrame, grid: PlumeGrid3D, variable: str | None = None, units: str | None = None, time_index: int = 0, supersample: int = 8) -> Float[Array, 'y x']
Area-mean inventory flux over each analysis T-cell, as a prior mean.
F̄c = (1/|c|) ∫_c F dA ≈ (1/s²) Σ F(𝐱_k),}^{s²
with 𝐱_k an s × s lattice of points evenly spaced in frame metres
over cell c. The sampling error falls as 1/s at inventory-cell edges;
the frame is conformal and locally near-equidistant, so equal frame areas
are equal ground areas.
Algorithm
- Read the inventory with :func:
xrreader.open_ch4_inventory, which converts to kg m⁻² s⁻¹ with ascending lat and lon in [-180, 180). - Lay an
s × slattice over every analysis cell and map it to lat/lon. - Unwrap the raster's longitudes to start after their widest gap, look up the inventory cell holding each point (longitudes modulo 360° from the first edge) and average over each analysis cell's lattice.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str | Path
|
Inventory NetCDF (one sector or a total). |
required |
frame
|
LocalFrame
|
Frame the analysis grid is laid out in. |
required |
grid
|
PlumeGrid3D
|
Analysis grid, in |
required |
variable
|
str | None
|
Flux variable name; inferred by the reader when |
None
|
units
|
str | None
|
Override of the file's units attribute. |
None
|
time_index
|
int
|
Time step to use when the file has a |
0
|
supersample
|
int
|
Sub-points per cell edge, s. |
8
|
Returns:
| Type | Description |
|---|---|
Float[Array, 'y x']
|
F̄ [kg m⁻² s⁻¹] on the horizontal T-cells, in the grid's dtype. |
Raises:
| Type | Description |
|---|---|
MissingExtraError
|
If the |
DomainError
|
If a lattice point falls outside the inventory raster, or the raster's longitudes are unevenly spaced. |
Source code in src/plumax/priors/_src/inventory.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 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 | |