aeputil

package
v0.0.0-...-95b8d58 Latest Latest
Warning

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

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

Documentation

Overview

Package aeputil provides commonly used configuration and functions for the AEP library.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Scale

func Scale(emis map[string][]aep.Record, f ScaleFunc) error

Scale applies scaling factors to the given emissions records.

Types

type InventoryConfig

type InventoryConfig struct {
	// NEIFiles lists National Emissions Inventory emissions files to use
	// for making SCC-based spatial surrogates. The file names can include
	// environment variables. The format is map[sector name][list of files].
	NEIFiles map[string][]string

	// PolsToKeep lists pollutants from the NEI that should be kept.
	PolsToKeep aep.Speciation

	// InputUnits specifies the units of input data. Acceptable
	// values are `tons', `tonnes', `kg', `g', and `lbs'.
	InputUnits string

	// FilterFunc specifies which records should be kept.
	// If it is nil, all records are kept.
	FilterFunc aep.RecFilter
}

InventoryConfig holds emissions inventory configuration information.

func (*InventoryConfig) ReadEmissions

func (c *InventoryConfig) ReadEmissions() (map[string][]aep.Record, *aep.InventoryReport, error)

ReadEmissions returns emissions records for the files specified in the NEIFiles field in the receiver. The returned records are split up by sector.

type ScaleFunc

type ScaleFunc func(aep.Record, aep.Pollutant) (float64, error)

ScaleFunc returns an emissions scaling factor for the given pollutant in the given record.

func ScaleNEIStateTrends

func ScaleNEIStateTrends(summaryFile string, sccDescriptions io.Reader, baseYear, scaleYear int) (ScaleFunc, error)

ScaleNEIStateTrends provides an emissions scaling function to scale NEI emissions from baseYear to the specified scaleYear using EPA emissions summaries by year, state, SCC code, and pollutant available from https://www.epa.gov/sites/production/files/2016-12/state_tier1_90-16.xls. The "xls" file must be converted to an "xlsx" file before opening.

type SpatialConfig

type SpatialConfig struct {
	// SrgSpec gives the location of the surrogate specification file.
	SrgSpec string

	// SrgShapefileDirectory gives the location of the directory holding
	// the shapefiles used for creating spatial surrogates.
	SrgShapefileDirectory string

	// SCCExactMatch specifies whether SCC codes must match exactly when processing
	// emissions.
	SCCExactMatch bool

	// GridRef specifies the locations of the spatial surrogate gridding
	// reference files used for processing the NEI.
	GridRef []string

	// OutputSR specifies the output spatial reference in Proj4 format.
	OutputSR string

	// InputSR specifies the input spatial reference in Proj4 format.
	InputSR string

	// SimplifyTolerance is the tolerance for simplifying spatial surrogate
	// geometry, in units of OutputSR.
	SimplifyTolerance float64

	// SpatialCache specifies the location for storing spatial emissions
	// data for quick access. If this is left empty, no cache will be used.
	SpatialCache string

	// MaxCacheEntries specifies the maximum number of emissions and concentrations
	// surrogates to hold in a memory cache. Larger numbers can result in faster
	// processing but increased memory usage.
	MaxCacheEntries int

	// GridCells specifies the geometry of the spatial grid.
	GridDefinitions []*aep.GridDef

	// GridName specifies a name for the grid which is used in the names
	// of intermediate and output files.
	GridName string
	// contains filtered or unexported fields
}

SpatialConfig holds emissions spatialization configuration information.

func (*SpatialConfig) SpatialProcessor

func (c *SpatialConfig) SpatialProcessor() (*aep.SpatialProcessor, error)

SpatialProcessor returns the spatial processor associated with the receiver.

func (*SpatialConfig) SpatializeTotal

func (c *SpatialConfig) SpatializeTotal(recs ...aep.Record) (map[aep.Pollutant][]*sparse.SparseArray, map[aep.Pollutant]unit.Dimensions, error)

SpatializeTotal returns spatial arrays of the total emissions in recs. for each pollutant and each of the spatial grids. The returned values are the emissions and their units.

Jump to

Keyboard shortcuts

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