Documentation ¶
Overview ¶
Package eieio implements an Extended InMAP Economic Input-Output (EIEIO) life cycle assessment model based on the US Bureau of Economic Analysis (BEA) Annual Input-Output Accounts Data from https://www.gov/industry/io_annual.htm.
Example ¶
This example estimates the domestic and imported purchases of petroleum caused by the demand for $1 million worth of coal in the U.S. in year 2011.
// Set up the configuration information for the simulation. cfg := Config{ Years: []Year{2011}, DetailYear: 2007, // DetailYear is always 2007. UseSummary: "data/IOUse_Before_Redefinitions_PRO_1997-2015_Summary.xlsx", UseDetail: "data/IOUse_Before_Redefinitions_PRO_2007_Detail.xlsx", ImportsSummary: "data/ImportMatrices_Before_Redefinitions_SUM_1997-2016.xlsx", ImportsDetail: "data/ImportMatrices_Before_Redefinitions_DET_2007.xlsx", TotalRequirementsSummary: "data/IxC_TR_1997-2015_Summary.xlsx", TotalRequirementsDetail: "data/IxC_TR_2007_Detail.xlsx", DomesticRequirementsSummary: "data/IxC_Domestic_1997-2015_Summary.xlsx", DomesticRequirementsDetail: "data/IxC_Domestic_2007_Detail.xlsx", } // Create a new model. e, err := New(&cfg) if err != nil { log.Fatal(err) } // Specify $1 million of demand for coal. finalDemand, err := e.FinalDemandSingle("Coal mining", 1.0e6) if err != nil { log.Fatal(err) } // Calculate the impacts of our economic demand on the year 2011 economy. domestic, err := e.EconomicImpacts(finalDemand, 2011, Domestic) if err != nil { log.Fatal(err) } imports, err := e.EconomicImpacts(finalDemand, 2011, Imported) if err != nil { log.Fatal(err) } // We're interested in purchases of petroleum, so find the appropriate sector. petroleumSector, err := e.IndustryIndex("Petroleum refineries") if err != nil { log.Fatal(err) } fmt.Printf("domestic purchases of petroleum: $%0.0f\n", domestic.At(petroleumSector, 0)) fmt.Printf("imported purchases of petroleum: $%0.0f\n", imports.At(petroleumSector, 0))
Output: domestic purchases of petroleum: $49589 imported purchases of petroleum: $21037
Index ¶
- Constants
- type Aggregator
- type Config
- type EIO
- func (e *EIO) Commodities(ctx context.Context, _ *eieiorpc.StringInput) (*eieiorpc.StringList, error)
- func (e *EIO) CommodityIndex(name string) (int, error)
- func (e *EIO) CommodityMask(name string) (*Mask, error)
- func (e *EIO) EconomicImpacts(demand *mat.VecDense, year Year, loc Location) (*mat.VecDense, error)
- func (e *EIO) FinalDemand(ctx context.Context, input *eieiorpc.FinalDemandInput) (*eieiorpc.Vector, error)
- func (e *EIO) FinalDemandSingle(commodity string, amount float64) (*mat.VecDense, error)
- func (e *EIO) Industries(ctx context.Context, _ *eieiorpc.StringInput) (*eieiorpc.StringList, error)
- func (e *EIO) IndustryIndex(name string) (int, error)
- func (e *EIO) IndustryMask(name string) (*Mask, error)
- func (e *EIO) NewIOAggregator(fileName string) (*Aggregator, error)
- func (e *EIO) Years() []Year
- type FinalDemand
- type Location
- type Mask
- type Pollutant
- type SectorError
- type Server
- func (s *Server) DefaultSelection(ctx context.Context, in *eieiorpc.Selection) (*eieiorpc.Selection, error)
- func (s *Server) EmitterGroupAbbrevs(ctx context.Context, _ *eieiorpc.StringInput) (*eieiorpc.StringList, error)
- func (s *Server) EmitterGroupNames(ctx context.Context, _ *eieiorpc.StringInput) (*eieiorpc.StringList, error)
- func (s *Server) EmitterGroups(ctx context.Context, in *eieiorpc.Selection) (*eieiorpc.Selectors, error)
- func (s *Server) EmitterMask(ctx context.Context, abbrev *eieiorpc.StringInput) (*eieiorpc.Mask, error)
- func (s *Server) EmitterSectors(ctx context.Context, in *eieiorpc.Selection) (*eieiorpc.Selectors, error)
- func (s *Server) EndUseGroupAbbrevs(ctx context.Context, _ *eieiorpc.StringInput) (*eieiorpc.StringList, error)
- func (s *Server) EndUseGroupNames(ctx context.Context, _ *eieiorpc.StringInput) (*eieiorpc.StringList, error)
- func (s *Server) EndUseGroups(ctx context.Context, in *eieiorpc.Selection) (*eieiorpc.Selectors, error)
- func (s *Server) EndUseMask(ctx context.Context, abbrev *eieiorpc.StringInput) (*eieiorpc.Mask, error)
- func (s *Server) EndUseSectors(ctx context.Context, in *eieiorpc.Selection) (*eieiorpc.Selectors, error)
- func (s *Server) Geometry(ctx context.Context, input *eieiorpc.GeometryInput) (*eieiorpc.Rectangles, error)
- func (s *Server) MapInfo(ctx context.Context, in *eieiorpc.Selection) (*eieiorpc.ColorInfo, error)
- func (s *Server) Populations(ctx context.Context, _ *eieiorpc.Selection) (*eieiorpc.Selectors, error)
- func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (s *Server) Years(ctx context.Context, _ *eieiorpc.Selection) (*eieiorpc.Year, error)
- type ServerConfig
- type SpatialConfig
- type SpatialEIO
- func (e *SpatialEIO) ConcentrationMatrix(ctx context.Context, request *eieiorpc.ConcentrationMatrixInput) (*eieiorpc.Matrix, error)
- func (e *SpatialEIO) Concentrations(ctx context.Context, request *eieiorpc.ConcentrationInput) (*eieiorpc.Vector, error)
- func (e *SpatialEIO) Emissions(ctx context.Context, request *eieiorpc.EmissionsInput) (*eieiorpc.Vector, error)
- func (e *SpatialEIO) EmissionsMatrix(ctx context.Context, request *eieiorpc.EmissionsMatrixInput) (*eieiorpc.Matrix, error)
- func (e *SpatialEIO) Health(ctx context.Context, request *eieiorpc.HealthInput) (*eieiorpc.Vector, error)
- func (e *SpatialEIO) HealthMatrix(ctx context.Context, request *eieiorpc.HealthMatrixInput) (*eieiorpc.Matrix, error)
- func (e *SpatialEIO) NewSCCAggregator(fileName string) (*Aggregator, error)
- func (s *SpatialEIO) SCCDescription(i int) (string, error)
- func (e *SpatialEIO) SCCMask(code slca.SCC) (*Mask, error)
- type Year
Examples ¶
Constants ¶
const ( // This group of demand types is directly available in the spreadsheet. PersonalConsumption FinalDemand = "F010" PrivateStructures = "F02S" PrivateEquipment = "F02E" PrivateIP = "F02N" PrivateResidential = "F02R" InventoryChange = "F030" Export = "F040" DefenseConsumption = "F06C" DefenseStructures = "F06S" DefenseEquipment = "F06E" DefenseIP = "F06N" NondefenseConsumption = "F07C" NondefenseStructures = "F07S" NondefenseEquipment = "F07E" NondefenseIP = "F07N" LocalConsumption = "F10C" LocalStructures = "F10S" LocalEquipment = "F10E" LocalIP = "F10N" // This group of demand types consists of aggregates of the // above types. AllDemand = FinalDemand(All) // All is a combination of all categories above. NonExport = "NonExport" // NonExport is (All - Export) )
These constants specify the available types of final demand. The provided codes correspond to the codes at the summary level of detail. For the detailed level, "00" should be added to the end of each code.
const All = "All"
All specifies that all sectors are to be considered
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Aggregator ¶
type Aggregator struct {
IndustryAggregates, CommodityAggregates []string
// contains filtered or unexported fields
}
Aggregator provides functionality for grouping industry and commodity sectors.
func (*Aggregator) Abbreviation ¶
func (a *Aggregator) Abbreviation(name string) (string, error)
Abbreviation returns the abbreviation associated with the given name.
func (*Aggregator) Abbreviations ¶
func (a *Aggregator) Abbreviations() []string
Abbreviations returns the abbreviated names of the aggregated groups.
func (*Aggregator) CommodityMask ¶
func (a *Aggregator) CommodityMask(abbrev string) *Mask
CommodityMask returns a vector of ones in commodity sectors that match the given aggregated group abbrevation and zeros elsewhere.
func (*Aggregator) IndustryMask ¶
func (a *Aggregator) IndustryMask(abbrev string) *Mask
IndustryMask returns a vector of ones in industry sectors that match the given aggregated group abbrevation and zeros elsewhere.
func (*Aggregator) Names ¶
func (a *Aggregator) Names() []string
Names returns the names of the aggregated groups.
type Config ¶
type Config struct { // Years specifies the simulation years. Years []Year // DetailYear specifies the year for which detailed information is // available. With current default data, this should be 2007. DetailYear Year // UseSummary is the locations of the BEA use file // at the summary level of detail. UseSummary string // UseDetail is the location of the BEA use file // at the detailed level of detail. UseDetail string // ImportsSummary is the locations of the BEA import demand file // at the summary level of detail. ImportsSummary string // ImportsDetail is the location of the BEA import demand file // at the detailed level of detail. ImportsDetail string // TotalRequirementsSummary and DomesticRequirementsSummary are // the locations of the BEA total requirements and domestic requirements // files (Industry x Commodity) at the summary level of detail. TotalRequirementsSummary, DomesticRequirementsSummary string // TotalRequirementsDetail and DomesticRequirementsDetail are // the locations of the BEA total requirements and domestic requirements // files (Industry x Commodity) at the detailed level of detail. TotalRequirementsDetail, DomesticRequirementsDetail string }
Config holds simulation configuration imformation.
type EIO ¶
type EIO struct {
// contains filtered or unexported fields
}
EIO is a holder for EIO LCA data.
func (*EIO) Commodities ¶
func (e *EIO) Commodities(ctx context.Context, _ *eieiorpc.StringInput) (*eieiorpc.StringList, error)
Commodities returns the commodity sectors in the model.
func (*EIO) CommodityIndex ¶
CommodityIndex returns the index number of the specified sector.
func (*EIO) CommodityMask ¶
CommodityMask returns a mask to single out the given commodity.
func (*EIO) EconomicImpacts ¶
EconomicImpacts returns the economic impacts of the given economic demand in the given year. The units of the output are the same as the units of demand. Location specifies whether return domestic, import, or total impacts.
func (*EIO) FinalDemand ¶
func (e *EIO) FinalDemand(ctx context.Context, input *eieiorpc.FinalDemandInput) (*eieiorpc.Vector, error)
FinalDemand returns a final demand vector for the given year and demand type. commodities specifies which commodities the demand should be calculated for. loc specifies the demand location (Domestic, Imported, or Total) If commodities == nil, demand for all commodities is included.
func (*EIO) FinalDemandSingle ¶
FinalDemandSingle returns a final demand vector with the given amount specified for the given commodity sector, and zeros for all other sectors.
func (*EIO) Industries ¶
func (e *EIO) Industries(ctx context.Context, _ *eieiorpc.StringInput) (*eieiorpc.StringList, error)
Industries returns the industry sectors in the model.
func (*EIO) IndustryIndex ¶
IndustryIndex returns the index number of the specified sector.
func (*EIO) IndustryMask ¶
IndustryMask returns a mask to single out the given industry.
func (*EIO) NewIOAggregator ¶
func (e *EIO) NewIOAggregator(fileName string) (*Aggregator, error)
NewIOAggregator initializes a new Aggregator of Input-Output categories from the information in the provided file.
type FinalDemand ¶
type FinalDemand string
FinalDemand specifies the available types of final demand.
type Location ¶
type Location int
Location specifies where impacts occur, or where demanded commidities are from.
type Pollutant ¶
type Pollutant int
Pollutant specifies types of airborne pollutant concentrations (not emissions).
These pollutants are PM2.5 and its main components.
type SectorError ¶
type SectorError struct {
// contains filtered or unexported fields
}
SectorError is returned when an invalid sector is requested.
func (SectorError) Error ¶
func (err SectorError) Error() string
type Server ¶
type Server struct { *SpatialEIO *ces.CES Log logrus.FieldLogger // contains filtered or unexported fields }
Server is a server for EIO LCA model simulation data.
func NewServer ¶
NewServer creates a new EIO-LCA server, where hr represents the hazard ratio functions to be used.
func (*Server) DefaultSelection ¶
func (*Server) EmitterGroupAbbrevs ¶
func (s *Server) EmitterGroupAbbrevs(ctx context.Context, _ *eieiorpc.StringInput) (*eieiorpc.StringList, error)
EmitterGroupAbbrevs returns the abbreviations of the emitter groups.
func (*Server) EmitterGroupNames ¶
func (s *Server) EmitterGroupNames(ctx context.Context, _ *eieiorpc.StringInput) (*eieiorpc.StringList, error)
EmitterGroupNames returns the names of the emitter groups.
func (*Server) EmitterGroups ¶
func (s *Server) EmitterGroups(ctx context.Context, in *eieiorpc.Selection) (*eieiorpc.Selectors, error)
EmitterGroups returns the available emitter groups.
func (*Server) EmitterMask ¶
func (s *Server) EmitterMask(ctx context.Context, abbrev *eieiorpc.StringInput) (*eieiorpc.Mask, error)
EmitterMask returns a mask that can be used to limits impacts to only caused by emissions from the SCC codes defined by abbrev.
func (*Server) EmitterSectors ¶
func (s *Server) EmitterSectors(ctx context.Context, in *eieiorpc.Selection) (*eieiorpc.Selectors, error)
EmitterSectors returns the available production sectors.
func (*Server) EndUseGroupAbbrevs ¶
func (s *Server) EndUseGroupAbbrevs(ctx context.Context, _ *eieiorpc.StringInput) (*eieiorpc.StringList, error)
EndUseGroupAbbrevs returns the abbreviations of the end-use groups.
func (*Server) EndUseGroupNames ¶
func (s *Server) EndUseGroupNames(ctx context.Context, _ *eieiorpc.StringInput) (*eieiorpc.StringList, error)
EndUseGroupNames returns the names of the end-use groups.
func (*Server) EndUseGroups ¶
func (s *Server) EndUseGroups(ctx context.Context, in *eieiorpc.Selection) (*eieiorpc.Selectors, error)
EndUseGroups returns the available demand groups.
func (*Server) EndUseMask ¶
func (s *Server) EndUseMask(ctx context.Context, abbrev *eieiorpc.StringInput) (*eieiorpc.Mask, error)
EndUseMask returns a mask that can be used to limit a FinalDemand vector to demand for end-uses in the end-use group defined by abbrev.
func (*Server) EndUseSectors ¶
func (s *Server) EndUseSectors(ctx context.Context, in *eieiorpc.Selection) (*eieiorpc.Selectors, error)
EndUseSectors returns the available demand sectors.
func (*Server) Geometry ¶
func (s *Server) Geometry(ctx context.Context, input *eieiorpc.GeometryInput) (*eieiorpc.Rectangles, error)
Geometry returns the InMAP grid geometry, , where SpatialReference specifies the desired projection in WKT or PROJ4 format.
func (*Server) Populations ¶
type ServerConfig ¶
type ServerConfig struct { SpatialConfig // IOAggregatorFile is the path to the xlsx file containing IO sector // aggregation information. IOAggregatorFile string // SCCAggregatorFile is the path to the xlsx file containing SCC // aggregation information. SCCAggregatorFile string // StaticDir is the path to the directory containing the static // assets for the website. StaticDir string // DefaultYear specifies the default analysis year. DefaultYear Year // CESDataDir is the path to the directory holding CES data, // e.g. ${INMAP_ROOT_DIR}/emissions/slca/eieio/ces/data CESDataDir string }
type SpatialConfig ¶
type SpatialConfig struct { SCCMapFile string SCCDescriptionFile string Config Config SpatialEIO SpatialEIO }
SpatialConfig holds configuration information for performing spatial EIO LCA.
type SpatialEIO ¶
type SpatialEIO struct { EIO slca.CSTConfig // EIEIOCache specfies the path to the directory to be used to // cache spatial information. EIEIOCache string // MemCacheSize is the size of the memory cache for emissions, concentration, // and health spatial results. MemCacheSize int // SCCs are the source codes for emissions sources in the model. SCCs []slca.SCC // SpatialRefs are a list of spatial references // corresponding to the SCCs. SpatialRefs []slca.SpatialRef // contains filtered or unexported fields }
SpatialEIO implements a spatial EIO LCA model.
func NewSpatial ¶
func NewSpatial(c *SpatialConfig, hr ...epi.HRer) (*SpatialEIO, error)
NewSpatial creates a new SpatialEIO variable.
func (*SpatialEIO) ConcentrationMatrix ¶
func (e *SpatialEIO) ConcentrationMatrix(ctx context.Context, request *eieiorpc.ConcentrationMatrixInput) (*eieiorpc.Matrix, error)
ConcentrationMatrix returns spatially- and industry-explicit pollution concentrations caused by the specified economic demand. In the result matrix, the rows represent air quality model grid cells and the columns represent emitters.
func (*SpatialEIO) Concentrations ¶
func (e *SpatialEIO) Concentrations(ctx context.Context, request *eieiorpc.ConcentrationInput) (*eieiorpc.Vector, error)
Concentrations returns spatially-explicit pollutant concentrations caused by the specified economic demand. emitters specifies the emitters concentrations should be calculated for. If emitters == nil, combined concentrations for all emitters are calculated.
func (*SpatialEIO) Emissions ¶
func (e *SpatialEIO) Emissions(ctx context.Context, request *eieiorpc.EmissionsInput) (*eieiorpc.Vector, error)
Emissions returns spatially-explicit emissions caused by the specified economic demand. Emitters specifies the emitters emissions should be calculated for. If emitters == nil, combined emissions for all emitters are calculated.
func (*SpatialEIO) EmissionsMatrix ¶
func (e *SpatialEIO) EmissionsMatrix(ctx context.Context, request *eieiorpc.EmissionsMatrixInput) (*eieiorpc.Matrix, error)
EmissionsMatrix returns spatially- and industry-explicit emissions caused by the specified economic demand. In the result matrix, the rows represent air quality model grid cells and the columns represent emitters.
func (*SpatialEIO) Health ¶
func (e *SpatialEIO) Health(ctx context.Context, request *eieiorpc.HealthInput) (*eieiorpc.Vector, error)
Health returns spatially-explicit pollutant air quality-related health impacts caused by the specified economic demand. Emitters specify the emitters health impacts should be calculated for. If emitters == nil, combined health impacts for all emitters are calculated. Population must be one of the population types defined in the configuration file.
func (*SpatialEIO) HealthMatrix ¶
func (e *SpatialEIO) HealthMatrix(ctx context.Context, request *eieiorpc.HealthMatrixInput) (*eieiorpc.Matrix, error)
HealthMatrix returns spatially- and industry-explicit air quality-related health impacts caused by the specified economic demand. In the result matrix, the rows represent air quality model grid cells and the columns represent emitters.
func (*SpatialEIO) NewSCCAggregator ¶
func (e *SpatialEIO) NewSCCAggregator(fileName string) (*Aggregator, error)
NewSCCAggregator initializes a new Aggregator of Source Classification Codes from the information in the provided file.
func (*SpatialEIO) SCCDescription ¶
func (s *SpatialEIO) SCCDescription(i int) (string, error)
SCCDescription returns the description of the SCC code at index i of the emitting sectors.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package ces translates Consumer Expenditure Survey (CES) demographic data to EIO categories.
|
Package ces translates Consumer Expenditure Survey (CES) demographic data to EIO categories. |
eieiorpcjs
Package eieiorpc is a generated protocol buffer package.
|
Package eieiorpc is a generated protocol buffer package. |