speciate

package
v0.0.0-...-772e789 Latest Latest
Warning

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

Go to latest
Published: May 6, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package speciate contains functions for disaggregating and re-grouping chemical species.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

type DB struct {
	// contains filtered or unexported fields
}

DB holds information extracted from the SPECIATE database. (https://www.epa.gov/air-emissions-modeling/tools-related-air-emissions-modeling)

func ReadDB

func ReadDB(speciesProperties, gasProfile, gasSpecies, otherGasSpecies, pmSpecies io.Reader) (*DB, error)

ReadDB returns a new DB variable filled with information from the SPECIATE database, where the arguments are readers of the similarly named tables in the database, exported to CSV format. The SPECIATE database is available at: https://www.epa.gov/air-emissions-modeling/speciate-version-45-through-32. To export the tables in CSV format in Linux, use the mdb-export command:

mdb-export SPECIATE.mdb SPECIES_PROPERTIES > SPECIES_PROPERTIES.csv
mdb-export SPECIATE.mdb GAS_PROFILE > GAS_PROFILE.csv
mdb-export SPECIATE.mdb GAS_SPECIES > GAS_SPECIES.csv
mdb-export SPECIATE.mdb OTHER\ GASES_SPECIES > OTHER_GASES_SPECIES.csv
mdb-export SPECIATE.mdb PM_SPECIES > PM_SPECIES.csv

func (*DB) MolarMassFromID

func (s *DB) MolarMassFromID(id string) (float64, error)

MolarMassFromID takes the SPECIATE ID of a compound and returns its molar mass in g/mol.

func (*DB) MolarMassFromName

func (s *DB) MolarMassFromName(name string) (float64, error)

MolarMassFromName takes the name of a compound and returns its molar mass in g/mol.

type InvTable

type InvTable struct {
	// contains filtered or unexported fields
}

InvTable holds the data found in a SMOKE Inventory Table: https://www.cmascenter.org/smoke/documentation/4.7/html/ch08s10s04.html. It is used to determine which pollutants should be kept for processing and how they should be chemically speciated.

func ReadInvTable

func ReadInvTable(r io.Reader) (*InvTable, error)

ReadInvTable reads SMOKE-formatted inventory table data.

func (*InvTable) AddRecord

func (t *InvTable) AddRecord(inventoryName string, r InvTableRecord)

AddRecord adds a record to the receiver, where name is the name of the pollutant in the inventory and r is the record information.

type InvTableRecord

type InvTableRecord struct {
	// Unique name for pollutant or activity that will be stored and processed by SMOKE.
	Name string

	// This three-letter code represents the emissions mode that SMOKE uses to augment
	// the pollutant names. Emissions mode usually refers to the on-road or nonroad
	// mobile exhaust or evaporative emissions.
	Mode string

	// The SPECIATE4 ID is the unique species identifier in SPECIATE4.
	SpeciateID string

	// Should we keep this record for processing (Y or N)?
	Keep string

	// The adjustment factor to use in splitting the emissions associated
	// with a CAS number into different inventory data names, or reducing the
	// mass of a metal compound associated with a CAS number to account for the
	// metal mass only.
	Factor float64

	// VOC or TOG component: A “V” should be entered if the CAS number is part
	// of VOC emissions or TOG emissions. A “T” should be entered if the CAS
	// number is part of TOG emissions only. An “N” should be entered if the
	// CAS number is part of neither VOC or TOG. Any other value other than
	// “V” or “T” will be treated as an “N”.
	VTN string

	// A “Y” should be entered if the pollutant is also a VOC model species for
	// the AQM being targeted for the run. Any other values will be treated as an “N”.
	ModelSpecies string

	// A “Y” should be entered if (1) the pollutant is a VOC species
	// (the model-species column must be “Y” as well), and (2) that model-species
	// is explicitly treated in the AQM’s chemical mechanism. The pollutant can be
	// an explicit species in the chemical mechanism only when the GSPRO file
	// definitions of the lumped VOC species have been adjusted to account for
	// the pollutants/species that are explicit in the mechanism.
	Explicit string

	//  A “Y” should be entered if the inventory data name is a type of activity
	// instead of emissions. Any other values will be treated as an “N”.
	Activity string
}

InvTableRecord holds the information in SMOKE inventory table record: https://www.cmascenter.org/smoke/documentation/4.7/html/ch08s10s04.html.

type Mechanisms

type Mechanisms struct {
	// contains filtered or unexported fields
}

Mechanisms holds information on chemical speciation mechanisms as specified at http://www.cert.ucr.edu/~carter/emitdb/.

func ReadMechanisms

func ReadMechanisms(mechAssignment, molarWeight, speciesInfo io.Reader) (*Mechanisms, error)

ReadMechanisms returns a new Mechanisms variable initialized with information from mechanism assignment, molecular weight, and species information files in the format specified at http://www.cert.ucr.edu/~carter/emitdb/. (The files on the website must first be converted from Microsoft Excel to CSV format before being read by this function.)

func (*Mechanisms) Scanner

func (m *Mechanisms) Scanner(records smoke.Scanner, mechanism string, mass bool) smoke.Scanner

Scanner returns a smoke.Scanner that receives speciated records from the parent Scanner and groups them according to the specified chemical mechanism. If mass is true, the grouping will conserve the mass of the input species. Otherwise, molar speciation is assumed. The species to chemical mechanism conversion database (http://www.cert.ucr.edu/~carter/emitdb/) is designed to (attempt to) conserve reactivity rather than moles or mass, so for molar speciation the total number of moles may not be conserved.

type SpecRef

type SpecRef struct {
	// contains filtered or unexported fields
}

SpecRef holds speciation reference information extracted from SMOKE model gsref files.

func ReadSpecRef

func ReadSpecRef(ref, refCombo io.Reader) (*SpecRef, error)

ReadSpecRef returns a new SpecRef variable created from the information in the given readers.

type Speciator

type Speciator struct {
	smoke.Scanner

	// If MassBasis is set to true, all emissions will be kept in their original
	// mass units. Otherwise some pollutants will be converted to mole-basis
	// as appropriate.
	MassBasis bool
	// contains filtered or unexported fields
}

Speciator speciates emissions in Records from more aggregated chemical groups to more specific chemicals.

func NewSpeciator

func NewSpeciator(records smoke.Scanner, invTable *InvTable, specRef *SpecRef, db *DB) (*Speciator, error)

NewSpeciator returns a new Speciator for the given record scanner, using the provided information to disaggregate the lumped emissions species in the given Records into more detailed species.

Jump to

Keyboard shortcuts

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