cmd

package
v1.2.0 Latest Latest
Warning

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

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

Documentation

Overview

Package cmd contains commands and subcommands for the InMAP command-line interface.

Index

Constants

This section is empty.

Variables

View Source
var RootCmd = &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.`,
	PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
		return labelErr(Startup(configFile))
	},
	PersistentPostRun: func(cmd *cobra.Command, args []string) {
		completedMessage()
	},
}

RootCmd is the main command.

Functions

func Grid

func Grid() error

Grid creates and saves a new variable resolution grid.

func InitWorker

func InitWorker() (*sr.Worker, error)

InitWorker starts a new worker.

func Run

func Run(dynamic, createGrid bool) error

Run runs the model.

func RunSR

func RunSR(begin, end int, layers []int) error

RunSR runs the SR matrix creator.

func Startup

func Startup(configFile string) error

Startup reads the configuration file and prints a welcome message.

Types

type ConfigData

type ConfigData struct {

	// VarGrid provides information for specifying the variable resolution
	// grid.
	VarGrid inmap.VarGridConfig

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

	// 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. The path can include environment variables.
	VariableGridData string

	// 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.
	// Can include environment variables.
	EmissionsShapefiles []string

	// EmissionUnits gives the units that the input emissions are in.
	// Acceptable values are 'tons/year' and 'kg/year'.
	EmissionUnits string

	// Path to desired output shapefile location. Can include environment variables.
	OutputFile string

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

	// OutputVariables specifies which model variables should be included in the
	// output file.
	// Can include environment variables.
	OutputVariables []string

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

	// Port for hosting web page. If HTTPport is `8080`, then the GUI
	// would be viewed by visiting `localhost:8080` in a web browser.
	// If HTTPport is "", then the web server doesn't run.
	HTTPAddress string

	// SRLogDir is the directory that log files should be stored in when creating
	// a source-receptor matrix. It can contain environment variables.
	SRLogDir string

	// SROutputFile is the path where the output file is or should be created
	// when creating a source-receptor matrix. It can contain environment variables.
	SROutputFile string
	// contains filtered or unexported fields
}

ConfigData holds information about an InMAP configuration.

var (

	// Config holds the global configuration data.
	Config *ConfigData
)

func ReadConfigFile

func ReadConfigFile(filename string) (config *ConfigData, err error)

ReadConfigFile reads and parses a TOML configuration file.

Jump to

Keyboard shortcuts

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