Documentation ¶
Overview ¶
Package inmap is an air quality model for predicting health impacts of air pollutant emissions.
Index ¶
- Constants
- Variables
- func CreateTestCTMData() (VarGridConfig, *CTMData)
- func DeleteShapefile(fname string) error
- func Regrid(oldGeom, newGeom []geom.Polygonal, oldData []float64) (newData []float64, err error)
- func VarGridTestData() (*VarGridConfig, *CTMData, *Population, PopIndices, *MortalityRates, ...)
- func WriteTestMortalityShapefile()
- type CTMData
- type Cell
- type CellManipulator
- type ConvergenceStatus
- type DomainManipulator
- func Calculations(calculators ...CellManipulator) DomainManipulator
- func Load(r io.Reader, config *VarGridConfig, emis *Emissions, m Mechanism) DomainManipulator
- func Log(c chan *SimulationStatus) DomainManipulator
- func ResetCells() DomainManipulator
- func RunPeriodically(period float64, f DomainManipulator) DomainManipulator
- func Save(w io.Writer) DomainManipulator
- func SetTimestepCFL() DomainManipulator
- func SteadyStateConvergenceCheck(numIterations int, popGridColumn string, m Mechanism, c chan ConvergenceStatus) DomainManipulator
- type EmisRecord
- type Emissions
- type GEOSChem
- func (gc *GEOSChem) ALT() NextData
- func (gc *GEOSChem) ASOA() NextData
- func (gc *GEOSChem) AVOC() NextData
- func (gc *GEOSChem) BSOA() NextData
- func (gc *GEOSChem) BVOC() NextData
- func (gc *GEOSChem) CloudFrac() NextData
- func (gc *GEOSChem) DX() (float64, error)
- func (gc *GEOSChem) DY() (float64, error)
- func (gc *GEOSChem) H2O2() NextData
- func (gc *GEOSChem) HO() NextData
- func (gc *GEOSChem) Height() NextData
- func (gc *GEOSChem) NH3() NextData
- func (gc *GEOSChem) NOx() NextData
- func (gc *GEOSChem) Nx() (int, error)
- func (gc *GEOSChem) Ny() (int, error)
- func (gc *GEOSChem) Nz() (int, error)
- func (gc *GEOSChem) P() NextData
- func (gc *GEOSChem) PBLH() NextData
- func (gc *GEOSChem) PNH() NextData
- func (gc *GEOSChem) PNO() NextData
- func (gc *GEOSChem) PS() NextData
- func (gc *GEOSChem) QCloud() NextData
- func (gc *GEOSChem) QRain() NextData
- func (gc *GEOSChem) RadiationDown() NextData
- func (gc *GEOSChem) SOx() NextData
- func (gc *GEOSChem) SeinfeldLandUse() NextData
- func (gc *GEOSChem) SurfaceHeatFlux() NextData
- func (gc *GEOSChem) T() NextData
- func (gc *GEOSChem) TotalPM25() NextData
- func (gc *GEOSChem) U() NextData
- func (gc *GEOSChem) UStar() NextData
- func (gc *GEOSChem) V() NextData
- func (gc *GEOSChem) W() NextData
- func (gc *GEOSChem) WeselyLandUse() NextData
- func (gc *GEOSChem) XCenters() ([]float64, error)
- func (gc *GEOSChem) YCenters() ([]float64, error)
- func (gc *GEOSChem) Z0() NextData
- type GridMutator
- type InMAP
- func (d *InMAP) CellIntersections(g geom.Geom) (cells []*Cell, fractions []float64)
- func (d *InMAP) Cells() []*Cell
- func (d *InMAP) Cleanup() error
- func (d *InMAP) GetGeometry(layer int, webMap bool) []geom.Polygonal
- func (d *InMAP) Init() error
- func (d *InMAP) InsertCell(c *Cell, m Mechanism)
- func (d *InMAP) OutputOptions(m Mechanism) (names []string, descriptions []string, units []string)
- func (d *InMAP) Results(o *Outputter) (map[string][]float64, error)
- func (d *InMAP) Run() error
- func (d *InMAP) SetEmissionsFlux(emis *Emissions, m Mechanism) error
- func (d *InMAP) VerticalProfile(variable string, p geom.Point, m Mechanism) (height, vals []float64, err error)
- type Mechanism
- type MortIndices
- type MortalityRates
- type NextData
- type Outputter
- type PopConcMutator
- type PopIndices
- type Population
- type Preprocessor
- type SimulationStatus
- type VarGridConfig
- func (config *VarGridConfig) LoadCTMData(rw cdf.ReaderWriterAt) (*CTMData, error)
- func (config *VarGridConfig) LoadPopMort() (*Population, PopIndices, *MortalityRates, MortIndices, error)
- func (config *VarGridConfig) MutateGrid(divideRule GridMutator, data *CTMData, pop *Population, ...) DomainManipulator
- func (config *VarGridConfig) RegularGrid(data *CTMData, pop *Population, popIndex PopIndices, mortRates *MortalityRates, ...) DomainManipulator
- type WRFChem
- func (w *WRFChem) ALT() NextData
- func (w *WRFChem) ASOA() NextData
- func (w *WRFChem) AVOC() NextData
- func (w *WRFChem) BSOA() NextData
- func (w *WRFChem) BVOC() NextData
- func (w *WRFChem) CloudFrac() NextData
- func (w *WRFChem) GLW() NextData
- func (w *WRFChem) H2O2() NextData
- func (w *WRFChem) HO() NextData
- func (w *WRFChem) Height() NextData
- func (w *WRFChem) NH3() NextData
- func (w *WRFChem) NOx() NextData
- func (w *WRFChem) Nx() (int, error)
- func (w *WRFChem) Ny() (int, error)
- func (w *WRFChem) Nz() (int, error)
- func (w *WRFChem) P() NextData
- func (w *WRFChem) PBLH() NextData
- func (w *WRFChem) PNH() NextData
- func (w *WRFChem) PNO() NextData
- func (w *WRFChem) PS() NextData
- func (w *WRFChem) QCloud() NextData
- func (w *WRFChem) QRain() NextData
- func (w *WRFChem) RadiationDown() NextData
- func (w *WRFChem) SOx() NextData
- func (w *WRFChem) SWDown() NextData
- func (w *WRFChem) SeinfeldLandUse() NextData
- func (w *WRFChem) SurfaceHeatFlux() NextData
- func (w *WRFChem) T() NextData
- func (w *WRFChem) TotalPM25() NextData
- func (w *WRFChem) U() NextData
- func (w *WRFChem) UStar() NextData
- func (w *WRFChem) V() NextData
- func (w *WRFChem) W() NextData
- func (w *WRFChem) WeselyLandUse() NextData
- func (w *WRFChem) Z0() NextData
Constants ¶
const ( // Version gives the version number. Version = "1.9.0" // VarGridDataVersion gives the version of the variable grid data reuquired by // this version of the software. VarGridDataVersion = "1.6.1" // InMAPDataVersion is the version of the InMAP data required by this version // of the software. InMAPDataVersion = "1.2.0" )
const ( MWa = 28.97 // g/mol, molar mass of air // Chemical mass conversions [ratios] NOxToN = mwN / mwNOx NtoNO3 = mwNO3 / mwN SOxToS = mwS / mwSO2 StoSO4 = mwSO4 / mwS NH3ToN = mwN / mwNH3 NtoNH4 = mwNH4 / mwN )
physical constants
const ( // TestGridSR is a spatial reference for testing. TestGridSR = `` /* 432-byte string literal not displayed */ // TestPopulationShapefile is a population shapefile for testing. TestPopulationShapefile = "tempPopulation.shp" // TestMortalityShapefile is mortality rate shapefile for testing. TestMortalityShapefile = "tempMortality.shp" // TestCTMDataFile is a CTMData file for testing. TestCTMDataFile = "tempCTMData.ncf" )
Variables ¶
var PolNames = []string{"gOrg", "pOrg",
"PM2_5",
"gNH", "pNH",
"gS", "pS",
"gNO", "pNO",
}
PolNames are the names of pollutants within the model
var USGSseinfeld = []seinfeld.LandUseCategory{ seinfeld.Desert, seinfeld.Grass, seinfeld.Grass, seinfeld.Grass, seinfeld.Grass, seinfeld.Grass, seinfeld.Grass, seinfeld.Shrubs, seinfeld.Shrubs, seinfeld.Grass, seinfeld.Deciduous, seinfeld.Evergreen, seinfeld.Deciduous, seinfeld.Evergreen, seinfeld.Deciduous, seinfeld.Desert, seinfeld.Grass, seinfeld.Deciduous, seinfeld.Desert, seinfeld.Shrubs, seinfeld.Deciduous, seinfeld.Shrubs, seinfeld.Desert, seinfeld.Desert, seinfeld.Desert, seinfeld.Desert, seinfeld.Desert, }
USGSseinfeld lookup table to go from USGS land classes to land classes for particle dry deposition.
var USGSwesely = []wesely1989.LandUseCategory{ wesely1989.Urban, wesely1989.RangeAg, wesely1989.RangeAg, wesely1989.RangeAg, wesely1989.RangeAg, wesely1989.Agricultural, wesely1989.Range, wesely1989.RockyShrubs, wesely1989.RangeAg, wesely1989.Range, wesely1989.Deciduous, wesely1989.Coniferous, wesely1989.Deciduous, wesely1989.Coniferous, wesely1989.MixedForest, wesely1989.Water, wesely1989.Wetland, wesely1989.Wetland, wesely1989.Barren, wesely1989.RockyShrubs, wesely1989.MixedForest, wesely1989.RockyShrubs, wesely1989.Barren, wesely1989.Barren, wesely1989.Barren, wesely1989.Barren, wesely1989.Barren, }
USGSwesely lookup table to go from USGS land classes to land classes for gas dry deposition.
var USGSz0 = []float64{.50, .1, .06, .1, 0.095, .20, .11,
.03, .035, .15, .50, .50, .50, .50, .35, 0.0001, .20, .40,
.01, .10, .30, .15, .075, 0.001, .01, .15, .01}
USGSz0 holds Roughness lengths for USGS land classes ([m]), from WRF file VEGPARM.TBL.
var WriteTestPopShapefile = func() { // holder for test population data. type pop struct { geom.Polygon TotalPop, WhiteNoLat, Black, Native, Asian, Latino float64 } popData := []pop{ { Polygon: []geom.Path{{ geom.Point{X: -3999, Y: -3999}, geom.Point{X: -3899, Y: -3999}, geom.Point{X: -3899, Y: -3899}, geom.Point{X: -3999, Y: -3899}, geom.Point{X: -3999, Y: -3999}, }}, TotalPop: 100000., WhiteNoLat: 50000., Black: 20000., Asian: 8000., Native: 2000., Latino: 20000., }, { Polygon: []geom.Path{{ geom.Point{X: -3499, Y: -3001}, geom.Point{X: -3501, Y: -3001}, geom.Point{X: -3501, Y: -2999}, geom.Point{X: -3499, Y: -2999}, geom.Point{X: -3499, Y: -3001}, }}, TotalPop: 0., WhiteNoLat: 0., Black: 0., Asian: 0., Native: 0., Latino: 10000., }, } e, err := shp.NewEncoder(TestPopulationShapefile, pop{}) if err != nil { panic(err) } for _, p := range popData { if err = e.Encode(p); err != nil { panic(err) } } e.Close() f, err := os.Create(strings.TrimRight(TestPopulationShapefile, ".shp") + ".prj") if err != nil { panic(err) } if _, err = f.Write([]byte(TestGridSR)); err != nil { panic(err) } f.Close() }
WriteTestPopShapefile writes out a population shapefile for testing.
Functions ¶
func CreateTestCTMData ¶ added in v1.4.1
func CreateTestCTMData() (VarGridConfig, *CTMData)
CreateTestCTMData creates example CTMData for testing.
func DeleteShapefile ¶ added in v1.4.1
DeleteShapefile deletes the named shapefile.
func Regrid ¶ added in v1.2.0
Regrid regrids concentration data from one spatial grid to a different one.
func VarGridTestData ¶ added in v1.4.1
func VarGridTestData() (*VarGridConfig, *CTMData, *Population, PopIndices, *MortalityRates, MortIndices)
VarGridTestData returns some test data for variable grid generation.
func WriteTestMortalityShapefile ¶ added in v1.4.1
func WriteTestMortalityShapefile()
WriteTestMortalityShapefile writes out a mortality rate shapefile for testing.
Types ¶
type CTMData ¶ added in v1.2.0
type CTMData struct { // Data is a map of information about processed CTM variables, // with the keys being the variable names. Data map[string]struct { Dims []string // netcdf dimensions for this variable Description string // variable description Units string // variable units Data *sparse.DenseArray // variable data } // contains filtered or unexported fields }
CTMData holds processed data from a chemical transport model
func CombineCTMData ¶ added in v1.7.0
CombineCTMData returns the combination of the input data nests. The output will have the extent of the first nest and the horizontal resolution of the highest resolution nest. It is assumed that the nests fit neatly inside each other; no interpolation will be performed. The input nests will be overlayed onto the output in the provided order, so each sequential nest will write over any previous nest(s) that it overlaps with. Vertical layers are assumed to be the same among all nests; no vertical layer interpolation is performed. If the nests do not all have the same number of layers, an error will be returned.
func Preprocess ¶ added in v1.4.1
func Preprocess(p Preprocessor, xo, yo, dx, dy float64) (*CTMData, error)
Preprocess returns preprocessed InMAP input data based on the information available from the given preprocessor. x0 and y0 are the left and y coordinates of the lower-left corner of the domain, and dx and dy are the x and y edge lengths of the grid cells, respectively.
func (*CTMData) AddVariable ¶ added in v1.2.0
func (d *CTMData) AddVariable(name string, dims []string, description, units string, data *sparse.DenseArray)
AddVariable adds data for a new variable to d.
type Cell ¶
type Cell struct { geom.Polygonal // Cell geometry WebMapGeom geom.Polygonal // Cell geometry in web map (mercator) coordinate system UAvg float64 `desc:"Average East-West wind speed" units:"m/s"` VAvg float64 `desc:"Average North-South wind speed" units:"m/s"` WAvg float64 `desc:"Average up-down wind speed" units:"m/s"` UDeviation float64 `desc:"Average deviation from East-West velocity" units:"m/s"` VDeviation float64 `desc:"Average deviation from North-South velocity" units:"m/s"` AOrgPartitioning float64 `desc:"Organic particle partitioning" units:"fraction particles"` BOrgPartitioning float64 // particle fraction SPartitioning float64 `desc:"Sulfur particle partitioning" units:"fraction particles"` NOPartitioning float64 `desc:"Nitrate particle partitioning" units:"fraction particles"` NHPartitioning float64 `desc:"Ammonium particle partitioning" units:"fraction particles"` SO2oxidation float64 `desc:"SO2 oxidation to SO4 by HO and H2O2" units:"1/s"` ParticleWetDep float64 `desc:"Particle wet deposition" units:"1/s"` SO2WetDep float64 `desc:"SO2 wet deposition" units:"1/s"` OtherGasWetDep float64 `desc:"Wet deposition: other gases" units:"1/s"` ParticleDryDep float64 `desc:"Particle dry deposition" units:"m/s"` NH3DryDep float64 `desc:"Ammonia dry deposition" units:"m/s"` SO2DryDep float64 `desc:"SO2 dry deposition" units:"m/s"` VOCDryDep float64 `desc:"VOC dry deposition" units:"m/s"` NOxDryDep float64 `desc:"NOx dry deposition" units:"m/s"` Kzz float64 `desc:"Grid center vertical diffusivity after applying convective fraction" units:"m²/s"` Kxxyy float64 `desc:"Grid center horizontal diffusivity" units:"m²/s"` M2u float64 `desc:"ACM2 upward mixing (Pleim 2007)" units:"1/s"` M2d float64 `desc:"ACM2 downward mixing (Pleim 2007)" units:"1/s"` PopData []float64 // Population for multiple demographics [people/grid cell] MortData []float64 // Baseline mortality rates for multiple demographics [Deaths per 100,000 people per year/grid cell] Dx float64 `desc:"Cell x length" units:"m"` Dy float64 `desc:"Cell y length" units:"m"` Dz float64 `desc:"Cell z length" units:"m"` Volume float64 `desc:"Cell volume" units:"m³"` Ci []float64 // concentrations at beginning of time step [μg/m³] Cf []float64 // concentrations at end of time step [μg/m³] EmisFlux []float64 // emissions [μg/m³/s] CBaseline []float64 // Total baseline PM2.5 concentration. Layer int `desc:"Vertical layer index" units:"-"` LayerHeight float64 `desc:"Height at layer bottom" units:"m"` Temperature float64 `desc:"Average temperature" units:"K"` WindSpeed float64 `desc:"RMS wind speed" units:"m/s"` WindSpeedInverse float64 `desc:"RMS wind speed inverse" units:"(m/s)^(-1)"` WindSpeedMinusThird float64 `desc:"RMS wind speed^(-1/3)" units:"(m/s)^(-1/3)"` WindSpeedMinusOnePointFour float64 `desc:"RMS wind speed^(-1.4)" units:"(m/s)^(-1.4)"` S1 float64 `desc:"Stability parameter" units:"?"` SClass float64 `desc:"Stability class" units:"0=Unstable; 1=Stable"` Index [][2]int // Index gives this cell's place in the nest structure. AboveDensityThreshold bool // contains filtered or unexported fields }
Cell holds the state of a single grid cell.
func (*Cell) IsPlumeIn ¶ added in v1.2.0
func (c *Cell) IsPlumeIn(stackHeight, stackDiam, stackTemp, stackVel float64) (bool, float64, error)
IsPlumeIn calculates whether the plume rise from an emission is at the height of c when given stack information (see github.com/ctessum/atmos/plumerise for required units). The return values are whether the plume rise ends within the current cell, the height of the plume rise in meters, and whether there was an error.
func (*Cell) SetEmissionsFlux ¶ added in v1.7.0
SetEmissionsFlux sets the emissions flux for the receiver based on the emissions in e.
type CellManipulator ¶ added in v1.2.0
CellManipulator is a class of functions that operate on a single grid cell, using the given timestep Dt [seconds].
func AddEmissionsFlux ¶ added in v1.2.0
func AddEmissionsFlux() CellManipulator
AddEmissionsFlux adds emissions to c.Cf and sets c.Ci equal to c.Cf. It should be run once for each timestep, and it should not be run in parallel with other CellManipulators.
func MeanderMixing ¶ added in v1.2.0
func MeanderMixing() CellManipulator
MeanderMixing returns a function that calculates changes in concentrations caused by meanders: adevection that is resolved by the underlying comprehensive chemical transport model but is not resolved by InMAP.
func Mixing ¶ added in v1.2.0
func Mixing() CellManipulator
Mixing returns a function that calculates vertical mixing based on Pleim (2007), which is combined local-nonlocal closure scheme, for boundary layer and based on Wilson (2004) for above the boundary layer. Also calculate horizontal mixing.
func UpwindAdvection ¶ added in v1.2.0
func UpwindAdvection() CellManipulator
UpwindAdvection returns a function that calculates advection in the cell based on the upwind differences scheme.
type ConvergenceStatus ¶ added in v1.2.0
type ConvergenceStatus struct {
// contains filtered or unexported fields
}
ConvergenceStatus holds the percent difference for each pollutant between the last convergence check and this one.
func (ConvergenceStatus) String ¶ added in v1.2.0
func (c ConvergenceStatus) String() string
type DomainManipulator ¶ added in v1.2.0
DomainManipulator is a class of functions that operate on the entire InMAP domain.
func Calculations ¶ added in v1.2.0
func Calculations(calculators ...CellManipulator) DomainManipulator
Calculations returns a function that concurrently runs a series of calculations on all of the model grid cells.
func Load ¶ added in v1.2.0
func Load(r io.Reader, config *VarGridConfig, emis *Emissions, m Mechanism) DomainManipulator
Load returns a function that loads the data from a previously Saved file into an InMAP object.
func Log ¶ added in v1.2.0
func Log(c chan *SimulationStatus) DomainManipulator
Log sends simulation status messages to c.
func ResetCells ¶ added in v1.2.0
func ResetCells() DomainManipulator
ResetCells clears concentration and emissions information from all of the grid cells and boundary cells.
func RunPeriodically ¶ added in v1.2.0
func RunPeriodically(period float64, f DomainManipulator) DomainManipulator
RunPeriodically runs f periodically during the simulation, with the time in seconds between runs specified by period.
func Save ¶ added in v1.2.0
func Save(w io.Writer) DomainManipulator
Save returns a function that saves the data in d to a gob file (format description at https://golang.org/pkg/encoding/gob/).
func SetTimestepCFL ¶ added in v1.2.0
func SetTimestepCFL() DomainManipulator
SetTimestepCFL returns a function that sets the time step using the Courant–Friedrichs–Lewy (CFL) condition for advection or Von Neumann stability analysis (http://en.wikipedia.org/wiki/Von_Neumann_stability_analysis) for diffusion, whichever one yields a smaller time step.
func SteadyStateConvergenceCheck ¶ added in v1.2.0
func SteadyStateConvergenceCheck(numIterations int, popGridColumn string, m Mechanism, c chan ConvergenceStatus) DomainManipulator
SteadyStateConvergenceCheck checks whether a steady-state simulation is finished and sets the Done flag if it is. If numIterations > 0, the simulation is finished after that number of iterations have completed. Otherwise, the simulation has finished if the change in mass and population-weighted concentration of each pollutant in the domain since the last check are both less than 0.1%. Checks occur every 3 hours of simulation time. popGridColumn is the name of the population type used to determine grid cell sizes as in VarGridConfig.PopGridColumn. c is a channel over which the percent change between checks is sent. If c is nil, no status updates will be sent.
type EmisRecord ¶ added in v1.2.0
type EmisRecord struct { geom.Geom VOC, NOx, NH3, SOx float64 // emissions [μg/s] PM25 float64 `shp:"PM2_5"` // emissions [μg/s] Height float64 // stack height [m] Diam float64 // stack diameter [m] Temp float64 // stack temperature [K] Velocity float64 // stack velocity [m/s] }
EmisRecord is a holder for an emissions record.
func FromAEP ¶ added in v1.4.1
func FromAEP(r []aep.RecordGridded, grids []*aep.GridDef, gi int, VOC, NOx, NH3, SOx, PM25 []aep.Pollutant) ([]*EmisRecord, error)
FromAEP converts the given AEP (github.com/spatialmodel/inmap/emissions/aep) records to EmisRecords using the given grid definitions and grid index gi. VOC, NOx, NH3, SOx, and PM25 are lists of AEP Polluants that should be mapped to those InMAP species. The returned EmisRecords will be grouped as much as possible to minimize the number of records.
type Emissions ¶ added in v1.2.0
type Emissions struct { // Mask specifies the region that emissions should be clipped // to. It is assumed to use the same spatial reference as the // InMAP computational grid. It is ignored if nil. Mask geom.Polygon // contains filtered or unexported fields }
Emissions is a holder for input emissions data.
func NewEmissions ¶ added in v1.2.0
func NewEmissions() *Emissions
NewEmissions Initializes a new emissions holder.
func ReadEmissionShapefiles ¶ added in v1.2.0
func ReadEmissionShapefiles(gridSR *proj.SR, units string, c chan string, mask geom.Polygon, shapefiles ...string) (*Emissions, error)
ReadEmissionShapefiles returns the emissions data in the specified shapefiles, and converts them to the spatial reference gridSR. Input units are specified by units; options are tons/year, kg/year, ug/s, and μg/s. Output units = μg/s. c is a channel over which status updates will be sent. If c is nil, no updates will be sent. mask specifies the region that emissions should be clipped to, assumed to use the same spatial reference as the InMAP grid. If mask is nil it will be ignored.
func (*Emissions) Add ¶ added in v1.2.0
func (e *Emissions) Add(er *EmisRecord)
Add adds an emissions record to the receiver, clipping it to the Mask if necessary.
func (*Emissions) EmisRecords ¶ added in v1.4.1
func (e *Emissions) EmisRecords() []*EmisRecord
EmisRecords returns all EmisRecords stored in the receiver.
type GEOSChem ¶ added in v1.4.1
type GEOSChem struct {
// contains filtered or unexported fields
}
GEOSChem is an InMAP preprocessor for GEOS-Chem output. Information regarding GEOS-Chem output variables is available from http://wiki.seas.harvard.edu/geos-chem/index.php/List_of_GEOS-FP_met_fields and http://wiki.seas.harvard.edu/geos-chem/index.php/Species_in_GEOS-Chem.
func NewGEOSChem ¶ added in v1.4.1
func NewGEOSChem(GEOSA1, GEOSA3Cld, GEOSA3Dyn, GEOSI3, GEOSA3MstE, GEOSApBp, GEOSChemOut, OlsonLandMap, startDate, endDate string, dash bool, chemRecordStr, chemFileStr string, noChemHour bool, msgChan chan string) (*GEOSChem, error)
NewGEOSChem initializes a GEOS-Chem preprocessor from the given configuration information.
GEOSA1 is the location of the GEOS 1-hour time average files. [DATE] should be used as a wild card for the simulation date.
GEOSA3Cld is the location of the GEOS 3-hour average cloud parameter files. [DATE] should be used as a wild card for the simulation date.
GEOSA3Cld is the location of the GEOS 3-hour average dynamical parameter files. [DATE] should be used as a wild card for the simulation date.
GEOSI3 is the location of the GEOS 3-hour instantaneous parameter files. [DATE] should be used as a wild card for the simulation date.
GEOSA3MstE is the location of the GEOS 3-hour average moist parameters on level edges files. [DATE] should be used as a wild card for the simulation date.
geosApBp is the location of the pressure level variable file. It is optional; if it is not specified the Ap and Bp information will be extracted from the geosChem file.
GEOSChemOut is the location of GEOS-Chem output files. [DATE] should be used as a wild card for the simulation date.
OlsonLandMap is the location of the GEOS-Chem Olson land use map file, which is described here: http://wiki.seas.harvard.edu/geos-chem/index.php/Olson_land_map
startDate and endDate are the dates of the beginning and end of the simulation, respectively, in the format "YYYYMMDD".
If dash is true, GEOS-Chem chemical variable names are assumed to be in the form 'IJ-AVG-S__xxx'. If dash is false, they are assumed to be in the form 'IJ_AVG_S_xxx'.
If msgChan is not nil, status messages will be sent to it.
chemRecordInterval is the time interval between different records in the GEOS-Chem output. It is specified by the user as a string (chemRecordStr), e.g. "3h" for 3 hours.
chemFileInterval is the time interval of each file. It is specified as a string (chemFileStr), e.g. "3h" for 3 hours.
If noChemHour is true, then the GEOS-Chem output files will be assumed to not contain a time dimension.
func (*GEOSChem) ALT ¶ added in v1.4.1
ALT helps fulfill the Preprocessor interface, returning inverse air density m3/kg.
func (*GEOSChem) CloudFrac ¶ added in v1.4.1
CloudFrac helps fulfill the Preprocessor interface by returning the cloud volume fraction.
func (*GEOSChem) H2O2 ¶ added in v1.4.1
H2O2 helps fulfill the Preprocessor interface by returning hydrogen peroxide concentration [ppmv].
func (*GEOSChem) HO ¶ added in v1.4.1
HO helps fulfill the Preprocessor interface by returning hydroxyl radical concentration [ppmv].
func (*GEOSChem) Height ¶ added in v1.4.1
Height returns a functions that calculates layer heights at each time step using the hyposometric equation.
func (*GEOSChem) Nx ¶ added in v1.4.1
Nx helps fulfill the Preprocessor interface by returning the number of grid cells in the West-East direction.
func (*GEOSChem) Ny ¶ added in v1.4.1
Ny helps fulfill the Preprocessor interface by returning the number of grid cells in the South-North direction.
func (*GEOSChem) Nz ¶ added in v1.4.1
Nz helps fulfill the Preprocessor interface by returning the number of grid cells in the below-above direction.
func (*GEOSChem) P ¶ added in v1.4.1
P helps fulfill the Preprocessor interface by returning pressure [Pa].
func (*GEOSChem) QCloud ¶ added in v1.4.1
QCloud helps fulfill the Preprocessor interface by returning the cloud mass fraction.
func (*GEOSChem) QRain ¶ added in v1.4.1
QRain helps fulfill the Preprocessor interface by returning rain mass fraction based on the GEOS precipitation rate [kg m-2 s-1] and the assumption (from the EMEP model wet deposition algorithm) that raindrops are falling at 5 m/s.
func (*GEOSChem) RadiationDown ¶ added in v1.4.1
RadiationDown helps fulfill the Preprocessor interface by returning downwelling radiation [W m-2].
func (*GEOSChem) SeinfeldLandUse ¶ added in v1.4.1
SeinfeldLandUse helps fulfill the Preprocessor interface by returning land use categories as specified in github.com/ctessum/atmos/seinfeld.
func (*GEOSChem) SurfaceHeatFlux ¶ added in v1.4.1
SurfaceHeatFlux helps fulfill the Preprocessor interface by returning sensible heat flux from turbulence W/m2.
func (*GEOSChem) T ¶ added in v1.4.1
T helps fulfill the Preprocessor interface by returning temperature [K].
func (*GEOSChem) UStar ¶ added in v1.4.1
UStar helps fulfill the Preprocessor interface by returning friction velocity m/s.
func (*GEOSChem) WeselyLandUse ¶ added in v1.4.1
WeselyLandUse helps fulfill the Preprocessor interface by returning land use categories as specified in github.com/ctessum/atmos/wesely1989.
type GridMutator ¶ added in v1.2.0
A GridMutator is a function whether a Cell should be mutated (i.e., either divided or combined with other cells), where totalMass is absolute value of the total mass of pollution in the system and totalPopulation is the total population in the system.
func PopulationMutator ¶ added in v1.2.0
func PopulationMutator(config *VarGridConfig, popIndices PopIndices) (GridMutator, error)
PopulationMutator returns a function that determines whether a grid cell should be split by determining whether either the cell population or maximum poulation density are above the thresholds specified in config.
type InMAP ¶ added in v1.2.0
type InMAP struct { // InitFuncs are functions to be called in the given order // at the beginning of the simulation. InitFuncs []DomainManipulator // RunFuncs are functions to be called in the given order repeatedly // until "Done" is true. Therefore, the simulation will not end until // one of RunFuncs sets "Done" to true. RunFuncs []DomainManipulator // CleanupFuncs are functions to be run in the given order after the // simulation has completed. CleanupFuncs []DomainManipulator Dt float64 // seconds // Done specifies whether the simulation is finished. Done bool // VariableDescriptions gives descriptions of the model variables. VariableDescriptions map[string]string // VariableUnits gives the units of the model variables. VariableUnits map[string]string // PopIndices gives the array index of each population type in the PopData // field in each Cell. PopIndices map[string]int // contains filtered or unexported fields }
InMAP holds the current state of the model.
func (*InMAP) CellIntersections ¶ added in v1.2.0
CellIntersections returns an array of all of the grid cells (on all vertical levels) that intersect g, and an array of the fraction of g that intersects with each cell.
func (*InMAP) GetGeometry ¶ added in v1.2.0
GetGeometry returns the cell geometry for the given layer. if WebMap is true, it returns the geometry in web mercator projection, otherwise it returns the native grid projection.
func (*InMAP) InsertCell ¶ added in v1.2.0
InsertCell adds a new cell to the grid. The function will take the necessary steps to fit the new cell in with existing cells, but it is the caller's reponsibility that the new cell doesn't overlap any existing cells.
func (*InMAP) OutputOptions ¶ added in v1.2.0
OutputOptions returns the options for output variable names and their descriptions.
func (*InMAP) Results ¶ added in v1.2.0
Results returns the simulation results. Output is in the form of map[variable][row]concentration.
func (*InMAP) Run ¶ added in v1.2.0
Run carries out the simulation by running d.RunFuncs until d.Done is true.
func (*InMAP) SetEmissionsFlux ¶ added in v1.7.0
SetEmissionsFlux sets the emissions flux for the cells in the receiver based on the emissions in e.
type Mechanism ¶ added in v1.4.1
type Mechanism interface { // AddEmisFlux adds emissions flux to Cell c based on the given // pollutant name and amount in units of μg/s. The units of // the resulting flux may vary for different chemical mechanisms. AddEmisFlux(c *Cell, name string, val float64) error // DryDep returns a dry deposition function of the type indicated by // name that is compatible with this chemical mechanism. // Valid options may vary for different chemical mechanisms. DryDep(name string) (CellManipulator, error) // WetDep returns a dry deposition function of the type indicated by // name that is compatible with this chemical mechanism. // Valid options may vary for different chemical mechanisms. WetDep(name string) (CellManipulator, error) // Species returns the names of the emission and concentration pollutant // species that are used by this chemical mechanism. Species() []string // Value returns the concentration or emissions value of // the given variable in the given Cell. It returns an // error if given an invalid variable name. Value(c *Cell, variable string) (float64, error) // Units returns the units of the given variable, or an // error if the variable name is invalid. Units(variable string) (string, error) // Chemistry returns a function that simulates chemical reactions. Chemistry() CellManipulator // Len returns the number of pollutants in the chemical mechanism. Len() int }
Mechanism is an interface for atmospheric chemical mechanisms.
type MortIndices ¶ added in v1.4.1
MortIndices gives the array indices of each mortality rate.
type MortalityRates ¶ added in v1.2.0
type MortalityRates struct {
// contains filtered or unexported fields
}
MortalityRates is a holder for information about the average human mortality rate (in units of deaths per 100,000 people per year) in the model domain.
type NextData ¶ added in v1.4.1
type NextData func() (*sparse.DenseArray, error)
NextData is a type of function that returns data for the next time step. If there are no more time steps, it should return the io.EOF error.
type Outputter ¶ added in v1.4.1
type Outputter struct {
// contains filtered or unexported fields
}
Outputter is a holder for output parameters.
fileName contains the path where the output will be saved.
If allLayers is true, output will contain data for all of the vertical layers, otherwise only the ground-level layer is returned.
outputVariables maps the names of the variables for which data should be returned to expressions that define how the requested data should be calculated. These expressions can utilize variables built into the model, user-defined variables, and functions.
modelVariables is automatically generated based on the model variables that are required to calculate the requested output variables.
Functions are defined in the outputFunctions variable.
func NewOutputter ¶ added in v1.4.1
func NewOutputter(fileName string, allLayers bool, outputVariables map[string]string, outputFunctions map[string]govaluate.ExpressionFunction, m Mechanism) (*Outputter, error)
NewOutputter initializes a new Outputter holder and adds a set of default output functions. Default functions include:
'exp(x)' which applies the exponental function e^x.
'log(x)' which applies the natural logarithm function log(e).
'log10(x)' which applies the base-10 logarithm function log10(e).
'sum(x)' which sums a variable across all grid cells.
func (*Outputter) CheckOutputVars ¶ added in v1.4.1
func (o *Outputter) CheckOutputVars(m Mechanism) DomainManipulator
CheckOutputVars ensures that the requested output variables are all valid.
type PopConcMutator ¶ added in v1.2.0
type PopConcMutator struct {
// contains filtered or unexported fields
}
PopConcMutator is a holds an algorithm for dividing grid cells based on gradients in population density and concentration. Refer to the methods for additional documentation.
func NewPopConcMutator ¶ added in v1.2.0
func NewPopConcMutator(config *VarGridConfig, popIndices PopIndices) *PopConcMutator
NewPopConcMutator initializes a new PopConcMutator object.
func (*PopConcMutator) Mutate ¶ added in v1.2.0
func (p *PopConcMutator) Mutate() GridMutator
Mutate returns a function that takes a grid cell and returns whether Σ(|ΔConcentration|)*combinedVolume*|ΔPopulation| / {Σ(|totalMass|)*totalPopulation} > a threshold between the grid cell in question and any of its horizontal neighbors, where Σ(|totalMass|) is the sum of the absolute values of the mass of all pollutants in all grid cells in the system, Σ(|ΔConcentration|) is the sum of the absolute value of the difference between pollution concentations in the cell in question and the neighbor in question, |ΔPopulation| is the absolute value of the difference in population between the two grid cells, totalPopulation is the total population in the domain, and combinedVolume is the combined volume of the cell in question and the neighbor in question.
type PopIndices ¶ added in v1.2.0
PopIndices gives the array indices of each population type.
type Population ¶ added in v1.2.0
type Population struct {
// contains filtered or unexported fields
}
Population is a holder for information about the human population in the model domain.
type Preprocessor ¶ added in v1.4.1
type Preprocessor interface { // Nx is the number of grid cells in the West-East direction. Nx() (int, error) // Ny is the number of grid cells in the South-North direction. Ny() (int, error) // Nz is the number of grid cells in the below-above direction. Nz() (int, error) // PBLH is planetary boundary layer height [m]. PBLH() NextData // Height is vertical layer height above ground [m]. Height() NextData // ALT is inverse air density [m3/kg]. ALT() NextData // T temperature [K]. T() NextData // P is pressure [Pa]. P() NextData // UStar is friction velocity [m/s]. UStar() NextData // SeinfeldLandUse is land use categories as // specified in github.com/ctessum/atmos/seinfeld. SeinfeldLandUse() NextData // WeselyLandUse is land use categories as // specified in github.com/ctessum/atmos/wesely1989. WeselyLandUse() NextData // Z0 is surface roughness length [m]. Z0() NextData // QRain is the mass fraction of rain [mass/mass]. QRain() NextData // QCloud is the mass fraction of cloud water in each grid cell [mass/mass]. QCloud() NextData // CloudFrac is the fraction of each grid cell filled with clouds [volume/volume]. CloudFrac() NextData // SurfaceHeatFlux is heat flux at the surface [W/m2]. SurfaceHeatFlux() NextData // RadiationDown is total downwelling radiation [W m-2]. RadiationDown() NextData // U is West-East wind speed [m/s]. U() NextData // V is South-North wind speed [m/s]. V() NextData // W is below-above wind speed [m/s]. W() NextData // AVOC is total concentration of anthropogenic // secondary organic aerosol precursors (VOCs) [μg/m3]. AVOC() NextData // AVOC is total concentration of biogenic // secondary organic aerosol precursors (VOCs) [μg/m3]. BVOC() NextData // ASOA is total concentration of anthropogenic // secondary organic aerosol [μg/m3]. ASOA() NextData // BSOA is total concentration of biogenic // secondary organic aerosol [μg/m3]. BSOA() NextData // NOx is concentration of oxides of Nitrogen [μg/m3]. NOx() NextData // PNO is concentration of particulate nitrate [μg/m3]. PNO() NextData // SOx is concentration of Sulfur oxides [μg/m3]. SOx() NextData // PS is concentration of particulate sulfate [μg/m3]. PS() NextData // NH3 is concentration of ammonia [μg/m3]. NH3() NextData // PNH is concentration of particulate ammonium [μg/m3]. PNH() NextData // TotalPM25 is total concentration of fine particulate matter (PM2.5) [μg/m3]. TotalPM25() NextData // HO is hydroxyl radical concentration [ppmv]. HO() NextData // H2O2 is hydrogen peroxide concentration [ppmv]. H2O2() NextData }
Preprocessor specifies the methods that are necessary for a variable to act as a preprocessor for InMAP inputs.
type SimulationStatus ¶ added in v1.2.0
type SimulationStatus struct { // SimulationDays is the number of days in simulation time since the // start of the simulation. SimulationDays float64 // Iteration is the current iteration number. Iteration int // Walltime is the total wall time since the beginning of the simulation. Walltime time.Duration // StepWalltime is the wall time that elapsed during the most recent time step. StepWalltime time.Duration // Dt is the timestep in seconds. Dt float64 }
SimulationStatus holds information about the progress of a simulation.
func (SimulationStatus) String ¶ added in v1.2.0
func (s SimulationStatus) String() string
type VarGridConfig ¶ added in v1.2.0
type VarGridConfig struct { VariableGridXo float64 // lower left of output grid, x VariableGridYo float64 // lower left of output grid, y VariableGridDx float64 // m VariableGridDy float64 // m Xnests []int // Nesting multiples in the X direction Ynests []int // Nesting multiples in the Y direction HiResLayers int // number of layers to do in high resolution (layers above this will be lowest resolution. PopDensityThreshold float64 // limit for people per unit area in the grid cell PopThreshold float64 // limit for total number of people in the grid cell // PopConcThreshold is the limit for // Σ(|ΔConcentration|)*combinedVolume*|ΔPopulation| / {Σ(|totalMass|)*totalPopulation}. // See the documentation for PopConcMutator for more information. PopConcThreshold float64 CensusFile string // Path to census shapefile or COARDS-compliant NetCDF file CensusPopColumns []string // Shapefile fields containing populations for multiple demographics PopGridColumn string // Name of field in shapefile to be used for determining variable grid resolution MortalityRateFile string // Path to the mortality rate shapefile // MortalityRateColumns give the columns in the mortality rate // shapefile containing mortality rates, and the population groups that // should be used for population-weighting each mortality rate. MortalityRateColumns map[string]string GridProj string // projection info for CTM grid; Proj4 format }
VarGridConfig is a holder for the configuration information for creating a variable-resolution grid.
func (*VarGridConfig) LoadCTMData ¶ added in v1.2.0
func (config *VarGridConfig) LoadCTMData(rw cdf.ReaderWriterAt) (*CTMData, error)
LoadCTMData loads CTM data from a netcdf file.
func (*VarGridConfig) LoadPopMort ¶ added in v1.2.0
func (config *VarGridConfig) LoadPopMort() (*Population, PopIndices, *MortalityRates, MortIndices, error)
LoadPopMort loads the population and mortality rate data from the shapefiles specified in config.
func (*VarGridConfig) MutateGrid ¶ added in v1.2.0
func (config *VarGridConfig) MutateGrid(divideRule GridMutator, data *CTMData, pop *Population, mortRates *MortalityRates, emis *Emissions, m Mechanism, logChan chan string) DomainManipulator
MutateGrid returns a function that creates a static variable resolution grid (i.e., one that does not change during the simulation) by dividing cells as determined by divideRule. Cells where divideRule is true are divided to the next nest level (up to the maximum nest level), and cells where divideRule is false are combined (down to the baseline nest level). Log messages are written to logChan if it is not nil.
func (*VarGridConfig) RegularGrid ¶ added in v1.2.0
func (config *VarGridConfig) RegularGrid(data *CTMData, pop *Population, popIndex PopIndices, mortRates *MortalityRates, mortIndex MortIndices, emis *Emissions, m Mechanism) DomainManipulator
RegularGrid returns a function that creates a new regular (i.e., not variable resolution) grid as specified by the information in c.
type WRFChem ¶ added in v1.4.1
type WRFChem struct {
// contains filtered or unexported fields
}
WRFChem is an InMAP preprocessor for WRF-Chem output.
func NewWRFChem ¶ added in v1.4.1
NewWRFChem initializes a WRF-Chem preprocessor from the given configuration information. WRFOut is the location of WRF-Chem output files. [DATE] should be used as a wild card for the simulation date. startDate and endDate are the dates of the beginning and end of the simulation, respectively, in the format "YYYYMMDD". If msgChan is not nil, status messages will be sent to it.
func (*WRFChem) ALT ¶ added in v1.4.1
ALT helps fulfill the Preprocessor interface by returning inverse air density m3/kg.
func (*WRFChem) CloudFrac ¶ added in v1.4.1
CloudFrac helps fulfill the Preprocessor interface by returning the fraction of each grid cell filled with clouds volume/volume.
func (*WRFChem) GLW ¶ added in v1.4.1
GLW helps fulfill the Preprocessor interface by returning downwelling long wave radiation at ground level W/m2.
func (*WRFChem) H2O2 ¶ added in v1.4.1
H2O2 helps fulfill the Preprocessor interface by returning hydrogen peroxide concentration [ppmv].
func (*WRFChem) HO ¶ added in v1.4.1
HO helps fulfill the Preprocessor interface by returning hydroxyl radical concentration [ppmv].
func (*WRFChem) Height ¶ added in v1.4.1
Height helps fulfill the Preprocessor interface by returning layer heights above ground level calculated based on geopotential height. For more information, refer to http://www.openwfm.org/wiki/How_to_interpret_WRF_variables.
func (*WRFChem) Nx ¶ added in v1.4.1
Nx helps fulfill the Preprocessor interface by returning the number of grid cells in the West-East direction.
func (*WRFChem) Ny ¶ added in v1.4.1
Ny helps fulfill the Preprocessor interface by returning the number of grid cells in the South-North direction.
func (*WRFChem) Nz ¶ added in v1.4.1
Nz helps fulfill the Preprocessor interface by returning the number of grid cells in the below-above direction.
func (*WRFChem) P ¶ added in v1.4.1
P helps fulfill the Preprocessor interface by returning pressure [Pa].
func (*WRFChem) PBLH ¶ added in v1.4.1
PBLH helps fulfill the Preprocessor interface by returning planetary boundary layer height [m].
func (*WRFChem) QCloud ¶ added in v1.4.1
QCloud helps fulfill the Preprocessor interface by returning the mass fraction of cloud water in each grid cell mass/mass.
func (*WRFChem) QRain ¶ added in v1.4.1
QRain helps fulfill the Preprocessor interface by returning rain mass fraction.
func (*WRFChem) RadiationDown ¶ added in v1.4.1
RadiationDown helps fulfill the Preprocessor interface by returning total downwelling radiation at ground level W/m2.
func (*WRFChem) SWDown ¶ added in v1.4.1
SWDown helps fulfill the Preprocessor interface by returning downwelling short wave radiation at ground level W/m2.
func (*WRFChem) SeinfeldLandUse ¶ added in v1.4.1
SeinfeldLandUse helps fulfill the Preprocessor interface by returning land use categories as specified in github.com/ctessum/atmos/seinfeld.
func (*WRFChem) SurfaceHeatFlux ¶ added in v1.4.1
SurfaceHeatFlux helps fulfill the Preprocessor interface by returning heat flux at the surface W/m2.
func (*WRFChem) T ¶ added in v1.4.1
T helps fulfill the Preprocessor interface by returning temperature [K].
func (*WRFChem) U ¶ added in v1.4.1
U helps fulfill the Preprocessor interface by returning West-East wind speed m/s.
func (*WRFChem) UStar ¶ added in v1.4.1
UStar helps fulfill the Preprocessor interface by returning friction velocity m/s.
func (*WRFChem) V ¶ added in v1.4.1
V helps fulfill the Preprocessor interface by returning South-North wind speed m/s.
func (*WRFChem) W ¶ added in v1.4.1
W helps fulfill the Preprocessor interface by returning below-above wind speed m/s.
func (*WRFChem) WeselyLandUse ¶ added in v1.4.1
WeselyLandUse helps fulfill the Preprocessor interface by returning land use categories as specified in github.com/ctessum/atmos/wesely1989.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package cloud contains utilities for distributed InMAP simulations.
|
Package cloud contains utilities for distributed InMAP simulations. |
cloudrpc/cloudrpcgojs
Package cloudrpc is a generated protocol buffer package.
|
Package cloudrpc is a generated protocol buffer package. |
cmd
|
|
inmap
Command inmap is a command-line interface for the InMAP air pollution model.
|
Command inmap is a command-line interface for the InMAP air pollution model. |
inmapweb
command inmapweb is a web interface for the InMAP model and related tools.
|
command inmapweb is a web interface for the InMAP model and related tools. |
emissions
|
|
aep/aeputil
Package aeputil provides commonly used configuration and functions for the AEP library.
|
Package aeputil provides commonly used configuration and functions for the AEP library. |
slca/eieio
Package eieio implements an Extended InMAP Economic Input-Output (EIEIO) life cycle assessment model based on the US Bureau of Economic Analysis (BEA) Annual Input-Output Accounts Data from https://www.gov/industry/io_annual.htm.
|
Package eieio implements an Extended InMAP Economic Input-Output (EIEIO) life cycle assessment model based on the US Bureau of Economic Analysis (BEA) Annual Input-Output Accounts Data from https://www.gov/industry/io_annual.htm. |
slca/eieio/ces
Package ces translates Consumer Expenditure Survey (CES) demographic data to EIO categories.
|
Package ces translates Consumer Expenditure Survey (CES) demographic data to EIO categories. |
slca/eieio/eieiorpc/eieiorpcjs
Package eieiorpc is a generated protocol buffer package.
|
Package eieiorpc is a generated protocol buffer package. |
Package epi holds a collection of functions for calculating the health impacts of air pollution.
|
Package epi holds a collection of functions for calculating the health impacts of air pollution. |
Package inmaputil contains configuration and utility functions for commonly-used operations with the InMAP model.
|
Package inmaputil contains configuration and utility functions for commonly-used operations with the InMAP model. |
science
|
|
chem/simplechem
Package simplechem contains a simplified atmospheric chemistry mechanism.
|
Package simplechem contains a simplified atmospheric chemistry mechanism. |
drydep/simpledrydep
Package simpledrydep provides a atmospheric dry deposition algorithm for a small number of chemical species.
|
Package simpledrydep provides a atmospheric dry deposition algorithm for a small number of chemical species. |
wetdep/emepwetdep
Package emepwetdep provides a atmospheric wet deposition algorithm from the EMEP model.
|
Package emepwetdep provides a atmospheric wet deposition algorithm from the EMEP model. |
Package sr contains functions for creating a source-receptor (SR) matrix from the InMAP air pollution model and interacting with it.
|
Package sr contains functions for creating a source-receptor (SR) matrix from the InMAP air pollution model and interacting with it. |