IO API
The IO layer validates scene inputs and dispatches loading by source type: ordinary files, dictionaries, NetCDF sources, and GEOS-Chem products.
Atmospheric Profiles
Typed Sources
vSmartMOM.IO.Sources.GeosChemSource Type
GeosChemSource(path::String, idx::Int, idy::Int, idf::Int)IO source for GEOSChem output files (NetCDF4 format).
Fields
path::String: Path to the GEOSChem NetCDF4 file (e.g., GEOSChem.Custom.YYYYMMDD_HHMMz.nc4)idx::Int: X-dimension index on the cubed-sphere grididy::Int: Y-dimension index on the cubed-sphere grididf::Int: Face index (1-6) for the cubed-sphere face
Usage
src = GeosChemSource("GEOSChem.Custom.20190101_0000z.nc4", 10, 20, 1)
params = parameters_from_yaml(src) # Reads NetCDF, converts to vSmartMOM_ParametersNotes
GEOSChem files have dimensions (Xdim × Ydim × nf × lev × time), where:
nf: Cubed-sphere face (1-6)Xdim, Ydim: Location on that facelev: Model layers (1=BOA, 72=TOA for typical setup)time: Time dimension
The data is automatically flipped from GCHP convention (BOA→TOA) to vSmartMOM convention (TOA→BOA).
sourcevSmartMOM.IO.Sources.NetCDFGridSource Type
NetCDFGridSource(path::String, lat_idx::Int, lon_idx::Int)Generic IO source for gridded NetCDF atmospheric data (WRF, GCHP, etc.).
Fields
path::String: Path to the NetCDF filelat_idx::Int: Latitude grid indexlon_idx::Int: Longitude grid index
Usage
src = NetCDFGridSource("wrfout.nc", 50, 100)
params = parameters_from_yaml(src)Notes
This is a generic source for rectilinear gridded data. For specialized formats (like GEOSChem with cubed-sphere), use the specific source type instead.
sourcevSmartMOM.IO.Sources.NetCDFSource Type
abstract type NetCDFSource <: IOSourceAbstract type for all NetCDF-based data sources. Provides a hierarchy for different NetCDF formats (GEOSChem, WRF, GCHP, etc.).
sourcevSmartMOM.IO.geoschem_to_dict Function
geoschem_to_dict(src::GeosChemSource) -> DictRead a GEOSChem NetCDF4 file at the specified grid location and convert to a Dict compatible with parameters_from_dict.
Arguments
src::GeosChemSource: Source specification with file path and grid indices
Returns
Dict: Configuration dictionary with atmospheric_profile and absorption sections
Notes
The GEOSChem file structure has dimensions (Xdim × Ydim × nf × lev × time):
nf: Which of the 6 cubed-sphere faces (1-6)Xdim, Ydim: Location on that facelev: Model layers, indexing from BOA (lev=1) to TOA (lev=72)
Data is automatically flipped to match vSmartMOM convention (TOA→BOA indexing).
Example
src = GeosChemSource("GEOSChem.Custom.20190101_0000z.nc4", 10, 20, 1)
config_dict = geoschem_to_dict(src)
# Now use with parameters_from_dict(config_dict)vSmartMOM.IO.read_geoschem_profile Function
read_geoschem_profile(file::String, idx::Int, idy::Int, idf::Int) -> DictConvenience function to read a GEOSChem file and return the configuration Dict.
Arguments
file::String: Path to GEOSChem NetCDF4 fileidx::Int: X-dimension indexidy::Int: Y-dimension indexidf::Int: Face index (1-6)
Returns
Dict: Configuration dictionary compatible withparameters_from_dict
Example
config = read_geoschem_profile("GEOSChem.Custom.20190101_0000z.nc4", 10, 20, 1)
params = parameters_from_dict(config)