package module
v1.2.0 Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Aug 22, 2016 License: GPL-3.0 Imports: 36 Imported by: 2


(In)tervention (M)odel for (A)ir (P)ollution

Build Status Coverage Status GoDoc Go Report Card

About InMAP

InMAP is a multi-scale emissions-to-health impact model for fine particulate matter (PM2.5) that mechanistically evaluates air quality and health benefits of perturbations to baseline emissions. A main simplification of InMAP compared to a comprehensive chemical transport model is that it does so on an annual-average basis rather than the highly time-resolved performance of a full CTM. The model incorporates annual-average parameters (e.g. transport, deposition, and reaction rates) from the WRF/Chem chemical transport model. Grid-cell size varies as shown in Figure 1, ranging from smaller grid cells in urban areas to larger grid cells in rural areas. This variable resolution grid is used to simulate population exposures to PM2.5 with high spatial resolution while minimizing computational expense.

alt tag Figure 1: InMAP spatial discretization of the model domain into variable resolution grid cells. Left panel: full domain; right panel: a small section of the domain centered on the city of Los Angeles.

Getting InMAP

Go to releases to download the most recent release for your type of computer. For Mac systems, download the file with "darwin" in the name. You will need both the executable program and the input data (""). All of the versions of the program are labeled "amd64" to denote that they are for 64-bit processors (i.e., all relatively recent notebook and desktop computers). It doesn't matter whether your computer processor is made by AMD or another brand, it should work either way.

Compiling from source

You can also compile InMAP from its source code. It should work on most types of computers. Refer here for a list of theoretically supported systems. Instructions follow:

  1. Install the Go compiler. Make sure you install the correct version (64 bit) for your system. Also make sure to set the $GOPATH environment variable to a different directory than where the Go compiler is installed. It may be useful to go through one of the tutorials to make sure the compiler is correctly installed.

  2. Make sure your $PATH environment variable includes the directories $GOROOT/bin and $GOPATH/bin. On Linux or Macintosh systems, this can be done using the command export PATH=$PATH:$GOROOT/bin:$GOPATH/bin. On Windows systems, you can follow these directions.

  3. Install the git and mercurial version control programs, if they are not already installed. If you are using a shared system or cluster, you may just need to load them with the commands module load git and module load hg.

  4. Download and install the main program:

     go get

    The Go language has an automatic system for finding and installing library dependencies; you may want to refer here to understand how it works.

  5. Optional: run the tests and evaluations (this may take a while):

     cd $GOPATH/src/
     go test ./...

    To only run the tests and not the evaluations, run go test ./... -short.

Running InMAP

  1. Make sure that you have downloaded the InMAP input data files: from the InMAP release page, where X.X.X corresponds to a version number.

  2. Create an emissions scenario or use one of the evaluation emissions datasets available in the files on the InMAP release page. Emissions files should be in shapefile format where the attribute columns correspond to the names of emitted pollutants. Refer here (the EmisNames variable) for acceptable pollutant names. Emissions units can be specified in the configuration file (discussed below) and can be either short tons or kilograms per year. The model can handle multiple input emissions files, and emissions can be either elevated or ground level. Files with elevated emissions need to have attribute columns labeled "height", "diam", "temp", and "velocity" containing stack information in units of m, m, K, and m/s, respectively. Emissions will be allocated from the geometries in the shape file to the InMAP computational grid.

  3. Make a copy of the configuration file template and edit it so that the VariableGridData variable points to the location where you downloaded the general corresponding input data file to, EmissionsShapefiles points to the location(s) of the emissions files, and the OutputFile variable points to the desired location for the output file. Refer to the source code documentation (here) for information about other configuration options. The configuration file is a text file in TOML format, and any changes made to the file will need to conform to that format or the model will not run correctly and will produce an error.

  4. Run the program:

     inmapXXX run steady --config=/path/to/configfile.toml

    where inmapXXX is replaced with the executable file that you downloaded. For some systems you may need to type ./inmapXXX instead. If you compiled the program from source, the command will just be inmap for Linux or Mac systems and inmap.exe for Windows systems.

    The above command runs the model in the most typical mode. For alternative run modes and other command options refer here.

  5. View the program output. The output files are in shapefile format which can be viewed in most GIS programs. One free GIS program is QGIS. By default, the InMAP only outputs results from layer zero, but this can be changed using the configuration file. Output variables are specified as OutputVariables in the configuration file. There is a complete list of options here. Some examples include:

    • Pollutant concentrations in units of μg m-3:
      • VOC (VOC)
      • NOx (NOx)
      • NH3 (NH3)
      • SOx (SOx)
      • Total PM2.5 (Total PM2.5; The sum of all PM2.5 components)
      • Primary PM2.5 (Primary PM2.5)
      • Particulate sulfate (pSO4)
      • Particulate nitrate (pNO3)
      • Particulate ammonium (pNH4)
      • Secondary organic aerosol (SOA)
    • Populations of different demographic subgroups in units of people per square meter. The included populations may vary but in the default dataset as of this writing the groups included are:
      • total population (TotalPop)
      • people identifying as black (Black), asian (Asian), latino (Latino), native american or american indian (Native), non-latino white (WhiteNoLat) and everyone else (Other).
      • People living below the poverty time (Poverty) and people living at more than twice the poverty line (TwoXPov).
    • Numbers of deaths attributable to PM2.5 in each of the populations in units of deaths/year, which are specified as POPULATION deaths in the configuratio file, where POPULATION is one of the populations specified above. Attribute names in shapfiles are limited to 11 characters, so, for example, deaths in the TotalPop population would be labeled TotalPop de, deaths in the Black population would be labeled Black death, and—interestingly—deaths in the WhiteNoLat population would be labeled WhiteNoLat_1.
    • Baseline mortality rate in units of deaths per year per 100,000 people (AllCause), which can be used for performing alternative health impact calculations.


The InMAP package is split into an executable program and an application programming interface (API). The documentation here shows the functions available in the API and how they work.



Package inmap is an air quality model for predicting health impacts of air pollutant emissions.



View Source
const (
	// Version gives the version number.
	Version = "1.2.0"

	// VarGridDataVersion gives the version of the variable grid data reuquired by
	// this version of the software.
	VarGridDataVersion = "1.2.0"

	// InMAPDataVersion is the version of the InMAP data required by this version
	// of the software.
	InMAPDataVersion = "1.2.0"
View Source
const (
	NOxToN = mwN / mwNOx
	NtoNO3 = mwNO3 / mwN
	SOxToS = mwSO2 / mwS
	StoSO4 = mwS / mwSO4
	NH3ToN = mwN / mwNH3
	NtoNH4 = mwNH4 / mwN

Chemical mass conversions [ratios]


View Source
var EmisNames = []string{"VOC", "NOx", "NH3", "SOx", "PM2_5"}

EmisNames are the names of pollutants accepted as emissions [μg/s]

View Source
var PolLabels = map[string]polConv{
	"Total PM2.5": {[]int{iPM2_5, ipOrg, ipNH, ipS, ipNO},
		[]float64{1, 1, NtoNH4, StoSO4, NtoNO3}},
	"VOC":           {[]int{igOrg}, []float64{1.}},
	"SOA":           {[]int{ipOrg}, []float64{1.}},
	"Primary PM2.5": {[]int{iPM2_5}, []float64{1.}},
	"NH3":           {[]int{igNH}, []float64{1. / NH3ToN}},
	"pNH4":          {[]int{ipNH}, []float64{NtoNH4}},
	"SOx":           {[]int{igS}, []float64{1. / SOxToS}},
	"pSO4":          {[]int{ipS}, []float64{StoSO4}},
	"NOx":           {[]int{igNO}, []float64{1. / NOxToN}},
	"pNO3":          {[]int{ipNO}, []float64{NtoNO3}},

PolLabels are labels and conversions for InMAP pollutants.

View Source
var PolNames = []string{"gOrg", "pOrg",
	"gNH", "pNH",
	"gS", "pS",
	"gNO", "pNO",

PolNames are the names of pollutants within the model


func Regrid added in v1.2.0

func Regrid(oldGeom, newGeom []geom.Polygonal, oldData []float64) (newData []float64, err error)

Regrid regrids concentration data from one spatial grid to a different one.


type CTMData added in v1.2.0

type CTMData struct {
	// contains filtered or unexported fields

CTMData holds processed data from a chemical transport model

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.

func (*CTMData) Write added in v1.2.0

func (d *CTMData) Write(w *os.File, x0, y0, dx, dy float64) error

Write writes d to w. 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.

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]
	MortalityRate float64   `desc:"Baseline mortality rate" units:"Deaths per 100,000 people per year"`

	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 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) String added in v1.2.0

func (c *Cell) String() string

type CellManipulator added in v1.2.0

type CellManipulator func(c *Cell, Dt float64)

CellManipulator is a class of functions that operate on a single grid cell, using the given timestep Dt.

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 Chemistry added in v1.2.0

func Chemistry() CellManipulator

Chemistry returns a function that calculates the secondary formation of PM2.5. It explicitly calculates formation of particulate sulfate from gaseous and aqueous SO2. It partitions organic matter ("gOrg" and "pOrg"), the nitrogen in nitrate ("gNO and pNO"), and the nitrogen in ammonia ("gNH" and "pNH) between gaseous and particulate phase based on the spatially explicit partioning present in the baseline data.

func DryDeposition added in v1.2.0

func DryDeposition() CellManipulator

DryDeposition returns a function that calculates particle removal by dry deposition.

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.

func WetDeposition added in v1.2.0

func WetDeposition() CellManipulator

WetDeposition returns a function that calculates particle removal by wet deposition.

type ConvergenceStatus added in v1.2.0

type ConvergenceStatus []float64

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

type DomainManipulator func(d *InMAP) error

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 HTMLUI added in v1.2.0

func HTMLUI(address string) DomainManipulator

HTMLUI returns a function that serves an HTML user interface at address. If address is "", then the server won't run.

func Load added in v1.2.0

func Load(r io.Reader, config *VarGridConfig, emis *Emissions) 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

Log sends simulation status messages to c.

func Output added in v1.2.0

func Output(fileName string, allLayers bool, outputVariables ...string) DomainManipulator

Output returns a function that writes simulation results to a shapefile or shapefiles. If allLayers` is true, the function writes out data for all of the vertical layers, otherwise only the ground-level layer is written. outputVariables is a list of the names of the variables to be output.

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

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 ( for diffusion, whichever one yields a smaller time step.

func SteadyStateConvergenceCheck added in v1.2.0

func SteadyStateConvergenceCheck(numIterations int, popGridColumn string, 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 {
	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.

type Emissions added in v1.2.0

type Emissions struct {
	// 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, 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 and kg/year. Output units = μg/s. c is a channel over which status updates will be sent. If c is nil, no updates will be sent.

func (*Emissions) Add added in v1.2.0

func (e *Emissions) Add(er *EmisRecord)

Add adds an emissions record to e.

type GridMutator added in v1.2.0

type GridMutator func(cell *Cell, totalMass, totalPopulation float64) bool

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
	// contains filtered or unexported fields

InMAP holds the current state of the model.

func (*InMAP) CellIntersections added in v1.2.0

func (d *InMAP) CellIntersections(g geom.Geom) (cells []*Cell, fractions []float64)

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) Cells added in v1.2.0

func (d *InMAP) Cells() []*Cell

Cells returns the InMAP grid cells as an array.

func (*InMAP) Cleanup added in v1.2.0

func (d *InMAP) Cleanup() error

Cleanup finishes the simulation by running d.CleanupFuncs.

func (*InMAP) GetGeometry added in v1.2.0

func (d *InMAP) GetGeometry(layer int, webMap bool) []geom.Polygonal

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) Init added in v1.2.0

func (d *InMAP) Init() error

Init initializes the simulation by running d.InitFuncs.

func (*InMAP) InsertCell added in v1.2.0

func (d *InMAP) InsertCell(c *Cell)

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) IntakeFraction added in v1.2.0

func (d *InMAP) IntakeFraction(
	breathingRate float64) map[string]map[string]float64

IntakeFraction calculates intake fraction from InMAP results. The input value is average breathing rate [m³/day]. The returned value is a map structure of intake fractions by pollutant and population type (map[pollutant][population]iF). This function will only give the correct results if run after InMAP finishes calculating.

func (*InMAP) LegendHandler added in v1.2.0

func (d *InMAP) LegendHandler(w http.ResponseWriter, r *http.Request)

LegendHandler creates a legend and serves it.

func (*InMAP) OutputOptions added in v1.2.0

func (d *InMAP) OutputOptions() (names []string, descriptions []string, units []string)

OutputOptions returns the options for output variable names and their descriptions.

func (*InMAP) Results added in v1.2.0

func (d *InMAP) Results(allLayers bool, outputVariables ...string) (map[string][]float64, error)

Results returns the simulation results. Output is in the form of map[variable][row]concentration. If allLayers` is true, the function returns data for all of the vertical layers, otherwise only the ground-level layer is returned. outputVariables is a list of the names of the variables for which data should be returned.

func (*InMAP) Run added in v1.2.0

func (d *InMAP) Run() error

Run carries out the simulation by running d.RunFuncs until d.Done is true.

func (*InMAP) VerticalProfile added in v1.2.0

func (d *InMAP) VerticalProfile(variable string, p geom.Point) (height, vals []float64, err error)

VerticalProfile retrieves the vertical profile for a given variable at the given location p in the native grid projection.

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 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) AdjustThreshold added in v1.2.0

func (p *PopConcMutator) AdjustThreshold(finalThreshold float64, msgChan chan string) DomainManipulator

AdjustThreshold allows the model converge without out adding any grid cells, and then decreases the cell creation threshold to finalThreshold so grid cells will be added and waits for the model to converge again. This is useful because the model will converge faster with larger grid cells, so using this function will tend to decrease overall model run time as compared to initially setting the threshold to the desired value.

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

type PopIndices map[string]int

PopIndices give 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 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
	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
	MortalityRateColumn string   // Name of field in mortality rate shapefile containing the mortality rate.

	GridProj string // projection info for CTM grid; Proj4 format
	// contains filtered or unexported fields

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, 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, mort *MortalityRates, emis *Emissions, 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, mort *MortalityRates, emis *Emissions) DomainManipulator

RegularGrid returns a function that creates a new regular (i.e., not variable resolution) grid as specified by the information in c.


Path Synopsis
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.
Package cmd contains commands and subcommands for the InMAP command-line interface.
Package cmd contains commands and subcommands for the InMAP command-line interface.
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.
Package wrf2inmap processes WRFChem output files into InMAP input files.
Package wrf2inmap processes WRFChem output files into InMAP input files.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL