smoke

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: 10 Imported by: 0

Documentation

Overview

Package smoke processes emissions inventory file in the SMOKE model format.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Conversion

type Conversion func(float64) float64

Conversion applies a convert to the given value

var (
	// TonToKilogram converts short tons to kilograms.
	TonToKilogram Conversion = func(tons float64) float64 { return tons * 907.185 }

	// TonneToKilogram converts metric tons to kilograms.
	TonneToKilogram Conversion = func(tons float64) float64 { return tons * 1000 }
)

type Country

type Country int

Country represents a country where emissions occur.

const (
	USA               Country = 0
	Canada            Country = 1
	Mexico            Country = 2
	Cuba              Country = 3
	Bahamas           Country = 4
	Haiti             Country = 5
	DominicanRepublic Country = 6
	Global            Country = 7
	Unknown           Country = -1
)

These are the currently supported countries.

func CountryFromID

func CountryFromID(code string) Country

CountryFromID returns the country associated with this ID code.

func (Country) ID

func (c Country) ID() string

ID returns the ID number of this country.

func (Country) String

func (c Country) String() string

type FF10DailyPoint

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

FF10DailyPoint holds the information contained in a SMOKE FF10 daily point record.

func ParseFF10DailyPoint

func ParseFF10DailyPoint(rec []string, inputConv Conversion) (*FF10DailyPoint, error)

ParseFF10DailyPoint creates a new record from an FF10 daily point record, where inputConv specifies the factor to multiply emissions by to convert total kilograms.

func (FF10DailyPoint) Country

func (a FF10DailyPoint) Country() Country

Country returns the country this record is associated with.

func (FF10DailyPoint) FIPS

func (a FF10DailyPoint) FIPS() FIPS

FIPS returns the FIPS location code associated with this record.

func (FF10DailyPoint) PeriodTotal

func (e FF10DailyPoint) PeriodTotal(begin, end time.Time) float64

PeriodTotal returns the total emissions that occur between the beginning and end time in kilograms.

func (FF10DailyPoint) Pollutant

func (e FF10DailyPoint) Pollutant() string

Pollutant returns the name of the pollutant.

func (FF10DailyPoint) SCC

func (e FF10DailyPoint) SCC() SCC

SCC returns the Source Classification code associated with this record.

type FF10Nonpoint

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

FF10Nonpoint holds the information contained in a SMOKE FF10 nonpoint record.

func ParseFF10Nonpoint

func ParseFF10Nonpoint(rec []string, inputConv Conversion) (*FF10Nonpoint, error)

ParseFF10Nonpoint creates a new record from the FF10 nonpoint record rec, where inputConv specifies the factor to multiply emissions by to convert them to kilograms.

func (FF10Nonpoint) Country

func (a FF10Nonpoint) Country() Country

Country returns the country this record is associated with.

func (FF10Nonpoint) FIPS

func (a FF10Nonpoint) FIPS() FIPS

FIPS returns the FIPS location code associated with this record.

func (FF10Nonpoint) PeriodTotal

func (e FF10Nonpoint) PeriodTotal(begin, end time.Time) float64

PeriodTotal returns the total emissions that occur between the beginning and end time in kilograms.

func (FF10Nonpoint) Pollutant

func (e FF10Nonpoint) Pollutant() string

Pollutant returns the name of the pollutant.

func (FF10Nonpoint) SCC

func (e FF10Nonpoint) SCC() SCC

SCC returns the Source Classification code associated with this record.

type FF10Point

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

FF10Point holds the information contained in a SMOKE FF10 point record.

func ParseFF10Point

func ParseFF10Point(rec []string, inputConv Conversion) (*FF10Point, error)

ParseFF10Point creates a new record from the FF10 point record rec, where inputConv specifies the factor to multiply emissions by to convert them to kilograms.

func (FF10Point) Country

func (a FF10Point) Country() Country

Country returns the country this record is associated with.

func (FF10Point) FIPS

func (a FF10Point) FIPS() FIPS

FIPS returns the FIPS location code associated with this record.

func (FF10Point) PeriodTotal

func (e FF10Point) PeriodTotal(begin, end time.Time) float64

PeriodTotal returns the total emissions that occur between the beginning and end time in kilograms.

func (FF10Point) Pollutant

func (e FF10Point) Pollutant() string

Pollutant returns the name of the pollutant.

func (FF10Point) SCC

func (e FF10Point) SCC() SCC

SCC returns the Source Classification code associated with this record.

type FIPS

type FIPS [2]uint16

FIPS is a representation of a location's 5-digit FIPS code, where the first 2 digits represent the state and the last 3 digits represent the county. Here, the first integer is the state and the second integer is the county.

func ParseFIPS

func ParseFIPS(fips string) (FIPS, error)

ParseFIPS converts a string representation of a FIPS to a FIPS object.

func (FIPS) String

func (f FIPS) String() string

type Record

type Record interface {
	// PeriodTotal returns the total emissions that occur between the beginning
	// and end time in kilograms.
	PeriodTotal(begin, end time.Time) float64

	// Pollutant returns the name of the pollutant in this record.
	Pollutant() string

	// SCC returns the Source Classification code associated with
	// this record.
	SCC() SCC

	// Country returns the country this record is associated with.
	Country() Country

	// FIPS returns the FIPS location code associated with this record.
	FIPS() FIPS
}

A Record holds emissions information.

type SCC

type SCC struct {
	Tier1, Tier2, Tier3, Tier4 uint16
}

SCC is the US EPA's Source Classification Code: https://www.cmascenter.org/smoke/documentation/3.6.5/html/ch02s03s05.html.

func ParseSCC

func ParseSCC(scc string) (SCC, error)

ParseSCC takes and SCC in string format and returns an SCC object.

type Scanner

type Scanner interface {
	// Scan prepares the next record. If there are no more records,
	// it returns false, otherwise it returns true.
	Scan() bool

	// Err returns any errors that occurred while preparing the next record.
	Err() error

	// Record returns the most recently prepared record.
	Record() Record
}

A Scanner sequentially processes records.

func ReadInventoryFile

func ReadInventoryFile(f io.Reader, inputConv Conversion) Scanner

ReadInventoryFile returns a Scanner for the contents of the given file, applying the given conversion to convert values to kilograms emitted.

Directories

Path Synopsis
internal
util
Package util contains emission-processing utilities.
Package util contains emission-processing utilities.
Package speciate contains functions for disaggregating and re-grouping chemical species.
Package speciate contains functions for disaggregating and re-grouping chemical species.

Jump to

Keyboard shortcuts

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