def iogen_for_year(year): iogen = IOMatrixGenerator( transaction_table="%s.indbyind_%d" % (config.WIOD_SCHEMA, year), from_sector_name="from_ind", to_sector_name="to_ind", value_column_name="value", final_demand_sectors=config.default_fd_sectors, universal_conditions=["country = $1"]) iogen.set_pce_col("CONS_h") iogen.set_export_col("EXP") return iogen
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # import common.more_exchange_rates as exrate import wiod.common from ca import config from common import matrixutils, sqlhelper from common.dbconnect import db from common.matrixutils import NamedMatrix from common.ioutils import IOMatrixGenerator, EnvMatrixGenerator from common.counterfact import CounterfactGenerator iogen = IOMatrixGenerator(transaction_table="%s.ixi_%d" % (config.SCHEMA, config.STUDY_YEARS[0]), final_demand_sectors=config.fd_sectors) iogen.set_pce_col(config.pce_sector) iogen.set_export_col(config.export_sector) envgen = EnvMatrixGenerator( envtable="%s.emissions_quantity" % config.SCHEMA, ind_col_name="industry", series_col_name="1") # we just have emissions, no series, need hack cfgen = CounterfactGenerator(iogen, envgen) cfgen.set_series_code(["1"], "emissions") for year in config.STUDY_YEARS: print(year)
# distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # import wiod.common import common.more_exchange_rates as exrate from jp import config from common import matrixutils, sqlhelper from common.dbconnect import db from common.ioutils import IOMatrixGenerator, EnvMatrixGenerator from common.counterfact import CounterfactGenerator iogen = IOMatrixGenerator(transaction_table=None, from_sector_name="from_sector", to_sector_name="to_sector", value_column_name="value") envgen = EnvMatrixGenerator(envtable=None, ind_col_name="sector", series_col_name="series", value_col_name="value") sector_titles = {} stmt = db.prepare("select distinct harmonized, description" + " from jp.io_map_1990 order by harmonized") for row in stmt(): sector_titles[row[0]] = row[1] cfgen = CounterfactGenerator(iogen, envgen)
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # import common.more_exchange_rates as exrate import wiod.common from ca import config from common import matrixutils, sqlhelper from common.dbconnect import db from common.matrixutils import NamedMatrix from common.ioutils import IOMatrixGenerator, EnvMatrixGenerator from common.counterfact import CounterfactGenerator iogen = IOMatrixGenerator( transaction_table="%s.ixi_%d" % (config.SCHEMA, config.STUDY_YEARS[0]), final_demand_sectors=config.fd_sectors) iogen.set_pce_col(config.pce_sector) iogen.set_export_col(config.export_sector) envgen = EnvMatrixGenerator( envtable="%s.emissions_quantity" % config.SCHEMA, ind_col_name="industry", series_col_name="1") # we just have emissions, no series, need hack cfgen = CounterfactGenerator(iogen, envgen) cfgen.set_series_code(["1"], "emissions") for year in config.STUDY_YEARS: print(year)
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # import wiod.common import common.more_exchange_rates as exrate from uk import config from common import matrixutils, sqlhelper from common.dbconnect import db from common.ioutils import IOMatrixGenerator, EnvMatrixGenerator from common.counterfact import CounterfactGenerator iogen = IOMatrixGenerator( transaction_table="%s.ixi_view_%d" % (config.SCHEMA, config.STUDY_YEARS[0]), from_sector_name="from_sector", to_sector_name="to_sector", value_column_name="value", final_demand_sectors=config.fd_sectors) iogen.set_pce_col(config.pce_sector) iogen.set_export_col(config.export_sector) io_harmonizer = matrixutils.generate_selector_matrix( "%s.code_map" % config.SCHEMA, iogen.get_sectors(), "to_code", "harmonized", ["to_code is not null"]) envgen = EnvMatrixGenerator( envtable="%s.env_%d" % (config.SCHEMA, config.STUDY_YEARS[0]), ind_col_name="sector", series_col_name="series", value_col_name="value")
def iogen_for_year(year, is_hybrid=False, allow_imports=True, adjust_for_inflation=False): if is_hybrid: transaction_table = "hybrid_transactions_%d" % year value_column_name = "expenditure" else: transaction_table = "%s.transact_view_%d" % (config.IO_SCHEMA, year) value_column_name = "fob" fd_codes = fd_sectors_for_year(year, is_hybrid) iogen = IOMatrixGenerator(transaction_table=transaction_table, from_sector_name="from_sector", to_sector_name="to_sector", value_column_name=value_column_name, final_demand_sectors=fd_codes) iogen.set_pce_col(bea.fd_sectors[year]["pce"]) iogen.set_export_col(bea.fd_sectors[year]["exports"]) from_blacklist = [bea.tourism_adjustment_codes[year]] to_blacklist = [bea.tourism_adjustment_codes[year]] if year in (1972, 1977, 1982): from_blacklist.append("780300") to_blacklist.append("780300") if not allow_imports: to_blacklist.append(bea.fd_sectors[year]["imports"]) iogen.blacklist_from_sectors(from_blacklist) iogen.blacklist_to_sectors(to_blacklist) if adjust_for_inflation: iogen.set_exchange_rate(deflators.get_gdp_deflator(year)) return iogen
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # import wiod.common import common.more_exchange_rates as exrate from jp import config from common import matrixutils, sqlhelper from common.dbconnect import db from common.ioutils import IOMatrixGenerator, EnvMatrixGenerator from common.counterfact import CounterfactGenerator iogen = IOMatrixGenerator( transaction_table=None, from_sector_name="from_sector", to_sector_name="to_sector", value_column_name="value") envgen = EnvMatrixGenerator( envtable=None, ind_col_name="sector", series_col_name="series", value_col_name="value") sector_titles = {} stmt = db.prepare("select distinct harmonized, description" + " from jp.io_map_1990 order by harmonized") for row in stmt(): sector_titles[row[0]] = row[1]
def iogen_for_year(year, is_hybrid=False, allow_imports=True, adjust_for_inflation=False): if is_hybrid: transaction_table = "hybrid_transactions_%d" % year value_column_name = "expenditure" else: transaction_table = "%s.transact_view_%d" % (config.IO_SCHEMA, year) value_column_name = "fob" fd_codes = fd_sectors_for_year(year, is_hybrid) iogen = IOMatrixGenerator( transaction_table=transaction_table, from_sector_name="from_sector", to_sector_name="to_sector", value_column_name=value_column_name, final_demand_sectors=fd_codes) iogen.set_pce_col(bea.fd_sectors[year]["pce"]) iogen.set_export_col(bea.fd_sectors[year]["exports"]) from_blacklist = [bea.tourism_adjustment_codes[year]] to_blacklist = [bea.tourism_adjustment_codes[year]] if year in (1972, 1977, 1982): from_blacklist.append("780300") to_blacklist.append("780300") if not allow_imports: to_blacklist.append(bea.fd_sectors[year]["imports"]) iogen.blacklist_from_sectors(from_blacklist) iogen.blacklist_to_sectors(to_blacklist) if adjust_for_inflation: iogen.set_exchange_rate(deflators.get_gdp_deflator(year)) return iogen
# Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # import wiod.common from tw import config from common import matrixutils, sqlhelper from common.ioutils import IOMatrixGenerator, EnvMatrixGenerator from common.counterfact import CounterfactGenerator iogen = IOMatrixGenerator( transaction_table=None, from_sector_name="from_sector", to_sector_name="to_sector", value_column_name="millions") envgen = EnvMatrixGenerator( envtable=None, ind_col_name="sector", series_col_name="series", value_col_name="value") cfgen = CounterfactGenerator(iogen, envgen) for series_code in config.env_series.keys(): cfgen.set_series_code(series_code) for year in config.STUDY_YEARS: