inmaputil

package
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: May 17, 2018 License: GPL-3.0 Imports: 27 Imported by: 0

Documentation

Overview

Package inmaputil contains configuration and utility functions for commonly-used operations with the InMAP model.

Index

Constants

This section is empty.

Variables

Cfg holds configuration information.

View Source
var DefaultScienceFuncs = []inmap.CellManipulator{
	inmap.UpwindAdvection(),
	inmap.Mixing(),
	inmap.MeanderMixing(),
	scienceMust(m.DryDep("simple")),
	scienceMust(m.WetDep("emep")),
	m.Chemistry(),
}

DefaultScienceFuncs are the science functions that are run in typical simulations.

View Source
var Root = &cobra.Command{
	Use:   "inmap",
	Short: "A reduced-form air quality model.",
	Long: `InMAP is a reduced-form air quality model for fine particulate matter (PM2.5).
Use the subcommands specified below to access the model functionality.
Additional information is available at http://inmap.spatialmodel.com.

Refer to the subcommand documentation for configuration options and default settings.
Configuration can be changed by using a configuration file (and providing the
path to the file using the --config flag), by using command-line arguments,
or by setting environment variables in the format 'INMAP_var' where 'var' is the
name of the variable to be set. Many configuration variables are additionally
allowed to contain environment variables within them.
Refer to https://github.com/spf13/viper for additional configuration information.`,
	DisableAutoGenTag: true,
	PersistentPreRunE: func(*cobra.Command, []string) error { return setConfig() },
}

Root is the main command.

Functions

func GetStringMapString

func GetStringMapString(varName string, cfg *viper.Viper) map[string]string

GetStringMapString returns a map[string]string from a viper configuration, accounting for the fact that it might be a json object if it was set from a command line argument.

func Grid

func Grid(InMAPData, VariableGridData string, VarGrid *inmap.VarGridConfig) error

Grid creates and saves a new variable resolution grid.

InMAPData is the path to location of baseline meteorology and pollutant data. The path can include environment variables.

VariableGridData is the path to the location where the variable-resolution gridded InMAP data should be created.

VarGrid provides information for specifying the variable resolution grid.

func NewWorker added in v1.4.1

func NewWorker(VariableGridData, InMAPData string, VarGrid *inmap.VarGridConfig) (*sr.Worker, error)

NewWorker starts a new worker.

VariableGridData is the path to the location of the variable-resolution gridded InMAP data, or the location where it should be created if it doesn't already exist.

InMAPData is the path to location of baseline meteorology and pollutant data.

VarGrid provides information for specifying the variable resolution grid.

func Preproc

func Preproc(StartDate, EndDate, CTMType, WRFOut, GEOSA1, GEOSA3Cld, GEOSA3Dyn, GEOSI3, GEOSA3MstE, GEOSApBp,
	GEOSChem, VegTypeGlobal, InMAPData string, CtmGridXo, CtmGridYo, CtmGridDx, CtmGridDy float64, dash bool) error

Preproc preprocesses chemical transport model output as specified by information in cfg and saves the result for use in future InMAP simulations.

StartDate is the date of the beginning of the simulation. Format = "YYYYMMDD".

EndDate is the date of the end of the simulation. Format = "YYYYMMDD".

CTMType specifies what type of chemical transport model we are going to be reading data from. Valid options are "GEOS-Chem" and "WRF-Chem".

WRFOut is the location of WRF-Chem output files. [DATE] should be used as a wild card for the simulation date.

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.

GEOSA3Dyn 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 files.

GEOSChem is the location of GEOS-Chem output files. [DATE] should be used as a wild card for the simulation date.

VegTypeGlobal is the location of the GEOS-Chem vegtype.global file, which is described here: http://wiki.seas.harvard.edu/geos-chem/index.php/Olson_land_map#Structure_of_the_vegtype.global_file

InMAPData is the path where the preprocessed baseline meteorology and pollutant data should be written.

CtmGridXo is the lower left of Chemical Transport Model (CTM) grid [x].

CtmGridYo is the lower left of grid [y]

CtmGridDx is the grid cell size in the x direction [m].

CtmGridDy is the grid cell size in the y direction [m].

dash indicates whether GEOS-Chem variable names are in the form 'IJ-AVG-S__xxx' as opposed to 'IJ_AVG_S_xxx'.

func Run

func Run(CobraCommand *cobra.Command, LogFile string, OutputFile string, OutputAllLayers bool, OutputVariables map[string]string,
	EmissionUnits string, EmissionsShapefiles []string, VarGrid *inmap.VarGridConfig, InMAPData, VariableGridData string,
	NumIterations int,
	dynamic, createGrid bool, scienceFuncs []inmap.CellManipulator, addInit, addRun, addCleanup []inmap.DomainManipulator,
	m inmap.Mechanism) error

Run runs the model. dynamic and createGrid specify whether the variable resolution grid should be created dynamically and whether the static grid should be created or read from a file, respectively.

CobraCommand is the cobra.Command instance where Run is called from. It is needed to print certain outputs to the web interface.

LogFile is the path to the desired logfile location. It can include environment variables. If LogFile is left blank, the logfile will be saved in the same location as the OutputFile.

OutputFile is the path to the desired output shapefile location. It can include environment variables.

If OutputAllLayers is true, output data for all model layers. If false, only output the lowest layer.

OutputVariables specifies which model variables should be included in the output file.

EmissionUnits gives the units that the input emissions are in. Acceptable values are 'tons/year', 'kg/year', 'ug/s', and 'μg/s'.

EmissionsShapefiles are the paths to any emissions shapefiles. Can be elevated or ground level; elevated files need to have 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, but the mapping projection of the shapefile must be the same as the projection InMAP uses.

VarGrid provides information for specifying the variable resolution grid.

InMAPData is the path to location of baseline meteorology and pollutant data.

VariableGridData is the path to the location of the variable-resolution gridded InMAP data, or the location where it should be created if it doesn't already exist.

NumIterations is the number of iterations to calculate. If < 1, convergence is automatically calculated.

If dynamic is true, createGrid is ignored. scienceFuncs specifies the science functions to perform in each cell at each time step. addInit, addRun, and addCleanup specifies functions beyond the default functions to run at initialization, runtime, and cleanup, respectively.

notMeters should be set to true if the units of the grid are not meters (e.g., if the grid is in degrees latitude/longitude.)

func RunSR added in v1.4.1

func RunSR(VariableGridData, InMAPData, LogDir, OutputFile string, VarGrid *inmap.VarGridConfig, configFile string, begin, end int, layers []int) error

RunSR runs the SR matrix creator.

VariableGridData is the path to the location of the variable-resolution gridded InMAP data, or the location where it should be created if it doesn't already exist.

InMAPData is the path to location of baseline meteorology and pollutant data.

LogDir is the directory that log files should be stored in when creating a source-receptor matrix.

OutputFile is the path where the output file is or should be created when creating a source-receptor matrix.

VarGrid provides information for specifying the variable resolution grid.

configFile give the path to the configuration file.

begin and end specify the beginning and end grid indices to process.

layers specifies which vertical layers to process.

func SRPredict

func SRPredict(EmissionUnits, SROutputFile, OutputFile string, EmissionsShapefiles []string, VarGrid *inmap.VarGridConfig) error

SRPredict uses the SR matrix specified in SROutputFile to predict concentrations resulting from the emissions in EmissionsShapefiles, outputting the results in OutputFile. EmissionUnits specifies the units of the emissions. VarGrid specifies the variable resolution grid.

func StartWebServer added in v1.4.1

func StartWebServer()

StartWebServer starts the web server.

func VarGridConfig

func VarGridConfig(cfg *viper.Viper) (*inmap.VarGridConfig, error)

VarGridConfig unmarshals a viper configuration for a variable grid.

Types

This section is empty.

Jump to

Keyboard shortcuts

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