pycsa.data.cell¶
Grid and topography data classes.
Moved from pycsa.core.var and refactored to use @dataclass for
explicit field declarations. Behavior is preserved including the
grid.apply_f convenience, which is now driven by a ClassVar
exclusion list instead of a runtime-set instance attribute.
topo_cell inherits its on-disk fields (lon, lat, topo,
analysis) from topo and adds methods that set further runtime
attributes (lon_grid, lat_grid, mask, topo_m, …) — these
are not declared as dataclass fields because they’re side products of
gen_mgrids / get_masked / get_grad_topo rather than
construction arguments.
Classes
|
ICON triangular grid: cell centers + vertex coordinates + areas. |
|
Topography container: 1-D lat/lon arrays + 2-D elevation + analysis. |
|
Cell-specific topography. |
- class pycsa.data.cell.grid(clat: ndarray | None = None, clat_vertices: ndarray | None = None, clon: ndarray | None = None, clon_vertices: ndarray | None = None, links: ndarray | None = None, cell_area: ndarray | None = None)¶
ICON triangular grid: cell centers + vertex coordinates + areas.
linksis a lookup table mapping cells to their topography source file;cell_areais the per-cell area in m². Both are skipped byapply_f()because they are not (lat, lon)-style data needing unit conversion.- NON_CONVERTIBLES = ('links', 'cell_area')¶
- apply_f(f)¶
Apply
fto each (lat, lon)-style attribute.Skips
NON_CONVERTIBLES. Used in the wild asgrid.apply_f(utils.rad2deg)to convert radians to degrees after loading from a NetCDF.- Parameters:
f (callable) – Function applied in-place to each non-skipped, non-
Nonefield.
- class pycsa.data.cell.topo(lon: ndarray | None = None, lat: ndarray | None = None, topo: ndarray | None = None, analysis: Any | None = None)¶
Topography container: 1-D lat/lon arrays + 2-D elevation + analysis.
The
analysisfield is leftAnybecause it holds apycsa.data.results.analysisinstance, but importing that here would create a circular dependency.
- class pycsa.data.cell.topo_cell(lon: ndarray | None = None, lat: ndarray | None = None, topo: ndarray | None = None, analysis: Any | None = None)¶
Cell-specific topography. Inherits
lon/lat/topo/analysisfromtopo.- gen_mgrids(grad: bool = False) None¶
Generate meshgrids from the 1-D lat/lon arrays.
Sets
self.lon_gridandself.lat_grid(and the gradient meshgrids whengrad=True). These attributes are runtime artifacts; they’re not dataclass fields.