Skip to content

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

vSmartMOM.IO.read_atmos_profile Function

Load atmospheric profile from YAML file path

source
vSmartMOM.IO.read_atmos_profile_dict Function

Read atmospheric profile from a parameters Dict

source

Typed Sources

vSmartMOM.IO.Sources.GeosChemSource Type
julia
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 grid

  • idy::Int: Y-dimension index on the cubed-sphere grid

  • idf::Int: Face index (1-6) for the cubed-sphere face

Usage

julia
src = GeosChemSource("GEOSChem.Custom.20190101_0000z.nc4", 10, 20, 1)
params = parameters_from_yaml(src)  # Reads NetCDF, converts to vSmartMOM_Parameters

Notes

GEOSChem files have dimensions (Xdim × Ydim × nf × lev × time), where:

  • nf: Cubed-sphere face (1-6)

  • Xdim, Ydim: Location on that face

  • lev: 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).

source
vSmartMOM.IO.Sources.NetCDFGridSource Type
julia
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 file

  • lat_idx::Int: Latitude grid index

  • lon_idx::Int: Longitude grid index

Usage

julia
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.

source
vSmartMOM.IO.Sources.NetCDFSource Type
julia
abstract type NetCDFSource <: IOSource

Abstract type for all NetCDF-based data sources. Provides a hierarchy for different NetCDF formats (GEOSChem, WRF, GCHP, etc.).

source
vSmartMOM.IO.geoschem_to_dict Function
julia
geoschem_to_dict(src::GeosChemSource) -> Dict

Read 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 face

  • lev: Model layers, indexing from BOA (lev=1) to TOA (lev=72)

Data is automatically flipped to match vSmartMOM convention (TOA→BOA indexing).

Example

julia
src = GeosChemSource("GEOSChem.Custom.20190101_0000z.nc4", 10, 20, 1)
config_dict = geoschem_to_dict(src)
# Now use with parameters_from_dict(config_dict)
source
vSmartMOM.IO.read_geoschem_profile Function
julia
read_geoschem_profile(file::String, idx::Int, idy::Int, idf::Int) -> Dict

Convenience function to read a GEOSChem file and return the configuration Dict.

Arguments

  • file::String: Path to GEOSChem NetCDF4 file

  • idx::Int: X-dimension index

  • idy::Int: Y-dimension index

  • idf::Int: Face index (1-6)

Returns

  • Dict: Configuration dictionary compatible with parameters_from_dict

Example

julia
config = read_geoschem_profile("GEOSChem.Custom.20190101_0000z.nc4", 10, 20, 1)
params = parameters_from_dict(config)
source