diff --git a/ixmp/core.py b/ixmp/core.py index 7bb34e606..1c4ccb914 100644 --- a/ixmp/core.py +++ b/ixmp/core.py @@ -28,10 +28,11 @@ def start_jvm(): # must add dir and jarfile to support finding ixmp.properties module_root = os.path.dirname(__file__) jarfile = os.path.join(module_root, 'ixmp.jar') - lib_dir = os.path.join(module_root, 'lib') - ix_classpath = os.pathsep.join([jarfile, module_root]) - ext_dir_arg = "-Djava.ext.dirs=%s" % lib_dir - jvm_args = ["-Djava.class.path=%s" % ix_classpath, "-Xmx4G", ext_dir_arg] + module_lib = os.path.join(module_root, 'lib') + module_jars = [os.path.join(module_lib, f) for f in os.listdir(module_lib)] + sep = ';' if os.name == 'nt' else ':' + ix_classpath = sep.join([module_root, jarfile] + module_jars) + jvm_args = ["-Djava.class.path=" + ix_classpath, "-Xmx4G"] jpype.startJVM(jpype.getDefaultJVMPath(), *jvm_args) # define auxiliary references to Java classes diff --git a/ixmp/db/migration/oracle/V1.1__drop_schema_config.sql b/ixmp/db/migration/oracle/V1.1__drop_schema_config.sql new file mode 100644 index 000000000..1b88e91ac --- /dev/null +++ b/ixmp/db/migration/oracle/V1.1__drop_schema_config.sql @@ -0,0 +1,2 @@ +-- drop the table schema_config - we use flyway now instead +drop table schema_config; diff --git a/ixmp/db/migration/oracle/V1__oracle_base_version.sql b/ixmp/db/migration/oracle/V1__oracle_base_version.sql new file mode 100644 index 000000000..2ec679fae --- /dev/null +++ b/ixmp/db/migration/oracle/V1__oracle_base_version.sql @@ -0,0 +1,711 @@ +-- +-- create ixmp schema objects (sequences, tables, views) + +-- +-- sequences +CREATE SEQUENCE ANNOTATION_SEQ MINVALUE 1 MAXVALUE 999999999999999999999999999 INCREMENT BY 1 START WITH 1 CACHE 20 NOORDER NOCYCLE; +CREATE SEQUENCE CHANGELOG_SEQ MINVALUE 1 MAXVALUE 999999999999999999999999999 INCREMENT BY 1 START WITH 1 CACHE 20 NOORDER NOCYCLE; +CREATE SEQUENCE IAMC_KEY_SEQ MINVALUE 1 MAXVALUE 999999999999999999999999999 INCREMENT BY 1 START WITH 1 CACHE 20 NOORDER NOCYCLE; +CREATE SEQUENCE MODEL_SEQ MINVALUE 1 MAXVALUE 999999999999999999999999999 INCREMENT BY 1 START WITH 1 CACHE 20 NOORDER NOCYCLE; +CREATE SEQUENCE RUN_SEQ MINVALUE 1 MAXVALUE 999999999999999999999999999 INCREMENT BY 1 START WITH 1 CACHE 20 NOORDER NOCYCLE; +CREATE SEQUENCE SCENARIO_SEQ MINVALUE 1 MAXVALUE 999999999999999999999999999 INCREMENT BY 1 START WITH 1 CACHE 20 NOORDER NOCYCLE; +CREATE SEQUENCE UNIT_SEQ MINVALUE 1 MAXVALUE 999999999999999999999999999 INCREMENT BY 1 START WITH 100 CACHE 20 NOORDER NOCYCLE; +CREATE SEQUENCE IAMC_TS_SEQ MINVALUE 1 MAXVALUE 999999999999999999999999999 INCREMENT BY 1 START WITH 1 CACHE 20 NOORDER NOCYCLE; +CREATE SEQUENCE FILEID_SEQ MINVALUE 1 MAXVALUE 999999999999999999999999999 INCREMENT BY 1 START WITH 2 CACHE 20 NOORDER NOCYCLE ; + +-- +-- tables + +-- +-- schema configuration table (version tags) + +create table SCHEMA_CONFIG ( + PARAM VARCHAR2(64) not null, + PARTYPE VARCHAR2(8) not null, + STRVALUE VARCHAR2(128), + NUMVALUE FLOAT, + NOTE VARCHAR2(256) +); + +insert into SCHEMA_CONFIG (param, partype, numvalue) values ('VERSION_MAJOR','INTEGER', 0); +insert into SCHEMA_CONFIG (param, partype, numvalue) values ('VERSION_MINOR','INTEGER', 1); + +-- +-- app configuration and file upload/import stuff + +create table APP_AUDIT ( + USR VARCHAR2(64 BYTE) NOT NULL ENABLE, + "MODEL" VARCHAR2(64 BYTE) NOT NULL ENABLE, + SCEN VARCHAR2(64 BYTE) NOT NULL ENABLE, + ACTION VARCHAR2(64 BYTE), + INFO VARCHAR2(512 BYTE), + "WHEN" DATE DEFAULT sysdate NOT NULL ENABLE +); + +create table APP_FILES ( + "ID" INTEGER NOT NULL ENABLE, + "USR" VARCHAR2(64 BYTE) NOT NULL ENABLE, + "GRP" VARCHAR2(64 BYTE) NOT NULL ENABLE, + "NAME" VARCHAR2(256 BYTE) NOT NULL ENABLE, + "TIMESTAMP" DATE DEFAULT sysdate NOT NULL ENABLE, + "FILESIZE" NUMBER(*,0) DEFAULT 0, + "STATUS" VARCHAR2(64 BYTE), + CONSTRAINT "APP_FILES_PK" PRIMARY KEY ("ID") +); + +create table APP_IMPORT_HISTORY ( + "USR" VARCHAR2(64 BYTE) NOT NULL ENABLE, + "MODEL" VARCHAR2(64 BYTE) NOT NULL ENABLE, + "SCENARIO" VARCHAR2(64 BYTE) NOT NULL ENABLE, + "TIMESTAMP" DATE DEFAULT sysdate NOT NULL ENABLE, + "FILENAME" VARCHAR2(128 BYTE), + "INFO" VARCHAR2(64 BYTE) +); + +create table APP_IMPORT_QUEUE ( + "USR" VARCHAR2(64 BYTE) NOT NULL ENABLE, + "FILENAME" VARCHAR2(256 BYTE) NOT NULL ENABLE, + "STATE" VARCHAR2(64 BYTE) DEFAULT 'NEW', + "TIMESTAMP" DATE DEFAULT sysdate, + CONSTRAINT "APP_IMPORT_QUEUE_PK" PRIMARY KEY ("USR", "FILENAME") +); + +create table APP_CONFIG ( + PARAM VARCHAR2(64) not null, + PARTYPE VARCHAR2(8) default 'STRING' not null, + STRVALUE VARCHAR2(128) , + NUMVALUE INTEGER , + NOTE VARCHAR2(256) + , PRIMARY KEY ( PARAM ) +); + +create table APP_USER ( + LOGIN VARCHAR2(128) not null, + PASSWORD VARCHAR2(128) default 'iimq9WhxKcHSe5BXj8M+zEnQadw=' not null, + EMAIL VARCHAR2(128) , + REALNAME VARCHAR2(128) , + COUNTRY VARCHAR2(128) , + ORGANIZATION VARCHAR2(128) , + STREET VARCHAR2(256) , + TEMPKEY VARCHAR2(128) + , PRIMARY KEY ( LOGIN ) +); + +create table APP_USER_CONFIG ( + LOGIN VARCHAR2(128 BYTE) not null, + PARAM VARCHAR2(64 BYTE) not null, + PARTYPE VARCHAR2(8 BYTE) default 'STRING' not null, + STRVALUE VARCHAR2(256 BYTE), + NUMVALUE FLOAT(126), + NOTE VARCHAR2(256 BYTE) + , PRIMARY KEY ("LOGIN", "PARAM") +); +-- +-- ixmp structure + +create table MODEL ( + ID INTEGER not null, + NAME VARCHAR2(64) not null + , PRIMARY KEY ( ID ) +); + +create table SCENARIO ( + ID INTEGER not null, + NAME VARCHAR2(64) not null + , PRIMARY KEY ( ID ) +); + +create table RUN ( + ID INTEGER not null, + MODEL_ID INTEGER not null, + SCEN_ID INTEGER not null, + CRE_USER VARCHAR2(64) default '(unknown)' not null, + CRE_DATE DATE default sysdate not null, + UPD_USER VARCHAR2(64) , + UPD_DATE DATE , + SCHEME VARCHAR2(20) , + STATUS INTEGER default 0 not null, + VERSION INTEGER default 0 not null, + LOCK_USER VARCHAR2(64) , + LOCK_DATE DATE , + SEQ_ITEM_ID INTEGER , + ANNOTATION VARCHAR2(264 BYTE) + , PRIMARY KEY ( ID ) +); + +create table RUN_DEFAULT ( + MODEL_ID INTEGER not null, + SCEN_ID INTEGER not null, + ID INTEGER not null + , PRIMARY KEY ( MODEL_ID,SCEN_ID ) +); + +create table ANNOTATION_LOG ( + ANNOTATIONID INTEGER not null, + STATUS VARCHAR2(128) not null, + RUNID INTEGER , + SCRIPT VARCHAR2(128) not null, + CRE_USER VARCHAR2(128) default '(unknown)' not null, + CRE_DATE DATE default sysdate not null, + UPD_USER VARCHAR2(64) , + UPD_DATE DATE , + TEXT VARCHAR2(512) , + INTERFACE VARCHAR2(20) + , PRIMARY KEY ( ANNOTATIONID ) +); + +create table CHANGE_LOG ( + ANNOTATIONID INTEGER not null, + RUNID INTEGER not null, + OPERATION VARCHAR2(64) not null, + ITEM VARCHAR2(64) not null, + KEY VARCHAR2(512) , + VAL_PREV BINARY_DOUBLE , + VAL_NEW BINARY_DOUBLE , + SEQ INTEGER default "CHANGELOG_SEQ"."NEXTVAL" +); + +-- +-- IAMC timeseries structure and nodes, units, etc. + +create table IX_UNIT ( + ID INTEGER not null, + NAME VARCHAR2(64) not null, + CRE_USER VARCHAR2(64 BYTE), + CRE_DATE DATE, + SCHEME VARCHAR2(64 BYTE) + , PRIMARY KEY ( ID ) +); + +create table IAMC_KEY ( + KEYID INTEGER not null, + KEYSTRING VARCHAR2(256) not null, + UNITID INTEGER not null, + CRE_USER VARCHAR2(64) not null, + CRE_DATE DATE not null, + SCHEME VARCHAR2(128) + , PRIMARY KEY ( KEYID ) + , CONSTRAINT "IAMC_KEY_UK" UNIQUE ( KEYSTRING, UNITID) +); + +create table IAMC_NODES ( + ID INTEGER not null, + HIERARCHY VARCHAR2(20) not null, + NAME VARCHAR2(64) not null, + PARENT VARCHAR2(64) not null + , PRIMARY KEY ( ID ) +); + +create table IAMC_NODES_SYNONYM ( + NODE_ID INTEGER not null, + NODE_SYNONYM VARCHAR2(64) not null + , PRIMARY KEY ( NODE_SYNONYM ) +); + +create table IAMC_TSDATA ( + TSID INTEGER not null, + YEAR INTEGER not null, + VALUE FLOAT not null + , PRIMARY KEY ( TSID,YEAR ) +); + +create table IAMC_TSINFO ( + TSID INTEGER DEFAULT IAMC_TS_SEQ.NEXTVAL not null, + RUNID INTEGER not null, + NODE INTEGER not null, + KEY INTEGER not null, + TIME INTEGER not null, + META NUMBER(1,0) DEFAULT 0 NOT NULL ENABLE, + PRIMARY KEY ( TSID,RUNID,NODE,KEY,TIME ), + CONSTRAINT IAMC_TSINFO_TSID_UK UNIQUE ( TSID ) ENABLE +); + +-- +-- IXdatastructure tables + +create table IX_KEY ( + RUNID INTEGER not null, + KEYID INTEGER not null, + KEY VARCHAR2(40) not null + , PRIMARY KEY ( RUNID,KEYID ) +); + +create table IX_COMMENT ( + COMID INTEGER not null, + COMSTRING VARCHAR2(512) not null, + RUNID INTEGER not null + , PRIMARY KEY ( COMID,RUNID ) +); + +create table IX_IDXSET ( + RUNID INTEGER not null, + NAME VARCHAR2(64) not null, + ELE_BLOB BLOB, + ITEMID INTEGER not null, + COM_BLOB BLOB, + PRIMARY KEY ( RUNID,NAME ) +); + +create table IX_SET ( + RUNID INTEGER not null, + NAME VARCHAR2(64) not null, + DIM INTEGER default null , + ITEMID INTEGER + , PRIMARY KEY ( RUNID,NAME ) +); + +create table IX_SET_DIM ( + RUNID INTEGER not null, + NAME VARCHAR2(64) not null, + IDX INTEGER not null, + IDX_SET VARCHAR2(64) not null, + IDX_NAME VARCHAR2(64) not null + , PRIMARY KEY ( RUNID,NAME,IDX ) +); + +create table IX_SET_BLOBSTORE ( + RUNID INTEGER not null, + NAME VARCHAR2(256) not null, + ELE_BLOB BLOB , + COM_BLOB BLOB + , PRIMARY KEY ( RUNID,NAME ) +); + +create table IX_PAR ( + RUNID INTEGER not null, + NAME VARCHAR2(64) not null, + DIM INTEGER default 0 not null, + ITEMID INTEGER + , PRIMARY KEY ( RUNID,NAME ) +); + +create table IX_PAR_DIM ( + RUNID INTEGER not null, + NAME VARCHAR2(64) not null, + IDX INTEGER not null, + IDX_SET VARCHAR2(64) not null, + IDX_NAME VARCHAR2(64) not null + , PRIMARY KEY ( RUNID,NAME,IDX ) +); + +create table IX_PAR_BLOBSTORE ( + RUNID INTEGER not null, + NAME VARCHAR2(256) not null, + ELE_BLOB BLOB , + COM_BLOB BLOB + , PRIMARY KEY ( RUNID,NAME ) +); + +create table IX_VAR ( + RUNID INTEGER not null, + NAME VARCHAR2(64) not null, + DIM INTEGER default 0 not null, + ITEMID INTEGER not null + , PRIMARY KEY ( RUNID,NAME ) +); + +create table IX_VAR_DIM ( + RUNID INTEGER not null, + NAME VARCHAR2(64) not null, + IDX INTEGER not null, + IDX_SET VARCHAR2(64) not null, + IDX_NAME VARCHAR2(64) not null + , PRIMARY KEY ( RUNID,NAME,IDX ) +); + +create table IX_VAR_BLOBSTORE ( + RUNID INTEGER not null, + NAME VARCHAR2(256) not null, + ELE_BLOB BLOB , + COM_BLOB BLOB + , PRIMARY KEY ( RUNID,NAME ) +); + +create table IX_EQU ( + RUNID INTEGER not null, + NAME VARCHAR2(64) not null, + DIM INTEGER not null, + ITEMID INTEGER not null + , PRIMARY KEY ( RUNID,NAME ) +); + +create table IX_EQU_DIM ( + RUNID INTEGER not null, + NAME VARCHAR2(64) not null, + IDX INTEGER not null, + IDX_SET VARCHAR2(64) not null, + IDX_NAME VARCHAR2(64) not null + , PRIMARY KEY ( RUNID,NAME,IDX ) +); + +create table IX_EQU_BLOBSTORE ( + RUNID INTEGER not null, + NAME VARCHAR2(256) not null, + ELE_BLOB BLOB , + COM_BLOB BLOB + , PRIMARY KEY ( RUNID,NAME ) +); + +-- +-- indices + +create UNIQUE INDEX UNIT_NAME_INDEX ON IX_UNIT( NAME ); + +-- +-- foreign keys +alter table RUN add constraint RUN_MODEL_FK foreign key ( MODEL_ID ) references MODEL ( ID ) ; +alter table RUN add constraint RUN_SCENARIO_FK foreign key ( SCEN_ID ) references SCENARIO ( ID ) ; +alter table RUN_DEFAULT add constraint RUN_DEFAULT_FK foreign key ( ID ) references RUN ( ID ) on delete CASCADE; +alter table ANNOTATION_LOG add constraint ANNOTATION_LOG_RUN_FK foreign key ( RUNID ) references RUN ( ID ) on delete CASCADE; +alter table CHANGE_LOG add constraint CHANGE_LOG_ANNOTATION_LOG_FK foreign key ( ANNOTATIONID ) references ANNOTATION_LOG ( ANNOTATIONID ) ; +alter table CHANGE_LOG add constraint CHANGE_LOG_RUN_FK foreign key ( RUNID ) references RUN ( ID ) on delete CASCADE; +alter table IAMC_KEY add constraint IAMC_KEY_UNIT_FK foreign key ( UNITID ) references IX_UNIT ( ID ) ; +alter table IAMC_NODES_SYNONYM add constraint IAMC_NODES_SYNONYN_NODES_FK foreign key ( NODE_ID ) references IAMC_NODES ( ID ) ; +alter table IAMC_TSDATA add constraint DATA_INFO_FK foreign key ( TSID ) references IAMC_TSINFO ( TSID ) ; +alter table IX_KEY add constraint KEY_FK foreign key ( RUNID ) references RUN ( ID ) on delete CASCADE; +alter table IX_COMMENT add constraint COMMENT_RUN_FK foreign key ( RUNID ) references RUN ( ID ) on delete CASCADE; +alter table IX_IDXSET add constraint IDXSET_RUN_FK foreign key ( RUNID ) references RUN ( ID ) on delete CASCADE; +alter table IX_SET add constraint SET_RUN_FK foreign key ( RUNID ) references RUN ( ID ) on delete CASCADE; +alter table IX_SET_DIM add constraint SET_DIM_SET_FK foreign key ( RUNID,NAME ) references IX_SET ( RUNID,NAME ) on delete CASCADE; +alter table IX_SET_DIM add constraint SET_DIM_IDX_SET_FK foreign key ( RUNID,IDX_SET ) references IX_IDXSET ( RUNID,NAME ) on delete CASCADE; +alter table IX_SET_BLOBSTORE add constraint SET_BLOBSTORE_SET_FK foreign key ( RUNID,NAME ) references IX_SET ( RUNID,NAME ) on delete CASCADE; +alter table IX_PAR add constraint PAR_RUN_FK foreign key ( RUNID ) references RUN ( ID ) on delete CASCADE; +alter table IX_PAR_DIM add constraint PAR_DIM_PAR_FK foreign key ( RUNID,NAME ) references IX_PAR ( RUNID,NAME ) on delete CASCADE; +alter table IX_PAR_DIM add constraint PAR_DIM_IDXSET_FK foreign key ( RUNID,IDX_SET ) references IX_IDXSET ( RUNID,NAME ) on delete CASCADE; +alter table IX_PAR_BLOBSTORE add constraint PAR_BLOBSTORE_PAR_FK foreign key ( RUNID,NAME ) references IX_PAR ( RUNID,NAME ) on delete CASCADE; +alter table IX_VAR add constraint VA_RUN_FK foreign key ( RUNID ) references RUN ( ID ) on delete CASCADE; +alter table IX_VAR_DIM add constraint VAR_DIM_VAR_FK foreign key ( RUNID,NAME ) references IX_VAR ( RUNID,NAME ) on delete CASCADE; +alter table IX_VAR_DIM add constraint VAR_DIM_IDX_SET_FK foreign key ( RUNID,IDX_SET ) references IX_IDXSET ( RUNID,NAME ) on delete CASCADE; +alter table IX_VAR_BLOBSTORE add constraint VAR_BLOBSTORE_VAR_FK foreign key ( RUNID,NAME ) references IX_VAR ( RUNID,NAME ) on delete CASCADE; +alter table IX_EQU add constraint EQU_RUN_FK foreign key ( RUNID ) references RUN ( ID ) on delete CASCADE; +alter table IX_EQU_DIM add constraint EQU_DIM_EQU_FK foreign key ( RUNID,NAME ) references IX_EQU ( RUNID,NAME ) on delete CASCADE; +alter table IX_EQU_DIM add constraint EQU_DIM_IDXSET_FK foreign key ( RUNID,IDX_SET ) references IX_IDXSET ( RUNID,NAME ) on delete CASCADE; +alter table IX_EQU_BLOBSTORE add constraint EQU_BLOBSTORE_EQU_FK foreign key ( RUNID,NAME ) references IX_EQU ( RUNID,NAME ) on delete CASCADE; + + +-- +-- views +CREATE OR REPLACE FORCE EDITIONABLE VIEW "RUN_OVERVIEW" ("ID", "MODEL", "SCENARIO", "CRE_USER", "CRE_DATE", "UPD_USER", "UPD_DATE", "LOCK_USER", "LOCK_DATE", "SCHEME", "STATUS", "VERSION", "ISDEFAULT") +AS + select r.id, m.name model, s.name scenario, + r.cre_user, r.cre_date, r.upd_user, r.upd_date, r.lock_user, r.lock_date, + r.scheme, r.status, r.version version + , nvl2( to_char(d.ID), 'True', ' ') isdefault + from run r + inner join model m on m.id = r.model_id + inner join scenario s on s.id = r.scen_id + left join run_default d on (d.MODEL_ID = m.ID and d.SCEN_ID = s.ID and d.ID = r.ID ) + order by model, scenario, d.ID, version desc; + +--view IAMC_OVERVIEW +CREATE OR REPLACE FORCE EDITIONABLE VIEW IAMC_OVERVIEW ("MODEL", "SCENARIO", "REGION", "VARIABLE", "UNIT", + "TIME", "YEAR", "VALUE", "META", "VERSION", "ISDEFAULT") +AS + select m.name, s.name, n.name, k.keystring, u.name, i.time, d.year, d.value, i.meta, r.version, + nvl2( to_char(d.ID), 'True', ' ') isdefault + from iamc_key k + inner join ix_unit u on (u.id = k.unitid) + inner join iamc_tsinfo i on (i.key = k.keyid) + inner join run r on (r.id = i.runid) + left join run_default rd on (rd.ID = r.ID) + inner join model m on m.id = r.model_id + inner join scenario s on s.id = r.scen_id + inner join iamc_nodes n on (i.node = n.id) + inner join iamc_tsdata d on (i.tsid = d.tsid); + +--- +CREATE OR REPLACE FORCE EDITIONABLE VIEW "STORAGE_VIEW" ("SEGMENT_NAME", "SEGMENT_TYPE", "MB", "GB") + AS + select segment_name, segment_type, to_char(sum(bytes)/power(1024,2), 999990.999) MB ,to_char(sum(bytes)/1024/1024/1024, 99990.999999) GB + from user_segments + group by segment_name, segment_type + order by 3 desc; +-- +-- +CREATE OR REPLACE FORCE EDITIONABLE VIEW "LOB_STORAGE_SEGS_VIEW" ("SEGMENT_NAME", "SEGMENT_TYPE", "MBYTE", "REF_TABLE") +AS + select s.segment_name, s.segment_type, to_char( sum(s.bytes)/1024/1024, 999990.999) MByte, nvl(l.table_name, '-') ref_table + from user_segments s + full join user_lobs l on s.segment_name = l.segment_name + where s.segment_name like '%LOB%' + group by s.segment_name, s.segment_type, l.table_name + order by 3 desc; +-- +-- +CREATE OR REPLACE FORCE EDITIONABLE VIEW "LOB_STORAGE_LOBS_VIEW" ("TYPE", "RUNID", "NAME", "MBYTE") +AS + select type, runid, name, to_char(bytes/1024/1024, 999990.999) MByte + from ( + select 'par' type, runid, name, dbms_lob.getlength(ele_blob) Bytes from ix_par_blobstore + union + select 'set' type, runid, name, dbms_lob.getlength(ele_blob) Bytes from ix_set_blobstore + union + select 'var' type, runid, name, dbms_lob.getlength(ele_blob) Bytes from ix_var_blobstore + union + select 'com' type, runid, 'comments' name, dbms_lob.getlength(blob) Bytes from ix_comment_blobstore + union + select 'equ' type, runid, 'ts' name, dbms_lob.getlength(ele_blob) Bytes from ix_equ_blobstore + ) + order by bytes desc, runid desc; +-- + + +-- +-- prepare units and nodes data + +-- admin user (to bootstrap user administration) +insert into app_user (login,password,realname) values ('admin','pMuy85M8UBbafoP9E1q4pItnv2E=','Administrator'); + +-- ix_unit +insert into ix_unit (id,name) values (-1 ,'???'); +insert into ix_unit (id,name) values(0, 'y'); +insert into ix_unit (id,name) values(1, '%'); +insert into ix_unit (id,name) values(2, 'GWa'); +insert into ix_unit (id,name) values(3, 'USD/GWa'); +insert into ix_unit (id,name) values(4, 'kg/kWa'); +insert into ix_unit (id,name) values(5, 'kg'); +insert into ix_unit (id,name) values(6, 'USD/kg'); +insert into ix_unit (id,name) values(7, 'USD'); +insert into ix_unit (id,name) values(8, 'cases'); +insert into ix_unit (id,name) values(9, 'km'); +insert into ix_unit (id,name) values(10, 'USD/km'); +insert into ix_unit (id,name) values(11, 'GW'); +insert into ix_unit (id,name) values(12, 'G$'); +insert into ix_unit (id,name) values(13, 'T$'); +insert into ix_unit (id,name) values(14, '-'); +insert into ix_unit (id,name) values(15, 'USD/kWa'); +insert into ix_unit (id,name) values(16, 'MW'); +insert into ix_unit (id,name) values(17, 'MWa'); +insert into ix_unit (id,name) values(18, 'USD/tC'); +insert into ix_unit (id,name) values(19, 'USD/tCO2'); +insert into ix_unit (id,name) values(20, 't'); +insert into ix_unit (id,name) values(21, 'tC'); +insert into ix_unit (id,name) values(22, 'tCO2'); +-- note that starting value of the sequence UNIT_SEQ must be increased when adding entries here + + +-- iamc_nodes +insert into iamc_nodes(id, hierarchy, name, parent) values ('0','global','World','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('1','region (R11)','North America (R11)','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('2','region (R11)','Latin America (R11)','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('3','region (R11)','Western Europe (R11)','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('4','region (R11)','Eastern Europe (R11)','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('5','region (R11)','Former Soviet Union (R11)','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('6','region (R11)','Middle East and Africa (R11)','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('7','region (R11)','Subsaharan Africa (R11)','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('8','region (R11)','Centrally planned Asia (R11)','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('9','region (R11)','Pacific OECD (R11)','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('10','region (R11)','Pacific Asia (R11)','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('11','region (R11)','South Asia (R11)','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('12','country','Canada','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('13','country','Sao Tome and Principe','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('14','country','Turkmenistan','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('15','country','Saint Helena','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('16','country','Lithuania','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('17','country','Cambodia','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('18','country','Ethiopia','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('19','country','Aruba','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('20','country','Swaziland','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('21','country','Palestine','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('22','country','Argentina','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('23','country','Bolivia','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('24','country','Bahamas, The','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('25','country','Burkina Faso','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('26','country','Ghana','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('27','country','Saudi Arabia','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('28','country','Cape Verde','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('29','country','Slovenia','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('30','country','Guatemala','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('31','country','Bosnia and Herzegovina','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('32','country','Guinea','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('33','country','Jordan','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('34','country','Congo, Rep.','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('35','country','Spain','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('36','country','Liberia','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('37','country','Netherlands','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('38','country','Jamaica','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('39','country','Oman','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('40','country','Tanzania','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('41','country','Albania','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('42','country','Gabon','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('43','country','Niue','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('44','country','New Zealand','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('45','country','Yemen','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('46','country','Pakistan','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('47','country','Greenland','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('48','country','Samoa','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('49','country','Slovak Republic','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('50','country','United Arab Emirates','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('51','country','Guam','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('52','country','Kosovo','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('53','country','India','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('54','country','Azerbaijan','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('55','country','Madagascar','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('56','country','Lesotho','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('57','country','Saint Vincent and the Grenadines','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('58','country','Kenya','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('59','country','South Korea','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('60','country','Belarus','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('61','country','Tajikistan','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('62','country','Turkey','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('63','country','Afghanistan','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('64','country','Bangladesh','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('65','country','Mauritania','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('66','country','Solomon Islands','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('67','country','Turks and Caicos Islands','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('68','country','Saint Lucia','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('69','country','Cyprus','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('70','country','French Polynesia','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('71','country','France','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('72','country','Bermuda','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('73','country','Namibia','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('74','country','Somalia','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('75','country','Peru','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('76','country','Laos','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('77','country','Nauru','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('78','country','Seychelles','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('79','country','Norway','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('80','country','Cote d''Ivoire','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('82','country','Cook Islands','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('83','country','Benin','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('84','country','Western Sahara','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('85','country','Cuba','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('86','country','Cameroon','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('87','country','Montenegro','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('88','country','Saint Kitts and Nevis','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('89','country','Togo','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('90','country','China','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('91','country','Armenia','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('92','country','Antigua and Barbuda','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('93','country','Dominican Republic','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('94','country','Ukraine','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('95','country','Bahrain','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('96','country','Tonga','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('97','country','Finland','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('98','country','Libya','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('99','country','Indonesia','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('100','country','Central African Republic','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('101','country','United States','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('102','country','Sweden','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('103','country','Vietnam','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('104','country','British Virgin Islands','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('105','country','Mali','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('106','country','Russia','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('107','country','Bulgaria','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('108','country','Mauritius','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('109','country','Romania','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('110','country','Angola','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('111','country','Portugal','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('112','country','South Africa','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('113','country','Fiji','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('114','country','Brunei Darussalam','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('115','country','Malaysia','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('116','country','Austria','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('117','country','Mozambique','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('118','country','Uganda','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('119','country','Kyrgyz Republic','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('120','country','Hungary','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('121','country','Niger','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('122','country','Brazil','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('123','country','Falkland Islands','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('124','country','Kuwait','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('125','country','Panama','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('126','country','Guyana','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('127','country','Costa Rica','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('128','country','Luxembourg','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('129','country','American Samoa','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('130','country','Gibraltar','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('131','country','Ireland','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('132','country','Nigeria','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('133','country','Ecuador','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('134','country','Czech Republic','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('135','country','Australia','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('136','country','Iran','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('137','country','Algeria','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('138','country','El Salvador','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('139','country','Saint Pierre and Miquelon','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('140','country','Chile','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('141','country','Puerto Rico','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('142','country','Belgium','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('143','country','Thailand','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('144','country','Haiti','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('145','country','Iraq','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('146','country','Sierra Leone','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('147','country','Georgia','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('148','country','Hong Kong (China)','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('149','country','Denmark','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('150','country','Poland','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('151','country','Moldova','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('152','country','Morocco','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('153','country','Croatia','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('154','country','Mongolia','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('155','country','Guinea-Bissau','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('156','country','Kiribati','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('157','country','Switzerland','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('158','country','Grenada','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('159','country','Belize','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('160','country','Chad','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('161','country','Estonia','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('162','country','Uruguay','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('163','country','Equatorial Guinea','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('164','country','Lebanon','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('165','country','Uzbekistan','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('166','country','Tunisia','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('167','country','Djibouti','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('168','country','Rwanda','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('169','country','Timor-Leste','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('170','country','Dominica','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('171','country','Colombia','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('172','country','Reunion','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('173','country','Burundi','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('174','country','Taiwan','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('175','country','Nicaragua','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('176','country','Barbados','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('177','country','Qatar','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('178','country','Congo, Dem. Rep.','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('179','country','Italy','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('180','country','Bhutan','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('181','country','Sudan','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('182','country','Nepal','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('183','country','Malta','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('184','country','Maldives','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('185','country','Suriname','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('186','country','Cayman Islands','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('187','country','Venezuela','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('188','country','Israel','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('189','country','Iceland','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('190','country','Zambia','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('191','country','Senegal','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('192','country','Papua New Guinea','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('193','country','Malawi','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('194','country','Macau (China)','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('195','country','Trinidad and Tobago','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('196','country','Zimbabwe','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('197','country','Germany','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('198','country','Vanuatu','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('199','country','Martinique','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('200','country','Kazakhstan','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('201','country','Philippines','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('202','country','Eritrea','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('203','country','Montserrat','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('204','country','New Caledonia','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('205','country','Macedonia','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('206','country','North Korea','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('207','country','Paraguay','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('208','country','Latvia','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('209','country','Japan','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('210','country','Syria','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('211','country','Honduras','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('212','country','Myanmar','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('213','country','Mexico','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('214','country','Egypt','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('215','country','Singapore','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('216','country','Serbia','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('217','country','Botswana','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('218','country','United Kingdom','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('219','country','Antarctica','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('220','country','Gambia, The','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('221','country','Greece','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('222','country','Sri Lanka','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('223','country','French Guiana','World'); +insert into iamc_nodes(id, hierarchy, name, parent) values ('224','country','Comoros','World'); diff --git a/ixmp/ixmp.jar b/ixmp/ixmp.jar index 85639d20d..56d7638f1 100644 Binary files a/ixmp/ixmp.jar and b/ixmp/ixmp.jar differ diff --git a/setup.py b/setup.py index 5c405f527..5f08d4c86 100644 --- a/setup.py +++ b/setup.py @@ -62,7 +62,7 @@ def main(): } lib_files = [x.split('ixmp/')[-1] for x in glob.glob('ixmp/lib/*')] db_files = [x.split('ixmp/')[-1] - for x in glob.glob('ixmp/db/migration/hsql/*')] + for x in glob.glob('ixmp/db/migration/*/*')] pack_data = { 'ixmp': [ 'ixmp.R', diff --git a/tests/test_core.py b/tests/test_core.py index b461f4335..76dfd3e1e 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -10,7 +10,7 @@ test_args = ('Douglas Adams', 'Hitchhiker') can_args = ('canning problem', 'standard') msg_args = ('canning problem (MESSAGE scheme)', 'standard') -aut_args = ('Austrian energy model', 'baseline') +msg_multiyear_args = ('canning problem (MESSAGE scheme)', 'multi-year') # string columns for timeseries checks cols_str = ['region', 'variable', 'unit', 'year'] @@ -80,34 +80,42 @@ def test_idx_name(test_mp): npt.assert_array_equal(df, ['i', 'j']) -def test_remote_unit_can(test_mp): - scen = test_mp.Scenario(*msg_args) - df = scen.par('bound_activity_up', - filters={'technology': ['canning_plant']}) - obs = df.loc[0, 'unit'] - exp = 'cases' - assert obs == exp - - -def test_remote_marginal(test_mp): +def test_var_marginal(test_mp): scen = test_mp.Scenario(*can_args) df = scen.var('x', filters={'i': ['seattle']}) npt.assert_array_almost_equal(df['mrg'], [0, 0, 0.036]) -def test_remote_level(test_mp): +def test_var_level(test_mp): scen = test_mp.Scenario(*can_args) df = scen.var('x', filters={'i': ['seattle']}) npt.assert_array_almost_equal(df['lvl'], [50, 300, 0]) -def test_remote_general_str(test_mp): +def test_var_general_str(test_mp): scen = test_mp.Scenario(*can_args) df = scen.var('x', filters={'i': ['seattle']}) npt.assert_array_equal( df['j'], ['new-york', 'chicago', 'topeka']) +def test_unit_list(test_mp): + units = test_mp.units() + assert ('cases' in units) is True + + +def test_add_unit(test_mp): + test_mp.add_unit('test', 'just testing') + + +def test_par_filters_unit(test_mp): + scen = test_mp.Scenario(*can_args) + df = scen.par('d', filters={'i': ['seattle']}) + obs = df.loc[0, 'unit'] + exp = 'km' + assert obs == exp + + def test_cat_all(test_mp): scen = test_mp.Scenario(*msg_args) df = scen.cat('technology', 'all') @@ -123,12 +131,12 @@ def test_add_cat(test_mp): ['transport_from_san-diego', 'transport_from_seattle']) df = scen2.cat('technology', 'trade') npt.assert_array_equal( - df, ['transport_from_san-diego', 'transport_from_seattle', ]) + df, ['transport_from_san-diego', 'transport_from_seattle']) scen2.discard_changes() def test_add_cat_unique(test_mp): - scen = test_mp.Scenario(*aut_args) + scen = test_mp.Scenario(*msg_multiyear_args) scen2 = scen.clone(keep_sol=False) scen2.check_out() scen2.add_cat('year', 'firstmodelyear', 2020, True) @@ -139,31 +147,23 @@ def test_add_cat_unique(test_mp): def test_years_active(test_mp): - scen = test_mp.Scenario(*aut_args) - df = scen.years_active('Austria', 'gas_ppl', '2020') - npt.assert_array_equal(df, [2020, 2030, 2040]) + scen = test_mp.Scenario(*msg_multiyear_args) + df = scen.years_active('seattle', 'canning_plant', '2020') + npt.assert_array_equal(df, [2020, 2030]) def test_years_active_extend(test_mp): - scen = test_mp.Scenario(*aut_args) + scen = test_mp.Scenario(*msg_multiyear_args) scen = scen.clone(keep_sol=False) scen.check_out() - scen.add_set('year', '2070') - scen.add_par('duration_period', '2070', 10, 'y') - df = scen.years_active('Austria', 'gas_ppl', '2050') - npt.assert_array_equal(df, [2050, 2060, 2070]) + scen.add_set('year', ['2040', '2050']) + scen.add_par('duration_period', '2040', 10, 'y') + scen.add_par('duration_period', '2050', 10, 'y') + df = scen.years_active('seattle', 'canning_plant', '2020') + npt.assert_array_equal(df, [2020, 2030, 2040]) scen.discard_changes() -def test_unit_list(test_mp): - units = test_mp.units() - assert ('cases' in units) is True - - -def test_add_unit(test_mp): - test_mp.add_unit('test', 'just testing') - - def test_new_timeseries(test_mp): scen = test_mp.TimeSeries(*test_args, version='new', annotation='testing') df = {'region': ['World'], 'variable': ['Testing'], 'unit': ['???'], diff --git a/tests/test_tutorials.py b/tests/test_tutorials.py index de6643fc4..0288b5406 100644 --- a/tests/test_tutorials.py +++ b/tests/test_tutorials.py @@ -2,7 +2,6 @@ import os import subprocess import sys -import tempfile import nbformat import pytest @@ -24,22 +23,24 @@ def _notebook_run(path, kernel=None): kernel = kernel or 'python{}'.format(major_version) dirname, __ = os.path.split(path) os.chdir(dirname) - with tempfile.NamedTemporaryFile(suffix=".ipynb") as fout: - args = [ - "jupyter", "nbconvert", "--to", "notebook", "--execute", - "--ExecutePreprocessor.timeout=60", - "--ExecutePreprocessor.kernel_name={}".format(kernel), - "--output", fout.name, path] - subprocess.check_call(args) + fname = os.path.join(here, 'test.ipynb') + args = [ + "jupyter", "nbconvert", "--to", "notebook", "--execute", + "--ExecutePreprocessor.timeout=60", + "--ExecutePreprocessor.kernel_name={}".format(kernel), + "--output", fname, path] + subprocess.check_call(args) - nb = nbformat.read(io.open(fout.name, encoding='utf-8'), - nbformat.current_nbformat) + nb = nbformat.read(io.open(fname, encoding='utf-8'), + nbformat.current_nbformat) errors = [ output for cell in nb.cells if "outputs" in cell for output in cell["outputs"] if output.output_type == "error" ] + os.remove(fname) + return nb, errors diff --git a/tests/testdb/ixmptest.lobs b/tests/testdb/ixmptest.lobs index df39059a3..f33ddd3e9 100644 Binary files a/tests/testdb/ixmptest.lobs and b/tests/testdb/ixmptest.lobs differ diff --git a/tests/testdb/ixmptest.script b/tests/testdb/ixmptest.script index 97b1a2b15..c50dd98d1 100644 --- a/tests/testdb/ixmptest.script +++ b/tests/testdb/ixmptest.script @@ -1,4 +1,4 @@ -SET DATABASE UNIQUE NAME HSQLDB602C6AF851 +SET DATABASE UNIQUE NAME HSQLDB614787FD65 SET DATABASE GC 0 SET DATABASE DEFAULT RESULT MEMORY ROWS 0 SET DATABASE EVENT LOG LEVEL 0 @@ -81,15 +81,15 @@ CREATE MEMORY TABLE PUBLIC.IX_EQU_BLOBSTORE(RUNID INTEGER NOT NULL,NAME VARCHAR( CREATE VIEW PUBLIC.RUN_OVERVIEW (ID,MODEL,SCENARIO,CRE_USER,CRE_DATE,UPD_USER,UPD_DATE,LOCK_USER,LOCK_DATE,SCHEME,STATUS,VERSION,ANNOTATION,ISDEFAULT) AS SELECT R.ID,M.NAME MODEL,S.NAME SCENARIO,R.CRE_USER,R.CRE_DATE,R.UPD_USER,R.UPD_DATE,R.LOCK_USER,R.LOCK_DATE,R.SCHEME,R.STATUS,R.VERSION VERSION,R.ANNOTATION,CASE CAST(D.ID AS BOOLEAN)WHEN TRUE THEN'True'ELSE' 'END ISDEFAULT FROM PUBLIC.RUN R INNER JOIN PUBLIC.MODEL M ON M.ID=R.MODEL_ID INNER JOIN PUBLIC.SCENARIO S ON S.ID=R.SCEN_ID LEFT JOIN PUBLIC.RUN_DEFAULT D ON(D.MODEL_ID=M.ID AND D.SCEN_ID=S.ID AND D.ID=R.ID)ORDER BY MODEL,SCENARIO,D.ID,VERSION DESC CREATE VIEW PUBLIC.IAMC_OVERVIEW (MODEL,SCENARIO,REGION,VARIABLE,UNIT,TIME,YEAR,VALUE,META,VERSION,ISDEFAULT) AS SELECT M.NAME,S.NAME,N.NAME,K.KEYSTRING,U.NAME,I.TIME,D.YEAR,D.VALUE,I.META,R.VERSION,CASE CAST(RD.ID AS BOOLEAN)WHEN TRUE THEN'True'ELSE' 'END ISDEFAULT FROM PUBLIC.IAMC_KEY K INNER JOIN PUBLIC.IX_UNIT U ON(U.ID=K.UNITID)INNER JOIN PUBLIC.IAMC_TSINFO I ON(I.KEY=K.KEYID)INNER JOIN PUBLIC.RUN R ON(R.ID=I.RUNID)LEFT JOIN PUBLIC.RUN_DEFAULT RD ON(RD.ID=R.ID)INNER JOIN PUBLIC.MODEL M ON M.ID=R.MODEL_ID INNER JOIN PUBLIC.SCENARIO S ON S.ID=R.SCEN_ID INNER JOIN PUBLIC.IAMC_NODES N ON(I.NODE=N.ID)INNER JOIN PUBLIC.IAMC_TSDATA D ON(I.TSID=D.TSID) ALTER TABLE PUBLIC.IAMC_TSDATA ADD FOREIGN KEY(TSID) REFERENCES PUBLIC.IAMC_TSINFO(TSID) ON DELETE CASCADE ON UPDATE CASCADE -ALTER SEQUENCE SYSTEM_LOBS.LOB_ID RESTART WITH 101 -ALTER SEQUENCE PUBLIC.ANNOTATION_SEQ RESTART WITH 11 +ALTER SEQUENCE SYSTEM_LOBS.LOB_ID RESTART WITH 64 +ALTER SEQUENCE PUBLIC.ANNOTATION_SEQ RESTART WITH 10 ALTER SEQUENCE PUBLIC.CHANGELOG_SEQ RESTART WITH 0 -ALTER SEQUENCE PUBLIC.IAMC_KEY_SEQ RESTART WITH 3 -ALTER SEQUENCE PUBLIC.MODEL_SEQ RESTART WITH 4 +ALTER SEQUENCE PUBLIC.IAMC_KEY_SEQ RESTART WITH 1 +ALTER SEQUENCE PUBLIC.MODEL_SEQ RESTART WITH 3 ALTER SEQUENCE PUBLIC.RUN_SEQ RESTART WITH 5 ALTER SEQUENCE PUBLIC.SCENARIO_SEQ RESTART WITH 3 -ALTER SEQUENCE PUBLIC.UNIT_SEQ RESTART WITH 102 -ALTER SEQUENCE PUBLIC.IAMC_TS_SEQ RESTART WITH 4 +ALTER SEQUENCE PUBLIC.UNIT_SEQ RESTART WITH 100 +ALTER SEQUENCE PUBLIC.IAMC_TS_SEQ RESTART WITH 2 SET DATABASE DEFAULT INITIAL SCHEMA PUBLIC GRANT USAGE ON DOMAIN INFORMATION_SCHEMA.SQL_IDENTIFIER TO PUBLIC GRANT USAGE ON DOMAIN INFORMATION_SCHEMA.YES_OR_NO TO PUBLIC @@ -98,7 +98,7 @@ GRANT USAGE ON DOMAIN INFORMATION_SCHEMA.CARDINAL_NUMBER TO PUBLIC GRANT USAGE ON DOMAIN INFORMATION_SCHEMA.CHARACTER_DATA TO PUBLIC GRANT DBA TO "ixmp" SET SCHEMA SYSTEM_LOBS -INSERT INTO BLOCKS VALUES(100,2147483547,0) +INSERT INTO BLOCKS VALUES(63,2147483584,0) INSERT INTO LOBS VALUES(0,1,0,1) INSERT INTO LOBS VALUES(1,1,0,2) INSERT INTO LOBS VALUES(2,1,0,3) @@ -162,43 +162,6 @@ INSERT INTO LOBS VALUES(59,1,0,60) INSERT INTO LOBS VALUES(60,1,0,61) INSERT INTO LOBS VALUES(61,1,0,62) INSERT INTO LOBS VALUES(62,1,0,63) -INSERT INTO LOBS VALUES(63,1,0,64) -INSERT INTO LOBS VALUES(64,1,0,65) -INSERT INTO LOBS VALUES(65,1,0,66) -INSERT INTO LOBS VALUES(66,1,0,67) -INSERT INTO LOBS VALUES(67,1,0,68) -INSERT INTO LOBS VALUES(68,1,0,69) -INSERT INTO LOBS VALUES(69,1,0,70) -INSERT INTO LOBS VALUES(70,1,0,71) -INSERT INTO LOBS VALUES(71,1,0,72) -INSERT INTO LOBS VALUES(72,1,0,73) -INSERT INTO LOBS VALUES(73,1,0,74) -INSERT INTO LOBS VALUES(74,1,0,75) -INSERT INTO LOBS VALUES(75,1,0,76) -INSERT INTO LOBS VALUES(76,1,0,77) -INSERT INTO LOBS VALUES(77,1,0,78) -INSERT INTO LOBS VALUES(78,1,0,79) -INSERT INTO LOBS VALUES(79,1,0,80) -INSERT INTO LOBS VALUES(80,1,0,81) -INSERT INTO LOBS VALUES(81,1,0,82) -INSERT INTO LOBS VALUES(82,1,0,83) -INSERT INTO LOBS VALUES(83,1,0,84) -INSERT INTO LOBS VALUES(84,1,0,85) -INSERT INTO LOBS VALUES(85,1,0,86) -INSERT INTO LOBS VALUES(86,1,0,87) -INSERT INTO LOBS VALUES(87,1,0,88) -INSERT INTO LOBS VALUES(88,1,0,89) -INSERT INTO LOBS VALUES(89,1,0,90) -INSERT INTO LOBS VALUES(90,1,0,91) -INSERT INTO LOBS VALUES(91,1,0,92) -INSERT INTO LOBS VALUES(92,1,0,93) -INSERT INTO LOBS VALUES(93,1,0,94) -INSERT INTO LOBS VALUES(94,1,0,95) -INSERT INTO LOBS VALUES(95,1,0,96) -INSERT INTO LOBS VALUES(96,1,0,97) -INSERT INTO LOBS VALUES(97,1,0,98) -INSERT INTO LOBS VALUES(98,1,0,99) -INSERT INTO LOBS VALUES(99,1,0,100) INSERT INTO LOB_IDS VALUES(1,369,1,30) INSERT INTO LOB_IDS VALUES(2,379,1,30) INSERT INTO LOB_IDS VALUES(3,412,1,30) @@ -208,172 +171,119 @@ INSERT INTO LOB_IDS VALUES(6,390,1,30) INSERT INTO LOB_IDS VALUES(7,395,1,30) INSERT INTO LOB_IDS VALUES(8,496,1,30) INSERT INTO LOB_IDS VALUES(9,456,1,30) -INSERT INTO LOB_IDS VALUES(10,400,0,30) -INSERT INTO LOB_IDS VALUES(11,370,0,30) -INSERT INTO LOB_IDS VALUES(12,436,0,30) -INSERT INTO LOB_IDS VALUES(13,357,0,30) -INSERT INTO LOB_IDS VALUES(14,378,0,30) -INSERT INTO LOB_IDS VALUES(15,355,0,30) -INSERT INTO LOB_IDS VALUES(16,355,0,30) -INSERT INTO LOB_IDS VALUES(17,355,0,30) -INSERT INTO LOB_IDS VALUES(18,354,0,30) -INSERT INTO LOB_IDS VALUES(19,426,0,30) -INSERT INTO LOB_IDS VALUES(20,356,0,30) -INSERT INTO LOB_IDS VALUES(21,354,0,30) -INSERT INTO LOB_IDS VALUES(22,382,0,30) -INSERT INTO LOB_IDS VALUES(23,379,0,30) -INSERT INTO LOB_IDS VALUES(24,360,1,30) -INSERT INTO LOB_IDS VALUES(25,392,1,30) -INSERT INTO LOB_IDS VALUES(26,359,1,30) -INSERT INTO LOB_IDS VALUES(27,361,1,30) -INSERT INTO LOB_IDS VALUES(28,469,1,30) -INSERT INTO LOB_IDS VALUES(29,360,1,30) -INSERT INTO LOB_IDS VALUES(30,633,1,30) -INSERT INTO LOB_IDS VALUES(31,792,1,30) -INSERT INTO LOB_IDS VALUES(32,1594,1,30) -INSERT INTO LOB_IDS VALUES(33,847,1,30) -INSERT INTO LOB_IDS VALUES(34,1345,1,30) -INSERT INTO LOB_IDS VALUES(35,1160,1,30) -INSERT INTO LOB_IDS VALUES(36,2045,1,30) -INSERT INTO LOB_IDS VALUES(37,1034,1,30) -INSERT INTO LOB_IDS VALUES(38,540,1,30) -INSERT INTO LOB_IDS VALUES(39,692,1,30) -INSERT INTO LOB_IDS VALUES(40,570,1,30) -INSERT INTO LOB_IDS VALUES(41,551,1,30) -INSERT INTO LOB_IDS VALUES(42,709,1,30) -INSERT INTO LOB_IDS VALUES(43,882,1,30) -INSERT INTO LOB_IDS VALUES(44,444,0,30) -INSERT INTO LOB_IDS VALUES(45,389,1,30) -INSERT INTO LOB_IDS VALUES(46,445,1,30) -INSERT INTO LOB_IDS VALUES(47,400,0,30) -INSERT INTO LOB_IDS VALUES(48,370,0,30) -INSERT INTO LOB_IDS VALUES(49,436,0,30) -INSERT INTO LOB_IDS VALUES(50,357,0,30) -INSERT INTO LOB_IDS VALUES(51,378,0,30) -INSERT INTO LOB_IDS VALUES(52,355,0,30) -INSERT INTO LOB_IDS VALUES(53,355,0,30) -INSERT INTO LOB_IDS VALUES(54,355,0,30) -INSERT INTO LOB_IDS VALUES(55,354,0,30) -INSERT INTO LOB_IDS VALUES(56,426,0,30) -INSERT INTO LOB_IDS VALUES(57,356,0,30) -INSERT INTO LOB_IDS VALUES(58,354,0,30) -INSERT INTO LOB_IDS VALUES(59,382,0,30) -INSERT INTO LOB_IDS VALUES(60,379,0,30) -INSERT INTO LOB_IDS VALUES(61,444,1,30) -INSERT INTO LOB_IDS VALUES(62,400,1,30) -INSERT INTO LOB_IDS VALUES(63,370,1,30) -INSERT INTO LOB_IDS VALUES(64,436,1,30) -INSERT INTO LOB_IDS VALUES(65,357,1,30) -INSERT INTO LOB_IDS VALUES(66,378,1,30) -INSERT INTO LOB_IDS VALUES(67,355,1,30) -INSERT INTO LOB_IDS VALUES(68,355,1,30) -INSERT INTO LOB_IDS VALUES(69,355,1,30) -INSERT INTO LOB_IDS VALUES(70,354,1,30) -INSERT INTO LOB_IDS VALUES(71,426,1,30) -INSERT INTO LOB_IDS VALUES(72,356,1,30) -INSERT INTO LOB_IDS VALUES(73,354,1,30) -INSERT INTO LOB_IDS VALUES(74,382,1,30) -INSERT INTO LOB_IDS VALUES(75,379,1,30) -INSERT INTO LOB_IDS VALUES(76,354,1,30) -INSERT INTO LOB_IDS VALUES(77,399,1,30) -INSERT INTO LOB_IDS VALUES(78,381,1,30) -INSERT INTO LOB_IDS VALUES(79,378,1,30) -INSERT INTO LOB_IDS VALUES(80,355,1,30) -INSERT INTO LOB_IDS VALUES(81,355,1,30) -INSERT INTO LOB_IDS VALUES(82,355,1,30) -INSERT INTO LOB_IDS VALUES(83,354,1,30) -INSERT INTO LOB_IDS VALUES(84,394,1,30) -INSERT INTO LOB_IDS VALUES(85,390,1,30) -INSERT INTO LOB_IDS VALUES(86,372,1,30) -INSERT INTO LOB_IDS VALUES(87,355,1,30) -INSERT INTO LOB_IDS VALUES(88,404,1,30) -INSERT INTO LOB_IDS VALUES(89,451,1,30) -INSERT INTO LOB_IDS VALUES(90,359,1,30) -INSERT INTO LOB_IDS VALUES(91,360,1,30) -INSERT INTO LOB_IDS VALUES(92,387,1,30) -INSERT INTO LOB_IDS VALUES(93,449,1,30) -INSERT INTO LOB_IDS VALUES(94,521,1,30) -INSERT INTO LOB_IDS VALUES(95,550,1,30) -INSERT INTO LOB_IDS VALUES(96,507,1,30) -INSERT INTO LOB_IDS VALUES(97,437,1,30) -INSERT INTO LOB_IDS VALUES(98,387,1,30) -INSERT INTO LOB_IDS VALUES(99,389,1,30) -INSERT INTO LOB_IDS VALUES(100,436,1,30) +INSERT INTO LOB_IDS VALUES(10,354,1,30) +INSERT INTO LOB_IDS VALUES(11,399,1,30) +INSERT INTO LOB_IDS VALUES(12,381,1,30) +INSERT INTO LOB_IDS VALUES(13,378,1,30) +INSERT INTO LOB_IDS VALUES(14,355,1,30) +INSERT INTO LOB_IDS VALUES(15,355,1,30) +INSERT INTO LOB_IDS VALUES(16,355,1,30) +INSERT INTO LOB_IDS VALUES(17,354,1,30) +INSERT INTO LOB_IDS VALUES(18,394,1,30) +INSERT INTO LOB_IDS VALUES(19,390,1,30) +INSERT INTO LOB_IDS VALUES(20,372,1,30) +INSERT INTO LOB_IDS VALUES(21,355,1,30) +INSERT INTO LOB_IDS VALUES(22,404,2,30) +INSERT INTO LOB_IDS VALUES(23,451,2,30) +INSERT INTO LOB_IDS VALUES(24,359,2,30) +INSERT INTO LOB_IDS VALUES(25,360,2,30) +INSERT INTO LOB_IDS VALUES(26,387,1,30) +INSERT INTO LOB_IDS VALUES(27,449,2,30) +INSERT INTO LOB_IDS VALUES(28,521,2,30) +INSERT INTO LOB_IDS VALUES(29,550,2,30) +INSERT INTO LOB_IDS VALUES(30,507,2,30) +INSERT INTO LOB_IDS VALUES(31,437,2,30) +INSERT INTO LOB_IDS VALUES(32,387,1,30) +INSERT INTO LOB_IDS VALUES(33,389,2,30) +INSERT INTO LOB_IDS VALUES(34,436,2,30) +INSERT INTO LOB_IDS VALUES(35,354,0,30) +INSERT INTO LOB_IDS VALUES(36,399,0,30) +INSERT INTO LOB_IDS VALUES(37,381,0,30) +INSERT INTO LOB_IDS VALUES(38,378,0,30) +INSERT INTO LOB_IDS VALUES(39,355,0,30) +INSERT INTO LOB_IDS VALUES(40,355,0,30) +INSERT INTO LOB_IDS VALUES(41,355,0,30) +INSERT INTO LOB_IDS VALUES(42,354,0,30) +INSERT INTO LOB_IDS VALUES(43,394,0,30) +INSERT INTO LOB_IDS VALUES(44,390,0,30) +INSERT INTO LOB_IDS VALUES(45,372,0,30) +INSERT INTO LOB_IDS VALUES(46,355,0,30) +INSERT INTO LOB_IDS VALUES(47,381,0,30) +INSERT INTO LOB_IDS VALUES(48,399,1,30) +INSERT INTO LOB_IDS VALUES(49,381,1,30) +INSERT INTO LOB_IDS VALUES(50,378,1,30) +INSERT INTO LOB_IDS VALUES(51,355,1,30) +INSERT INTO LOB_IDS VALUES(52,355,1,30) +INSERT INTO LOB_IDS VALUES(53,355,1,30) +INSERT INTO LOB_IDS VALUES(54,354,1,30) +INSERT INTO LOB_IDS VALUES(55,408,0,30) +INSERT INTO LOB_IDS VALUES(56,390,1,30) +INSERT INTO LOB_IDS VALUES(57,372,1,30) +INSERT INTO LOB_IDS VALUES(58,355,1,30) +INSERT INTO LOB_IDS VALUES(59,424,1,30) +INSERT INTO LOB_IDS VALUES(60,394,1,30) +INSERT INTO LOB_IDS VALUES(61,424,1,30) +INSERT INTO LOB_IDS VALUES(62,381,1,30) +INSERT INTO LOB_IDS VALUES(63,408,1,30) SET SCHEMA PUBLIC -INSERT INTO "schema_version" VALUES(1,'1','hsql base version','SQL','V1__hsql_base_version.sql',1588531206,'ixmp','2017-12-06 16:21:40.602000',82,'1') -INSERT INTO "schema_version" VALUES(2,'1.1','drop schema config','SQL','V1.1__drop_schema_config.sql',-371554450,'ixmp','2017-12-06 16:21:40.611000',0,'1') +INSERT INTO "schema_version" VALUES(1,'1','hsql base version','SQL','V1__hsql_base_version.sql',1588531206,'ixmp','2018-01-30 15:45:50.561000',99,'1') +INSERT INTO "schema_version" VALUES(2,'1.1','drop schema config','SQL','V1.1__drop_schema_config.sql',-371554450,'ixmp','2018-01-30 15:45:50.571000',0,'1') INSERT INTO APP_USER VALUES('admin','pMuy85M8UBbafoP9E1q4pItnv2E=',NULL,'Administrator',NULL,NULL,NULL,NULL) INSERT INTO MODEL VALUES(0,'Douglas Adams') INSERT INTO MODEL VALUES(1,'canning problem') -INSERT INTO MODEL VALUES(2,'Austrian energy model') -INSERT INTO MODEL VALUES(3,'canning problem (MESSAGE scheme)') +INSERT INTO MODEL VALUES(2,'canning problem (MESSAGE scheme)') INSERT INTO SCENARIO VALUES(0,'Hitchhiker') INSERT INTO SCENARIO VALUES(1,'standard') -INSERT INTO SCENARIO VALUES(2,'baseline') -INSERT INTO RUN VALUES(0,0,0,'huppmann','2017-12-06 16:21:41.000000',NULL,NULL,NULL,1,1,NULL,NULL,NULL,'testing') -INSERT INTO RUN VALUES(1,1,1,'huppmann','2017-12-06 16:21:43.000000',NULL,NULL,NULL,1,1,NULL,NULL,0,'Dantzig''s transportation problem for illustration and testing') -INSERT INTO RUN VALUES(2,1,1,'huppmann','2017-12-06 16:21:45.000000','huppmann','2017-12-06 16:21:45.000000',NULL,1,2,NULL,NULL,26,'Dantzig''s transportation problem for illustration and testing') -INSERT INTO RUN VALUES(3,2,2,'huppmann','2017-12-06 16:21:50.000000',NULL,NULL,'MESSAGE',1,1,NULL,NULL,1262,'developing a stylized energy system model for Austria') -INSERT INTO RUN VALUES(4,3,1,'huppmann','2017-12-06 16:21:54.000000',NULL,NULL,'MESSAGE',1,1,NULL,NULL,206,'Dantzig''s canning problem as a MESSAGE-scheme ixmp.Scenario') +INSERT INTO SCENARIO VALUES(2,'multi-year') +INSERT INTO RUN VALUES(0,0,0,'huppmann','2018-01-30 15:45:50.000000',NULL,NULL,NULL,1,1,NULL,NULL,NULL,'testing') +INSERT INTO RUN VALUES(1,1,1,'huppmann','2018-01-30 15:45:51.000000',NULL,NULL,NULL,1,1,NULL,NULL,0,'this is an empty scenario') +INSERT INTO RUN VALUES(2,1,1,'huppmann','2018-01-30 15:45:52.000000','huppmann','2018-01-30 15:45:52.000000',NULL,1,2,NULL,NULL,26,'importing Dantzig''s transport problem for illustration and testing of the Python interface using a generic ixmp.Scenario') +INSERT INTO RUN VALUES(3,2,1,'huppmann','2018-01-30 15:45:53.000000',NULL,NULL,'MESSAGE',1,1,NULL,NULL,206,'importing a MESSAGE-scheme version of the transport problem') +INSERT INTO RUN VALUES(4,2,2,'huppmann','2018-01-30 15:45:54.000000',NULL,NULL,'MESSAGE',1,1,NULL,NULL,344,'clone Scenario from ''canning problem (MESSAGE scheme)|standard'', version: 1') INSERT INTO RUN_DEFAULT VALUES(0,0,0) INSERT INTO RUN_DEFAULT VALUES(1,1,2) -INSERT INTO RUN_DEFAULT VALUES(2,2,3) -INSERT INTO RUN_DEFAULT VALUES(3,1,4) -INSERT INTO ANNOTATION_LOG VALUES(0,'ok',0,'save new TimeSeries','huppmann','2017-12-06 16:21:41.000000',NULL,NULL,'importing a testing timeseries','Python') -INSERT INTO ANNOTATION_LOG VALUES(1,'ok',0,'set as default','huppmann','2017-12-06 16:21:41.000000',NULL,NULL,'previous default: -1','Python') -INSERT INTO ANNOTATION_LOG VALUES(2,'ok',1,'save new Scenaio','huppmann','2017-12-06 16:21:43.000000',NULL,NULL,'this is an empty scenario','Python') -INSERT INTO ANNOTATION_LOG VALUES(3,'ok',2,'save new Scenaio','huppmann','2017-12-06 16:21:45.000000',NULL,NULL,'importing Dantzig''s transport problem for illustration and testing of the Python interface using a generic ixmp.Scenario','Python') -INSERT INTO ANNOTATION_LOG VALUES(4,'ok',2,'set as default','huppmann','2017-12-06 16:21:45.000000',NULL,NULL,'previous default: -1','Python') -INSERT INTO ANNOTATION_LOG VALUES(5,'ok',2,'import solution from GDX','huppmann','2017-12-06 16:21:45.000000',NULL,NULL,'source file: ''./C:\Users\huppmann\Documents\GitHub\ixmp\tests\transport_ixmp.gms_out.gdx''','Python') -INSERT INTO ANNOTATION_LOG VALUES(6,'ok',3,'save new Scenaio','huppmann','2017-12-06 16:21:50.000000',NULL,NULL,'initial commit for Austria model','Python') -INSERT INTO ANNOTATION_LOG VALUES(7,'ok',3,'set as default','huppmann','2017-12-06 16:21:50.000000',NULL,NULL,'previous default: -1','Python') -INSERT INTO ANNOTATION_LOG VALUES(8,'ok',3,'commit changes to Scenario','huppmann','2017-12-06 16:21:51.000000',NULL,NULL,'add timeseries meta data (gdp) and demand','Python') -INSERT INTO ANNOTATION_LOG VALUES(9,'ok',4,'save new Scenaio','huppmann','2017-12-06 16:21:54.000000',NULL,NULL,'importing a MESSAGE-scheme version of the transport problem','Python') -INSERT INTO ANNOTATION_LOG VALUES(10,'ok',4,'set as default','huppmann','2017-12-06 16:21:54.000000',NULL,NULL,'previous default: -1','Python') +INSERT INTO RUN_DEFAULT VALUES(2,1,3) +INSERT INTO ANNOTATION_LOG VALUES(0,'ok',0,'save new TimeSeries','huppmann','2018-01-30 15:45:50.000000',NULL,NULL,'importing a testing timeseries','Python') +INSERT INTO ANNOTATION_LOG VALUES(1,'ok',0,'set as default','huppmann','2018-01-30 15:45:50.000000',NULL,NULL,'previous default: -1','Python') +INSERT INTO ANNOTATION_LOG VALUES(2,'ok',1,'save new Scenaio','huppmann','2018-01-30 15:45:51.000000',NULL,NULL,'this is an empty scenario','Python') +INSERT INTO ANNOTATION_LOG VALUES(3,'ok',2,'save new Scenaio','huppmann','2018-01-30 15:45:52.000000',NULL,NULL,'importing Dantzig''s transport problem for illustration and testing of the Python interface using a generic ixmp.Scenario','Python') +INSERT INTO ANNOTATION_LOG VALUES(4,'ok',2,'set as default','huppmann','2018-01-30 15:45:52.000000',NULL,NULL,'previous default: -1','Python') +INSERT INTO ANNOTATION_LOG VALUES(5,'ok',2,'import solution from GDX','huppmann','2018-01-30 15:45:52.000000',NULL,NULL,'source file: ''C:\Users\huppmann\Documents\GitHub\ixmp\tests/transport_ixmp_out.gdx''','Python') +INSERT INTO ANNOTATION_LOG VALUES(6,'ok',3,'save new Scenaio','huppmann','2018-01-30 15:45:54.000000',NULL,NULL,'importing a MESSAGE-scheme version of the transport problem','Python') +INSERT INTO ANNOTATION_LOG VALUES(7,'ok',3,'set as default','huppmann','2018-01-30 15:45:54.000000',NULL,NULL,'previous default: -1','Python') +INSERT INTO ANNOTATION_LOG VALUES(8,'ok',4,'save new Scenaio','huppmann','2018-01-30 15:45:54.000000',NULL,NULL,'clone Scenario from ''canning problem (MESSAGE scheme)|standard'', version: 1','Python') +INSERT INTO ANNOTATION_LOG VALUES(9,'ok',4,'commit changes to Scenario','huppmann','2018-01-30 15:45:55.000000',NULL,NULL,'adding years and technical lifetime to one technology','Python') INSERT INTO CHANGE_LOG VALUES(5,2,'import a scalar for variable','z',NULL,NULL,NULL,NULL) INSERT INTO CHANGE_LOG VALUES(5,2,'import 6 elements for variable','x',NULL,NULL,NULL,NULL) INSERT INTO CHANGE_LOG VALUES(5,2,'import 3 elements for equation','demand',NULL,NULL,NULL,NULL) -INSERT INTO CHANGE_LOG VALUES(8,3,'add timeseries entry','GDP','Austria|2010',NULL,1.0E0,NULL) -INSERT INTO CHANGE_LOG VALUES(8,3,'add timeseries entry','GDP','Austria|2020',NULL,1.2163E0,NULL) -INSERT INTO CHANGE_LOG VALUES(8,3,'add timeseries entry','GDP','Austria|2030',NULL,1.4108E0,NULL) -INSERT INTO CHANGE_LOG VALUES(8,3,'add timeseries entry','GDP','Austria|2040',NULL,1.63746E0,NULL) -INSERT INTO CHANGE_LOG VALUES(8,3,'add timeseries entry','GDP','Austria|2050',NULL,1.89083E0,NULL) -INSERT INTO CHANGE_LOG VALUES(8,3,'add timeseries entry','GDP','Austria|2060',NULL,2.1447E0,NULL) -INSERT INTO CHANGE_LOG VALUES(8,3,'add timeseries entry','Demand','Austria|2010',NULL,1.0E0,NULL) -INSERT INTO CHANGE_LOG VALUES(8,3,'add timeseries entry','Demand','Austria|2020',NULL,1.1469077693118388E0,NULL) -INSERT INTO CHANGE_LOG VALUES(8,3,'add timeseries entry','Demand','Austria|2030',NULL,1.272406314520768E0,NULL) -INSERT INTO CHANGE_LOG VALUES(8,3,'add timeseries entry','Demand','Austria|2040',NULL,1.4122757106694739E0,NULL) -INSERT INTO CHANGE_LOG VALUES(8,3,'add timeseries entry','Demand','Austria|2050',NULL,1.561912638002852E0,NULL) -INSERT INTO CHANGE_LOG VALUES(8,3,'add timeseries entry','Demand','Austria|2060',NULL,1.7059118509571376E0,NULL) -INSERT INTO IX_UNIT VALUES(-1,'???',NULL,'2017-12-06 16:21:40.561000',NULL) -INSERT INTO IX_UNIT VALUES(0,'y',NULL,'2017-12-06 16:21:40.561000',NULL) -INSERT INTO IX_UNIT VALUES(1,'%',NULL,'2017-12-06 16:21:40.562000',NULL) -INSERT INTO IX_UNIT VALUES(2,'GWa',NULL,'2017-12-06 16:21:40.562000',NULL) -INSERT INTO IX_UNIT VALUES(3,'USD/GWa',NULL,'2017-12-06 16:21:40.562000',NULL) -INSERT INTO IX_UNIT VALUES(4,'kg/kWa',NULL,'2017-12-06 16:21:40.562000',NULL) -INSERT INTO IX_UNIT VALUES(5,'kg',NULL,'2017-12-06 16:21:40.562000',NULL) -INSERT INTO IX_UNIT VALUES(6,'USD/kg',NULL,'2017-12-06 16:21:40.563000',NULL) -INSERT INTO IX_UNIT VALUES(7,'USD',NULL,'2017-12-06 16:21:40.563000',NULL) -INSERT INTO IX_UNIT VALUES(8,'cases',NULL,'2017-12-06 16:21:40.563000',NULL) -INSERT INTO IX_UNIT VALUES(9,'km',NULL,'2017-12-06 16:21:40.563000',NULL) -INSERT INTO IX_UNIT VALUES(10,'USD/km',NULL,'2017-12-06 16:21:40.564000',NULL) -INSERT INTO IX_UNIT VALUES(11,'GW',NULL,'2017-12-06 16:21:40.564000',NULL) -INSERT INTO IX_UNIT VALUES(12,'G$',NULL,'2017-12-06 16:21:40.564000',NULL) -INSERT INTO IX_UNIT VALUES(13,'T$',NULL,'2017-12-06 16:21:40.564000',NULL) -INSERT INTO IX_UNIT VALUES(14,'-',NULL,'2017-12-06 16:21:40.565000',NULL) -INSERT INTO IX_UNIT VALUES(15,'USD/kWa',NULL,'2017-12-06 16:21:40.565000',NULL) -INSERT INTO IX_UNIT VALUES(16,'MW',NULL,'2017-12-06 16:21:40.565000',NULL) -INSERT INTO IX_UNIT VALUES(17,'MWa',NULL,'2017-12-06 16:21:40.565000',NULL) -INSERT INTO IX_UNIT VALUES(18,'USD/tC',NULL,'2017-12-06 16:21:40.566000',NULL) -INSERT INTO IX_UNIT VALUES(19,'USD/tCO2',NULL,'2017-12-06 16:21:40.566000',NULL) -INSERT INTO IX_UNIT VALUES(20,'t',NULL,'2017-12-06 16:21:40.566000',NULL) -INSERT INTO IX_UNIT VALUES(21,'tC',NULL,'2017-12-06 16:21:40.566000',NULL) -INSERT INTO IX_UNIT VALUES(22,'tCO2',NULL,'2017-12-06 16:21:40.567000',NULL) -INSERT INTO IX_UNIT VALUES(100,'million USD','huppmann','2017-12-06 16:21:50.000000','Austrian energy model') -INSERT INTO IX_UNIT VALUES(101,'GWa/y','huppmann','2017-12-06 16:21:50.000000','Austrian energy model') -INSERT INTO IAMC_KEY VALUES(0,'Testing',-1,'huppmann','2017-12-06 16:21:41.000000','Douglas Adams') -INSERT INTO IAMC_KEY VALUES(1,'GDP',100,'huppmann','2017-12-06 16:21:50.000000','Austrian energy model') -INSERT INTO IAMC_KEY VALUES(2,'Demand',101,'huppmann','2017-12-06 16:21:50.000000','Austrian energy model') +INSERT INTO CHANGE_LOG VALUES(9,4,'add index set element','year','2020',NULL,NULL,NULL) +INSERT INTO CHANGE_LOG VALUES(9,4,'add index set element','year','2030',NULL,NULL,NULL) +INSERT INTO CHANGE_LOG VALUES(9,4,'add parameter element','technical_lifetime','seattle.canning_plant.2020',NULL,30.0E0,NULL) +INSERT INTO IX_UNIT VALUES(-1,'???',NULL,'2018-01-30 15:45:50.513000',NULL) +INSERT INTO IX_UNIT VALUES(0,'y',NULL,'2018-01-30 15:45:50.513000',NULL) +INSERT INTO IX_UNIT VALUES(1,'%',NULL,'2018-01-30 15:45:50.513000',NULL) +INSERT INTO IX_UNIT VALUES(2,'GWa',NULL,'2018-01-30 15:45:50.514000',NULL) +INSERT INTO IX_UNIT VALUES(3,'USD/GWa',NULL,'2018-01-30 15:45:50.514000',NULL) +INSERT INTO IX_UNIT VALUES(4,'kg/kWa',NULL,'2018-01-30 15:45:50.514000',NULL) +INSERT INTO IX_UNIT VALUES(5,'kg',NULL,'2018-01-30 15:45:50.515000',NULL) +INSERT INTO IX_UNIT VALUES(6,'USD/kg',NULL,'2018-01-30 15:45:50.515000',NULL) +INSERT INTO IX_UNIT VALUES(7,'USD',NULL,'2018-01-30 15:45:50.515000',NULL) +INSERT INTO IX_UNIT VALUES(8,'cases',NULL,'2018-01-30 15:45:50.515000',NULL) +INSERT INTO IX_UNIT VALUES(9,'km',NULL,'2018-01-30 15:45:50.516000',NULL) +INSERT INTO IX_UNIT VALUES(10,'USD/km',NULL,'2018-01-30 15:45:50.516000',NULL) +INSERT INTO IX_UNIT VALUES(11,'GW',NULL,'2018-01-30 15:45:50.516000',NULL) +INSERT INTO IX_UNIT VALUES(12,'G$',NULL,'2018-01-30 15:45:50.517000',NULL) +INSERT INTO IX_UNIT VALUES(13,'T$',NULL,'2018-01-30 15:45:50.517000',NULL) +INSERT INTO IX_UNIT VALUES(14,'-',NULL,'2018-01-30 15:45:50.517000',NULL) +INSERT INTO IX_UNIT VALUES(15,'USD/kWa',NULL,'2018-01-30 15:45:50.517000',NULL) +INSERT INTO IX_UNIT VALUES(16,'MW',NULL,'2018-01-30 15:45:50.518000',NULL) +INSERT INTO IX_UNIT VALUES(17,'MWa',NULL,'2018-01-30 15:45:50.518000',NULL) +INSERT INTO IX_UNIT VALUES(18,'USD/tC',NULL,'2018-01-30 15:45:50.518000',NULL) +INSERT INTO IX_UNIT VALUES(19,'USD/tCO2',NULL,'2018-01-30 15:45:50.518000',NULL) +INSERT INTO IX_UNIT VALUES(20,'t',NULL,'2018-01-30 15:45:50.519000',NULL) +INSERT INTO IX_UNIT VALUES(21,'tC',NULL,'2018-01-30 15:45:50.519000',NULL) +INSERT INTO IX_UNIT VALUES(22,'tCO2',NULL,'2018-01-30 15:45:50.519000',NULL) +INSERT INTO IAMC_KEY VALUES(0,'Testing',-1,'huppmann','2018-01-30 15:45:50.000000','Douglas Adams') INSERT INTO IAMC_NODES VALUES(0,'global','World','World') INSERT INTO IAMC_NODES VALUES(1,'region (R11)','North America (R11)','World') INSERT INTO IAMC_NODES VALUES(2,'region (R11)','Latin America (R11)','World') @@ -601,22 +511,8 @@ INSERT INTO IAMC_NODES VALUES(224,'country','Comoros','World') INSERT INTO IAMC_TSDATA VALUES(0,2010,23.7E0) INSERT INTO IAMC_TSDATA VALUES(0,2020,23.8E0) INSERT INTO IAMC_TSDATA VALUES(1,2010,23.7E0) -INSERT INTO IAMC_TSDATA VALUES(2,2010,1.0E0) -INSERT INTO IAMC_TSDATA VALUES(2,2020,1.2163E0) -INSERT INTO IAMC_TSDATA VALUES(2,2030,1.4108E0) -INSERT INTO IAMC_TSDATA VALUES(2,2040,1.63746E0) -INSERT INTO IAMC_TSDATA VALUES(2,2050,1.89083E0) -INSERT INTO IAMC_TSDATA VALUES(2,2060,2.1447E0) -INSERT INTO IAMC_TSDATA VALUES(3,2010,1.0E0) -INSERT INTO IAMC_TSDATA VALUES(3,2020,1.1469077693118388E0) -INSERT INTO IAMC_TSDATA VALUES(3,2030,1.272406314520768E0) -INSERT INTO IAMC_TSDATA VALUES(3,2040,1.4122757106694739E0) -INSERT INTO IAMC_TSDATA VALUES(3,2050,1.561912638002852E0) -INSERT INTO IAMC_TSDATA VALUES(3,2060,1.7059118509571376E0) INSERT INTO IAMC_TSINFO VALUES(0,0,0,0,-1,0) INSERT INTO IAMC_TSINFO VALUES(1,2,0,0,-1,0) -INSERT INTO IAMC_TSINFO VALUES(2,3,116,1,-1,1) -INSERT INTO IAMC_TSINFO VALUES(3,3,116,2,-1,0) INSERT INTO IX_KEY VALUES(1,0,'scalar') INSERT INTO IX_KEY VALUES(2,0,'scalar') INSERT INTO IX_KEY VALUES(2,1,'seattle') @@ -634,35 +530,23 @@ INSERT INTO IX_KEY VALUES(3,6,'initializeyear_macro') INSERT INTO IX_KEY VALUES(3,7,'economy') INSERT INTO IX_KEY VALUES(3,8,'all') INSERT INTO IX_KEY VALUES(3,9,'2010') -INSERT INTO IX_KEY VALUES(3,10,'2020') -INSERT INTO IX_KEY VALUES(3,11,'2030') -INSERT INTO IX_KEY VALUES(3,12,'2040') -INSERT INTO IX_KEY VALUES(3,13,'2050') -INSERT INTO IX_KEY VALUES(3,14,'2060') -INSERT INTO IX_KEY VALUES(3,15,'Austria') -INSERT INTO IX_KEY VALUES(3,16,'country') -INSERT INTO IX_KEY VALUES(3,17,'standard') -INSERT INTO IX_KEY VALUES(3,18,'electricity') -INSERT INTO IX_KEY VALUES(3,19,'light') -INSERT INTO IX_KEY VALUES(3,20,'other_electricity') -INSERT INTO IX_KEY VALUES(3,21,'secondary') -INSERT INTO IX_KEY VALUES(3,22,'final') -INSERT INTO IX_KEY VALUES(3,23,'useful') -INSERT INTO IX_KEY VALUES(3,24,'coal_ppl') -INSERT INTO IX_KEY VALUES(3,25,'gas_ppl') -INSERT INTO IX_KEY VALUES(3,26,'oil_ppl') -INSERT INTO IX_KEY VALUES(3,27,'bio_ppl') -INSERT INTO IX_KEY VALUES(3,28,'hydro_ppl') -INSERT INTO IX_KEY VALUES(3,29,'wind_ppl') -INSERT INTO IX_KEY VALUES(3,30,'solar_pv_ppl') -INSERT INTO IX_KEY VALUES(3,31,'import') -INSERT INTO IX_KEY VALUES(3,32,'electricity_grid') -INSERT INTO IX_KEY VALUES(3,33,'bulb') -INSERT INTO IX_KEY VALUES(3,34,'cfl') -INSERT INTO IX_KEY VALUES(3,35,'appliances') -INSERT INTO IX_KEY VALUES(3,36,'CO2') -INSERT INTO IX_KEY VALUES(3,37,'GHGs') -INSERT INTO IX_KEY VALUES(3,38,'cumulative') +INSERT INTO IX_KEY VALUES(3,10,'seattle') +INSERT INTO IX_KEY VALUES(3,11,'san-diego') +INSERT INTO IX_KEY VALUES(3,12,'new-york') +INSERT INTO IX_KEY VALUES(3,13,'chicago') +INSERT INTO IX_KEY VALUES(3,14,'topeka') +INSERT INTO IX_KEY VALUES(3,15,'location') +INSERT INTO IX_KEY VALUES(3,16,'cases') +INSERT INTO IX_KEY VALUES(3,17,'supply') +INSERT INTO IX_KEY VALUES(3,18,'consumption') +INSERT INTO IX_KEY VALUES(3,19,'canning_plant') +INSERT INTO IX_KEY VALUES(3,20,'transport_from_seattle') +INSERT INTO IX_KEY VALUES(3,21,'transport_from_san-diego') +INSERT INTO IX_KEY VALUES(3,22,'production') +INSERT INTO IX_KEY VALUES(3,23,'to_new-york') +INSERT INTO IX_KEY VALUES(3,24,'to_chicago') +INSERT INTO IX_KEY VALUES(3,25,'to_topeka') +INSERT INTO IX_KEY VALUES(3,26,'cumulative') INSERT INTO IX_KEY VALUES(4,0,'scalar') INSERT INTO IX_KEY VALUES(4,1,'World') INSERT INTO IX_KEY VALUES(4,2,'global') @@ -690,6 +574,8 @@ INSERT INTO IX_KEY VALUES(4,23,'to_new-york') INSERT INTO IX_KEY VALUES(4,24,'to_chicago') INSERT INTO IX_KEY VALUES(4,25,'to_topeka') INSERT INTO IX_KEY VALUES(4,26,'cumulative') +INSERT INTO IX_KEY VALUES(4,27,'2020') +INSERT INTO IX_KEY VALUES(4,28,'2030') INSERT INTO IX_COMMENT VALUES(0,'None',3) INSERT INTO IX_COMMENT VALUES(0,'None',4) INSERT INTO IX_IDXSET VALUES(1,'*',NULL,-1,NULL) @@ -697,47 +583,47 @@ INSERT INTO IX_IDXSET VALUES(2,'*',NULL,-1,NULL) INSERT INTO IX_IDXSET VALUES(2,'i',1,0,NULL) INSERT INTO IX_IDXSET VALUES(2,'j',2,3,NULL) INSERT INTO IX_IDXSET VALUES(3,'*',NULL,-1,NULL) -INSERT INTO IX_IDXSET VALUES(3,'commodity',75,31,NULL) -INSERT INTO IX_IDXSET VALUES(3,'emission',65,4,NULL) +INSERT INTO IX_IDXSET VALUES(3,'commodity',21,31,NULL) +INSERT INTO IX_IDXSET VALUES(3,'emission',NULL,4,NULL) INSERT INTO IX_IDXSET VALUES(3,'grade',NULL,26,NULL) INSERT INTO IX_IDXSET VALUES(3,'land_scenario',NULL,5,NULL) INSERT INTO IX_IDXSET VALUES(3,'land_type',NULL,6,NULL) -INSERT INTO IX_IDXSET VALUES(3,'level',74,27,NULL) -INSERT INTO IX_IDXSET VALUES(3,'lvl_spatial',66,7,NULL) -INSERT INTO IX_IDXSET VALUES(3,'lvl_temporal',68,11,NULL) -INSERT INTO IX_IDXSET VALUES(3,'mode',73,25,NULL) -INSERT INTO IX_IDXSET VALUES(3,'node',63,1,NULL) +INSERT INTO IX_IDXSET VALUES(3,'level',20,27,NULL) +INSERT INTO IX_IDXSET VALUES(3,'lvl_spatial',13,7,NULL) +INSERT INTO IX_IDXSET VALUES(3,'lvl_temporal',15,11,NULL) +INSERT INTO IX_IDXSET VALUES(3,'mode',19,25,NULL) +INSERT INTO IX_IDXSET VALUES(3,'node',11,1,NULL) INSERT INTO IX_IDXSET VALUES(3,'rating',NULL,32,NULL) INSERT INTO IX_IDXSET VALUES(3,'relation',NULL,3,NULL) -INSERT INTO IX_IDXSET VALUES(3,'technology',64,2,NULL) -INSERT INTO IX_IDXSET VALUES(3,'time',67,10,NULL) -INSERT INTO IX_IDXSET VALUES(3,'type_emission',72,20,NULL) -INSERT INTO IX_IDXSET VALUES(3,'type_node',69,14,NULL) +INSERT INTO IX_IDXSET VALUES(3,'technology',12,2,NULL) +INSERT INTO IX_IDXSET VALUES(3,'time',14,10,NULL) +INSERT INTO IX_IDXSET VALUES(3,'type_emission',NULL,20,NULL) +INSERT INTO IX_IDXSET VALUES(3,'type_node',16,14,NULL) INSERT INTO IX_IDXSET VALUES(3,'type_relation',NULL,23,NULL) -INSERT INTO IX_IDXSET VALUES(3,'type_tec',70,16,NULL) -INSERT INTO IX_IDXSET VALUES(3,'type_year',71,18,NULL) -INSERT INTO IX_IDXSET VALUES(3,'year',62,0,NULL) +INSERT INTO IX_IDXSET VALUES(3,'type_tec',17,16,NULL) +INSERT INTO IX_IDXSET VALUES(3,'type_year',18,18,NULL) +INSERT INTO IX_IDXSET VALUES(3,'year',10,0,NULL) INSERT INTO IX_IDXSET VALUES(4,'*',NULL,-1,NULL) -INSERT INTO IX_IDXSET VALUES(4,'commodity',87,31,NULL) +INSERT INTO IX_IDXSET VALUES(4,'commodity',58,31,NULL) INSERT INTO IX_IDXSET VALUES(4,'emission',NULL,4,NULL) INSERT INTO IX_IDXSET VALUES(4,'grade',NULL,26,NULL) INSERT INTO IX_IDXSET VALUES(4,'land_scenario',NULL,5,NULL) INSERT INTO IX_IDXSET VALUES(4,'land_type',NULL,6,NULL) -INSERT INTO IX_IDXSET VALUES(4,'level',86,27,NULL) -INSERT INTO IX_IDXSET VALUES(4,'lvl_spatial',79,7,NULL) -INSERT INTO IX_IDXSET VALUES(4,'lvl_temporal',81,11,NULL) -INSERT INTO IX_IDXSET VALUES(4,'mode',85,25,NULL) -INSERT INTO IX_IDXSET VALUES(4,'node',77,1,NULL) +INSERT INTO IX_IDXSET VALUES(4,'level',57,27,NULL) +INSERT INTO IX_IDXSET VALUES(4,'lvl_spatial',50,7,NULL) +INSERT INTO IX_IDXSET VALUES(4,'lvl_temporal',52,11,NULL) +INSERT INTO IX_IDXSET VALUES(4,'mode',56,25,NULL) +INSERT INTO IX_IDXSET VALUES(4,'node',48,1,NULL) INSERT INTO IX_IDXSET VALUES(4,'rating',NULL,32,NULL) INSERT INTO IX_IDXSET VALUES(4,'relation',NULL,3,NULL) -INSERT INTO IX_IDXSET VALUES(4,'technology',78,2,NULL) -INSERT INTO IX_IDXSET VALUES(4,'time',80,10,NULL) +INSERT INTO IX_IDXSET VALUES(4,'technology',49,2,NULL) +INSERT INTO IX_IDXSET VALUES(4,'time',51,10,NULL) INSERT INTO IX_IDXSET VALUES(4,'type_emission',NULL,20,NULL) -INSERT INTO IX_IDXSET VALUES(4,'type_node',82,14,NULL) +INSERT INTO IX_IDXSET VALUES(4,'type_node',53,14,NULL) INSERT INTO IX_IDXSET VALUES(4,'type_relation',NULL,23,NULL) -INSERT INTO IX_IDXSET VALUES(4,'type_tec',83,16,NULL) -INSERT INTO IX_IDXSET VALUES(4,'type_year',84,18,NULL) -INSERT INTO IX_IDXSET VALUES(4,'year',76,0,NULL) +INSERT INTO IX_IDXSET VALUES(4,'type_tec',54,16,NULL) +INSERT INTO IX_IDXSET VALUES(4,'type_year',63,18,NULL) +INSERT INTO IX_IDXSET VALUES(4,'year',62,0,NULL) INSERT INTO IX_SET VALUES(3,'cat_emission',2,21) INSERT INTO IX_SET VALUES(3,'cat_node',2,15) INSERT INTO IX_SET VALUES(3,'cat_relation',2,24) @@ -812,31 +698,31 @@ INSERT INTO IX_SET_DIM VALUES(4,'map_temporal_hierarchy',2,'time','time_parent') INSERT INTO IX_SET_DIM VALUES(4,'map_time',0,'time','time_parent') INSERT INTO IX_SET_DIM VALUES(4,'map_time',1,'time','time') INSERT INTO IX_SET_DIM VALUES(4,'type_tec_land',0,'type_tec','type_tec') -INSERT INTO IX_SET_BLOBSTORE VALUES(3,'cat_emission',29,NULL) +INSERT INTO IX_SET_BLOBSTORE VALUES(3,'cat_emission',NULL,NULL) INSERT INTO IX_SET_BLOBSTORE VALUES(3,'cat_node',NULL,NULL) INSERT INTO IX_SET_BLOBSTORE VALUES(3,'cat_relation',NULL,NULL) INSERT INTO IX_SET_BLOBSTORE VALUES(3,'cat_tec',NULL,NULL) -INSERT INTO IX_SET_BLOBSTORE VALUES(3,'cat_year',28,NULL) +INSERT INTO IX_SET_BLOBSTORE VALUES(3,'cat_year',26,NULL) INSERT INTO IX_SET_BLOBSTORE VALUES(3,'level_renewable',NULL,NULL) INSERT INTO IX_SET_BLOBSTORE VALUES(3,'level_resource',NULL,NULL) INSERT INTO IX_SET_BLOBSTORE VALUES(3,'level_stocks',NULL,NULL) -INSERT INTO IX_SET_BLOBSTORE VALUES(3,'map_node',25,NULL) -INSERT INTO IX_SET_BLOBSTORE VALUES(3,'map_spatial_hierarchy',24,NULL) -INSERT INTO IX_SET_BLOBSTORE VALUES(3,'map_temporal_hierarchy',26,NULL) -INSERT INTO IX_SET_BLOBSTORE VALUES(3,'map_time',27,NULL) +INSERT INTO IX_SET_BLOBSTORE VALUES(3,'map_node',23,NULL) +INSERT INTO IX_SET_BLOBSTORE VALUES(3,'map_spatial_hierarchy',22,NULL) +INSERT INTO IX_SET_BLOBSTORE VALUES(3,'map_temporal_hierarchy',24,NULL) +INSERT INTO IX_SET_BLOBSTORE VALUES(3,'map_time',25,NULL) INSERT INTO IX_SET_BLOBSTORE VALUES(3,'type_tec_land',NULL,NULL) INSERT INTO IX_SET_BLOBSTORE VALUES(4,'cat_emission',NULL,NULL) INSERT INTO IX_SET_BLOBSTORE VALUES(4,'cat_node',NULL,NULL) INSERT INTO IX_SET_BLOBSTORE VALUES(4,'cat_relation',NULL,NULL) INSERT INTO IX_SET_BLOBSTORE VALUES(4,'cat_tec',NULL,NULL) -INSERT INTO IX_SET_BLOBSTORE VALUES(4,'cat_year',92,NULL) +INSERT INTO IX_SET_BLOBSTORE VALUES(4,'cat_year',59,NULL) INSERT INTO IX_SET_BLOBSTORE VALUES(4,'level_renewable',NULL,NULL) INSERT INTO IX_SET_BLOBSTORE VALUES(4,'level_resource',NULL,NULL) INSERT INTO IX_SET_BLOBSTORE VALUES(4,'level_stocks',NULL,NULL) -INSERT INTO IX_SET_BLOBSTORE VALUES(4,'map_node',89,NULL) -INSERT INTO IX_SET_BLOBSTORE VALUES(4,'map_spatial_hierarchy',88,NULL) -INSERT INTO IX_SET_BLOBSTORE VALUES(4,'map_temporal_hierarchy',90,NULL) -INSERT INTO IX_SET_BLOBSTORE VALUES(4,'map_time',91,NULL) +INSERT INTO IX_SET_BLOBSTORE VALUES(4,'map_node',23,NULL) +INSERT INTO IX_SET_BLOBSTORE VALUES(4,'map_spatial_hierarchy',22,NULL) +INSERT INTO IX_SET_BLOBSTORE VALUES(4,'map_temporal_hierarchy',24,NULL) +INSERT INTO IX_SET_BLOBSTORE VALUES(4,'map_time',25,NULL) INSERT INTO IX_SET_BLOBSTORE VALUES(4,'type_tec_land',NULL,NULL) INSERT INTO IX_PAR VALUES(2,'a',1,7) INSERT INTO IX_PAR VALUES(2,'b',1,10) @@ -1780,25 +1666,25 @@ INSERT INTO IX_PAR_BLOBSTORE VALUES(3,'abs_cost_activity_soft_lo',NULL,NULL) INSERT INTO IX_PAR_BLOBSTORE VALUES(3,'abs_cost_activity_soft_up',NULL,NULL) INSERT INTO IX_PAR_BLOBSTORE VALUES(3,'abs_cost_new_capacity_soft_lo',NULL,NULL) INSERT INTO IX_PAR_BLOBSTORE VALUES(3,'abs_cost_new_capacity_soft_up',NULL,NULL) -INSERT INTO IX_PAR_BLOBSTORE VALUES(3,'bound_activity_lo',40,NULL) -INSERT INTO IX_PAR_BLOBSTORE VALUES(3,'bound_activity_up',39,NULL) +INSERT INTO IX_PAR_BLOBSTORE VALUES(3,'bound_activity_lo',NULL,NULL) +INSERT INTO IX_PAR_BLOBSTORE VALUES(3,'bound_activity_up',31,NULL) INSERT INTO IX_PAR_BLOBSTORE VALUES(3,'bound_emission',NULL,NULL) INSERT INTO IX_PAR_BLOBSTORE VALUES(3,'bound_extraction_up',NULL,NULL) INSERT INTO IX_PAR_BLOBSTORE VALUES(3,'bound_new_capacity_lo',NULL,NULL) -INSERT INTO IX_PAR_BLOBSTORE VALUES(3,'bound_new_capacity_up',38,NULL) +INSERT INTO IX_PAR_BLOBSTORE VALUES(3,'bound_new_capacity_up',NULL,NULL) INSERT INTO IX_PAR_BLOBSTORE VALUES(3,'bound_total_capacity_lo',NULL,NULL) INSERT INTO IX_PAR_BLOBSTORE VALUES(3,'bound_total_capacity_up',NULL,NULL) -INSERT INTO IX_PAR_BLOBSTORE VALUES(3,'capacity_factor',32,NULL) +INSERT INTO IX_PAR_BLOBSTORE VALUES(3,'capacity_factor',NULL,NULL) INSERT INTO IX_PAR_BLOBSTORE VALUES(3,'commodity_stock',NULL,NULL) INSERT INTO IX_PAR_BLOBSTORE VALUES(3,'construction_time',NULL,NULL) -INSERT INTO IX_PAR_BLOBSTORE VALUES(3,'demand',30,NULL) -INSERT INTO IX_PAR_BLOBSTORE VALUES(3,'duration_period',61,NULL) -INSERT INTO IX_PAR_BLOBSTORE VALUES(3,'duration_time',45,NULL) +INSERT INTO IX_PAR_BLOBSTORE VALUES(3,'demand',27,NULL) +INSERT INTO IX_PAR_BLOBSTORE VALUES(3,'duration_period',32,NULL) +INSERT INTO IX_PAR_BLOBSTORE VALUES(3,'duration_time',33,NULL) INSERT INTO IX_PAR_BLOBSTORE VALUES(3,'dynamic_land_lo',NULL,NULL) INSERT INTO IX_PAR_BLOBSTORE VALUES(3,'dynamic_land_up',NULL,NULL) -INSERT INTO IX_PAR_BLOBSTORE VALUES(3,'emission_factor',43,NULL) +INSERT INTO IX_PAR_BLOBSTORE VALUES(3,'emission_factor',NULL,NULL) INSERT INTO IX_PAR_BLOBSTORE VALUES(3,'emission_scaling',NULL,NULL) -INSERT INTO IX_PAR_BLOBSTORE VALUES(3,'fix_cost',34,NULL) +INSERT INTO IX_PAR_BLOBSTORE VALUES(3,'fix_cost',NULL,NULL) INSERT INTO IX_PAR_BLOBSTORE VALUES(3,'fixed_activity',NULL,NULL) INSERT INTO IX_PAR_BLOBSTORE VALUES(3,'fixed_capacity',NULL,NULL) INSERT INTO IX_PAR_BLOBSTORE VALUES(3,'fixed_extraction',NULL,NULL) @@ -1807,7 +1693,7 @@ INSERT INTO IX_PAR_BLOBSTORE VALUES(3,'fixed_new_capacity',NULL,NULL) INSERT INTO IX_PAR_BLOBSTORE VALUES(3,'fixed_stock',NULL,NULL) INSERT INTO IX_PAR_BLOBSTORE VALUES(3,'flexibility_factor',NULL,NULL) INSERT INTO IX_PAR_BLOBSTORE VALUES(3,'growth_activity_lo',NULL,NULL) -INSERT INTO IX_PAR_BLOBSTORE VALUES(3,'growth_activity_up',42,NULL) +INSERT INTO IX_PAR_BLOBSTORE VALUES(3,'growth_activity_up',NULL,NULL) INSERT INTO IX_PAR_BLOBSTORE VALUES(3,'growth_land_lo',NULL,NULL) INSERT INTO IX_PAR_BLOBSTORE VALUES(3,'growth_land_scen_lo',NULL,NULL) INSERT INTO IX_PAR_BLOBSTORE VALUES(3,'growth_land_scen_up',NULL,NULL) @@ -1821,16 +1707,16 @@ INSERT INTO IX_PAR_BLOBSTORE VALUES(3,'historical_gdp',NULL,NULL) INSERT INTO IX_PAR_BLOBSTORE VALUES(3,'historical_land',NULL,NULL) INSERT INTO IX_PAR_BLOBSTORE VALUES(3,'historical_new_capacity',NULL,NULL) INSERT INTO IX_PAR_BLOBSTORE VALUES(3,'initial_activity_lo',NULL,NULL) -INSERT INTO IX_PAR_BLOBSTORE VALUES(3,'initial_activity_up',41,NULL) +INSERT INTO IX_PAR_BLOBSTORE VALUES(3,'initial_activity_up',NULL,NULL) INSERT INTO IX_PAR_BLOBSTORE VALUES(3,'initial_land_lo',NULL,NULL) INSERT INTO IX_PAR_BLOBSTORE VALUES(3,'initial_land_scen_lo',NULL,NULL) INSERT INTO IX_PAR_BLOBSTORE VALUES(3,'initial_land_scen_up',NULL,NULL) INSERT INTO IX_PAR_BLOBSTORE VALUES(3,'initial_land_up',NULL,NULL) INSERT INTO IX_PAR_BLOBSTORE VALUES(3,'initial_new_capacity_lo',NULL,NULL) INSERT INTO IX_PAR_BLOBSTORE VALUES(3,'initial_new_capacity_up',NULL,NULL) -INSERT INTO IX_PAR_BLOBSTORE VALUES(3,'input',37,NULL) -INSERT INTO IX_PAR_BLOBSTORE VALUES(3,'interestrate',46,NULL) -INSERT INTO IX_PAR_BLOBSTORE VALUES(3,'inv_cost',33,NULL) +INSERT INTO IX_PAR_BLOBSTORE VALUES(3,'input',30,NULL) +INSERT INTO IX_PAR_BLOBSTORE VALUES(3,'interestrate',NULL,NULL) +INSERT INTO IX_PAR_BLOBSTORE VALUES(3,'inv_cost',NULL,NULL) INSERT INTO IX_PAR_BLOBSTORE VALUES(3,'land_cost',NULL,NULL) INSERT INTO IX_PAR_BLOBSTORE VALUES(3,'land_emission',NULL,NULL) INSERT INTO IX_PAR_BLOBSTORE VALUES(3,'land_input',NULL,NULL) @@ -1842,9 +1728,9 @@ INSERT INTO IX_PAR_BLOBSTORE VALUES(3,'level_cost_new_capacity_soft_lo',NULL,NUL INSERT INTO IX_PAR_BLOBSTORE VALUES(3,'level_cost_new_capacity_soft_up',NULL,NULL) INSERT INTO IX_PAR_BLOBSTORE VALUES(3,'min_utilization_factor',NULL,NULL) INSERT INTO IX_PAR_BLOBSTORE VALUES(3,'operation_factor',NULL,NULL) -INSERT INTO IX_PAR_BLOBSTORE VALUES(3,'output',36,NULL) +INSERT INTO IX_PAR_BLOBSTORE VALUES(3,'output',29,NULL) INSERT INTO IX_PAR_BLOBSTORE VALUES(3,'peak_load_factor',NULL,NULL) -INSERT INTO IX_PAR_BLOBSTORE VALUES(3,'ref_activity',NULL,NULL) +INSERT INTO IX_PAR_BLOBSTORE VALUES(3,'ref_activity',34,NULL) INSERT INTO IX_PAR_BLOBSTORE VALUES(3,'ref_extraction',NULL,NULL) INSERT INTO IX_PAR_BLOBSTORE VALUES(3,'ref_new_capacity',NULL,NULL) INSERT INTO IX_PAR_BLOBSTORE VALUES(3,'ref_relation',NULL,NULL) @@ -1868,14 +1754,14 @@ INSERT INTO IX_PAR_BLOBSTORE VALUES(3,'soft_new_capacity_up',NULL,NULL) INSERT INTO IX_PAR_BLOBSTORE VALUES(3,'subsidy',NULL,NULL) INSERT INTO IX_PAR_BLOBSTORE VALUES(3,'tax',NULL,NULL) INSERT INTO IX_PAR_BLOBSTORE VALUES(3,'tax_emission',NULL,NULL) -INSERT INTO IX_PAR_BLOBSTORE VALUES(3,'technical_lifetime',31,NULL) -INSERT INTO IX_PAR_BLOBSTORE VALUES(3,'var_cost',35,NULL) +INSERT INTO IX_PAR_BLOBSTORE VALUES(3,'technical_lifetime',NULL,NULL) +INSERT INTO IX_PAR_BLOBSTORE VALUES(3,'var_cost',28,NULL) INSERT INTO IX_PAR_BLOBSTORE VALUES(4,'abs_cost_activity_soft_lo',NULL,NULL) INSERT INTO IX_PAR_BLOBSTORE VALUES(4,'abs_cost_activity_soft_up',NULL,NULL) INSERT INTO IX_PAR_BLOBSTORE VALUES(4,'abs_cost_new_capacity_soft_lo',NULL,NULL) INSERT INTO IX_PAR_BLOBSTORE VALUES(4,'abs_cost_new_capacity_soft_up',NULL,NULL) INSERT INTO IX_PAR_BLOBSTORE VALUES(4,'bound_activity_lo',NULL,NULL) -INSERT INTO IX_PAR_BLOBSTORE VALUES(4,'bound_activity_up',97,NULL) +INSERT INTO IX_PAR_BLOBSTORE VALUES(4,'bound_activity_up',31,NULL) INSERT INTO IX_PAR_BLOBSTORE VALUES(4,'bound_emission',NULL,NULL) INSERT INTO IX_PAR_BLOBSTORE VALUES(4,'bound_extraction_up',NULL,NULL) INSERT INTO IX_PAR_BLOBSTORE VALUES(4,'bound_new_capacity_lo',NULL,NULL) @@ -1885,9 +1771,9 @@ INSERT INTO IX_PAR_BLOBSTORE VALUES(4,'bound_total_capacity_up',NULL,NULL) INSERT INTO IX_PAR_BLOBSTORE VALUES(4,'capacity_factor',NULL,NULL) INSERT INTO IX_PAR_BLOBSTORE VALUES(4,'commodity_stock',NULL,NULL) INSERT INTO IX_PAR_BLOBSTORE VALUES(4,'construction_time',NULL,NULL) -INSERT INTO IX_PAR_BLOBSTORE VALUES(4,'demand',93,NULL) -INSERT INTO IX_PAR_BLOBSTORE VALUES(4,'duration_period',98,NULL) -INSERT INTO IX_PAR_BLOBSTORE VALUES(4,'duration_time',99,NULL) +INSERT INTO IX_PAR_BLOBSTORE VALUES(4,'demand',27,NULL) +INSERT INTO IX_PAR_BLOBSTORE VALUES(4,'duration_period',61,NULL) +INSERT INTO IX_PAR_BLOBSTORE VALUES(4,'duration_time',33,NULL) INSERT INTO IX_PAR_BLOBSTORE VALUES(4,'dynamic_land_lo',NULL,NULL) INSERT INTO IX_PAR_BLOBSTORE VALUES(4,'dynamic_land_up',NULL,NULL) INSERT INTO IX_PAR_BLOBSTORE VALUES(4,'emission_factor',NULL,NULL) @@ -1922,7 +1808,7 @@ INSERT INTO IX_PAR_BLOBSTORE VALUES(4,'initial_land_scen_up',NULL,NULL) INSERT INTO IX_PAR_BLOBSTORE VALUES(4,'initial_land_up',NULL,NULL) INSERT INTO IX_PAR_BLOBSTORE VALUES(4,'initial_new_capacity_lo',NULL,NULL) INSERT INTO IX_PAR_BLOBSTORE VALUES(4,'initial_new_capacity_up',NULL,NULL) -INSERT INTO IX_PAR_BLOBSTORE VALUES(4,'input',96,NULL) +INSERT INTO IX_PAR_BLOBSTORE VALUES(4,'input',30,NULL) INSERT INTO IX_PAR_BLOBSTORE VALUES(4,'interestrate',NULL,NULL) INSERT INTO IX_PAR_BLOBSTORE VALUES(4,'inv_cost',NULL,NULL) INSERT INTO IX_PAR_BLOBSTORE VALUES(4,'land_cost',NULL,NULL) @@ -1936,9 +1822,9 @@ INSERT INTO IX_PAR_BLOBSTORE VALUES(4,'level_cost_new_capacity_soft_lo',NULL,NUL INSERT INTO IX_PAR_BLOBSTORE VALUES(4,'level_cost_new_capacity_soft_up',NULL,NULL) INSERT INTO IX_PAR_BLOBSTORE VALUES(4,'min_utilization_factor',NULL,NULL) INSERT INTO IX_PAR_BLOBSTORE VALUES(4,'operation_factor',NULL,NULL) -INSERT INTO IX_PAR_BLOBSTORE VALUES(4,'output',95,NULL) +INSERT INTO IX_PAR_BLOBSTORE VALUES(4,'output',29,NULL) INSERT INTO IX_PAR_BLOBSTORE VALUES(4,'peak_load_factor',NULL,NULL) -INSERT INTO IX_PAR_BLOBSTORE VALUES(4,'ref_activity',100,NULL) +INSERT INTO IX_PAR_BLOBSTORE VALUES(4,'ref_activity',34,NULL) INSERT INTO IX_PAR_BLOBSTORE VALUES(4,'ref_extraction',NULL,NULL) INSERT INTO IX_PAR_BLOBSTORE VALUES(4,'ref_new_capacity',NULL,NULL) INSERT INTO IX_PAR_BLOBSTORE VALUES(4,'ref_relation',NULL,NULL) @@ -1962,8 +1848,8 @@ INSERT INTO IX_PAR_BLOBSTORE VALUES(4,'soft_new_capacity_up',NULL,NULL) INSERT INTO IX_PAR_BLOBSTORE VALUES(4,'subsidy',NULL,NULL) INSERT INTO IX_PAR_BLOBSTORE VALUES(4,'tax',NULL,NULL) INSERT INTO IX_PAR_BLOBSTORE VALUES(4,'tax_emission',NULL,NULL) -INSERT INTO IX_PAR_BLOBSTORE VALUES(4,'technical_lifetime',NULL,NULL) -INSERT INTO IX_PAR_BLOBSTORE VALUES(4,'var_cost',94,NULL) +INSERT INTO IX_PAR_BLOBSTORE VALUES(4,'technical_lifetime',60,NULL) +INSERT INTO IX_PAR_BLOBSTORE VALUES(4,'var_cost',28,NULL) INSERT INTO IX_VAR VALUES(2,'x',2,24) INSERT INTO IX_VAR VALUES(2,'z',0,23) INSERT INTO IX_VAR_DIM VALUES(2,'x',0,'i','i') diff --git a/tests/testdb_setup.py b/tests/testdb_setup.py index 8d9ced3f1..cc15cb416 100644 --- a/tests/testdb_setup.py +++ b/tests/testdb_setup.py @@ -7,7 +7,6 @@ import os import pandas as pd -import itertools import ixmp as ix db_dir = os.path.join(ix.default_paths.TEST_DIR, 'testdb') @@ -111,457 +110,14 @@ scen.set_as_default() # solve the model using the GAMS code provided in the `tests` folder -fname = os.path.join(ix.default_paths.TEST_DIR, 'transport_ixmp.gms') +fname = os.path.join(ix.default_paths.TEST_DIR, 'transport_ixmp') scen.solve(model=fname, case='transport_standard') -# %% initialize the Austria example - -model = "Austrian energy model" -scenario = "baseline" -annot = "developing a stylized energy system model for Austria" - -scen = mp.Scenario(model, scenario, version='new', annotation=annot, - scheme="MESSAGE") - -horizon = range(2010, 2070, 10) -firstyear = horizon[0] - -scen.add_set("year", horizon) -scen.add_set("cat_year", ["firstmodelyear", firstyear]) - -country = "Austria" -scen.add_set("node", country) -scen.add_set("lvl_spatial", "country") -scen.add_set("map_spatial_hierarchy", ["country", country, "World"]) -scen.add_set("mode", "standard") - -scen.add_set("commodity", ["electricity", "light", "other_electricity"]) -scen.add_set("level", ["secondary", "final", "useful"]) - -rate = [0.05] * len(horizon) -unit = ['%'] * len(horizon) -scen.add_par("interestrate", key=horizon, val=rate, unit=unit) - -beta = 0.7 -gdp = pd.Series([1., 1.2163, 1.4108, 1.63746, 1.89083, 2.1447], index=horizon) -demand = gdp ** beta - -plants = [ - "coal_ppl", - "gas_ppl", - "oil_ppl", - "bio_ppl", - "hydro_ppl", - "wind_ppl", - "solar_pv_ppl" # actually primary -> final -] -secondary_energy_tecs = plants + ['import'] - -final_energy_tecs = ['electricity_grid'] - -lights = [ - "bulb", - "cfl" -] -useful_energy_tecs = lights + ['appliances'] - -technologies = secondary_energy_tecs + final_energy_tecs + useful_energy_tecs -scen.add_set("technology", technologies) - -demand_per_year = 55209. / 8760 # from IEA statistics -elec_demand = pd.DataFrame({ - 'node': country, - 'commodity': 'other_electricity', - 'level': 'useful', - 'year': horizon, - 'time': 'year', - 'value': demand_per_year * demand, - 'unit': 'GWa', - }) -scen.add_par("demand", elec_demand) - -demand_per_year = 6134. / 8760 # from IEA statistics -light_demand = pd.DataFrame({ - 'node': country, - 'commodity': 'light', - 'level': 'useful', - 'year': horizon, - 'time': 'year', - 'value': demand_per_year * demand, - 'unit': 'GWa', - }) -scen.add_par("demand", light_demand) - -year_pairs = [(y_v, y_a) for y_v, y_a in - itertools.product(horizon, horizon) if y_v <= y_a] -vintage_years, act_years = zip(*year_pairs) - -base_input = { - 'node_loc': country, - 'year_vtg': vintage_years, - 'year_act': act_years, - 'mode': 'standard', - 'node_origin': country, - 'commodity': 'electricity', - 'time': 'year', - 'time_origin': 'year', -} - -grid = pd.DataFrame(dict( - technology='electricity_grid', - level='secondary', - value=1.0, - unit='%', - **base_input - )) -scen.add_par("input", grid) - - -bulb = pd.DataFrame(dict( - technology='bulb', - level='final', - value=1.0, - unit='%', - **base_input - )) -scen.add_par("input", bulb) - -cfl = pd.DataFrame(dict( - technology='cfl', - level='final', - value=0.3, - unit='%', - **base_input - )) -scen.add_par("input", cfl) - -app = pd.DataFrame(dict( - technology='appliances', - level='final', - value=1.0, - unit='%', - **base_input - )) -scen.add_par("input", app) - - -def make_df(base, **kwargs): - base.update(kwargs) - return pd.DataFrame(base) - - -base_output = { - 'node_loc': country, - 'year_vtg': vintage_years, - 'year_act': act_years, - 'mode': 'standard', - 'node_dest': country, - 'time': 'year', - 'time_dest': 'year', - 'unit': '%', -} - -imports = make_df(base_output, technology='import', commodity='electricity', - level='secondary', value=1.) -scen.add_par('output', imports) - -grid = make_df(base_output, technology='electricity_grid', - commodity='electricity', level='final', value=0.873) -scen.add_par('output', grid) - -bulb = make_df(base_output, technology='bulb', commodity='light', - level='useful', value=1.) -scen.add_par('output', bulb) - -cfl = make_df(base_output, technology='cfl', commodity='light', - level='useful', value=1.) -scen.add_par('output', cfl) - -app = make_df(base_output, technology='appliances', - commodity='other_electricity', level='useful', value=1.) -scen.add_par('output', app) - -coal = make_df(base_output, technology='coal_ppl', commodity='electricity', - level='secondary', value=1.) -scen.add_par('output', coal) - -gas = make_df(base_output, technology='gas_ppl', commodity='electricity', - level='secondary', value=1.) -scen.add_par('output', gas) - -oil = make_df(base_output, technology='oil_ppl', commodity='electricity', - level='secondary', value=1.) -scen.add_par('output', oil) - -bio = make_df(base_output, technology='bio_ppl', commodity='electricity', - level='secondary', value=1.) -scen.add_par('output', bio) - -hydro = make_df(base_output, technology='hydro_ppl', commodity='electricity', - level='secondary', value=1.) -scen.add_par('output', hydro) - -wind = make_df(base_output, technology='wind_ppl', - commodity='electricity', level='secondary', value=1.) -scen.add_par('output', wind) - -solar_pv = make_df(base_output, technology='solar_pv_ppl', - commodity='electricity', level='final', value=1.) -scen.add_par('output', solar_pv) - -base_technical_lifetime = { - 'node_loc': country, - 'year_vtg': horizon, - 'unit': 'y', -} - -lifetimes = { - 'coal_ppl': 40, - 'gas_ppl': 30, - 'oil_ppl': 30, - 'bio_ppl': 30, - 'hydro_ppl': 60, - 'wind_ppl': 20, - 'solar_pv_ppl': 20, - 'bulb': 1, - 'cfl': 10, -} - -for tec, val in lifetimes.items(): - df = make_df(base_technical_lifetime, technology=tec, value=val) - scen.add_par('technical_lifetime', df) - -base_capacity_factor = { - 'node_loc': country, - 'year_vtg': vintage_years, - 'year_act': act_years, - 'time': 'year', - 'unit': '%', -} - -capacity_factor = { - 'coal_ppl': 0.85, - 'gas_ppl': 0.75, - 'oil_ppl': 0.75, - 'bio_ppl': 0.75, - 'hydro_ppl': 0.5, - 'wind_ppl': 0.2, - 'solar_pv_ppl': 0.15, - 'bulb': 0.1, - 'cfl': 0.1, -} - -for tec, val in capacity_factor.items(): - df = make_df(base_capacity_factor, technology=tec, value=val) - scen.add_par('capacity_factor', df) - -base_inv_cost = { - 'node_loc': country, - 'year_vtg': horizon, - 'unit': 'USD/GWa', -} - -# in $ / kW -costs = { - 'coal_ppl': 1500, - 'gas_ppl': 870, - 'oil_ppl': 950, - 'hydro_ppl': 3000, - 'bio_ppl': 1600, - 'wind_ppl': 1100, - 'solar_pv_ppl': 4000, - 'bulb': 5, - 'cfl': 900, -} - -for tec, val in costs.items(): - df = make_df(base_inv_cost, technology=tec, value=val * 1e6) - scen.add_par('inv_cost', df) - -base_fix_cost = { - 'node_loc': country, - 'year_vtg': vintage_years, - 'year_act': act_years, - 'unit': 'USD/GWa', -} - -# in $ / kW -costs = { - 'coal_ppl': 40, - 'gas_ppl': 25, - 'oil_ppl': 25, - 'hydro_ppl': 60, - 'bio_ppl': 30, - 'wind_ppl': 40, - 'solar_pv_ppl': 25, -} - -for tec, val in costs.items(): - df = make_df(base_fix_cost, technology=tec, value=val * 1e6) - scen.add_par('fix_cost', df) - -base_var_cost = { - 'node_loc': country, - 'year_vtg': vintage_years, - 'year_act': act_years, - 'mode': 'standard', - 'time': 'year', - 'unit': 'USD/GWa', -} - -# in $ / MWh -costs = { - 'coal_ppl': 24.4, - 'gas_ppl': 42.4, - 'oil_ppl': 77.8, - 'bio_ppl': 48.2, - 'electricity_grid': 47.8, -} - -for tec, val in costs.items(): - df = make_df(base_var_cost, technology=tec, value=val * 8760. * 1e3) - scen.add_par('var_cost', df) - -base_growth = { - 'node_loc': country, - 'year_act': horizon[1:], - 'value': 0.05, - 'time': 'year', - 'unit': '%', -} - -growth_technologies = [ - "coal_ppl", - "gas_ppl", - "oil_ppl", - "bio_ppl", - "hydro_ppl", - "wind_ppl", - "solar_pv_ppl", - "cfl", - "bulb", -] - -for tec in growth_technologies: - df = make_df(base_growth, technology=tec) - scen.add_par('growth_activity_up', df) - -base_initial = { - 'node_loc': country, - 'year_act': horizon[1:], - 'time': 'year', - 'unit': '%', -} - -for tec in lights: - df = make_df(base_initial, technology=tec, - value=0.01 * light_demand['value'].loc[horizon[1:]]) - scen.add_par('initial_activity_up', df) - -base_activity = { - 'node_loc': country, - 'year_act': [2010], - 'mode': 'standard', - 'time': 'year', - 'unit': 'GWa', -} - -# in GWh - from IEA Electricity Output -activity = { - 'coal_ppl': 7184, - 'gas_ppl': 14346, - 'oil_ppl': 1275, - 'hydro_ppl': 38406, - 'bio_ppl': 4554, - 'wind_ppl': 2064, - 'solar_pv_ppl': 89, - 'import': 2340, - 'cfl': 0, -} - -for tec, val in activity.items(): - df = make_df(base_activity, technology=tec, value=val / 8760.) - scen.add_par('bound_activity_up', df) - scen.add_par('bound_activity_lo', df) - -base_activity = { - 'node_loc': country, - 'year_act': horizon[1:], - 'mode': 'standard', - 'time': 'year', - 'unit': 'GWa', -} - -# in GWh - base value from IEA Electricity Output -keep_activity = { - 'hydro_ppl': 38406, - 'bio_ppl': 4554, - 'import': 2340, -} - -for tec, val in keep_activity.items(): - df = make_df(base_activity, technology=tec, value=val / 8760.) - scen.add_par('bound_activity_up', df) - -base_capacity = { - 'node_loc': country, - 'year_vtg': [2010], - 'unit': 'GWa', -} - -cf = pd.Series(capacity_factor) -act = pd.Series(activity) -capacity = (act / 8760 / cf).dropna().to_dict() - -for tec, val in capacity.items(): - df = make_df(base_capacity, technology=tec, value=val) - scen.add_par('bound_new_capacity_up', df) - -scen.add_set("emission", "CO2") -scen.add_cat('emission', 'GHGs', 'CO2') - -base_emissions = { - 'node_loc': country, - 'year_vtg': vintage_years, - 'year_act': act_years, - 'mode': 'standard', - 'unit': 'kg/kWa' # actually is tCO2/GWa -} - -# units: tCO2/MWh -emissions = { - 'coal_ppl': ('CO2', 0.854), - 'gas_ppl': ('CO2', 0.339), - 'oil_ppl': ('CO2', 0.57), -} - -for tec, (species, val) in emissions.items(): - df = make_df(base_emissions, technology=tec, emission=species, - value=val * 8760. * 1000) - scen.add_par('emission_factor', df) - -comment = 'initial commit for Austria model' -scen.commit(comment) -scen.set_as_default() - -scen.check_out() -# add timeseries data for GDP as meta-data (will not be dropped during cloning) -data = {'variable': 'GDP', 'year': horizon, 'value': gdp, - 'unit': 'million USD', 'region': 'Austria'} -df = pd.DataFrame.from_dict(data) -scen.add_timeseries(df, meta=True) - -# add timeseries data for GDP as meta-data (will not be dropped during cloning) -data = {'variable': 'Demand', 'year': horizon, 'value': demand, - 'unit': 'GWa/y', 'region': 'Austria'} -df = pd.DataFrame.from_dict(data) -scen.add_timeseries(df) -scen.commit('add timeseries meta data (gdp) and demand') - - # %% initialize a new scenario using the canning problem # based on the scheme "MESSAGE" +# this allows to test that all MESSAGE-specific functions in the Java core +# work as expected model = "canning problem (MESSAGE scheme)" scenario = "standard" @@ -633,7 +189,6 @@ def make_df(base, **kwargs): scen.add_par("output", outp) - inp_data = [ {'mode': "to_new-york"}, {'mode': "to_chicago"}, @@ -686,7 +241,6 @@ def make_df(base, **kwargs): scen.add_par("output", outp) - var_cost_data = [ {'node_loc': "seattle", 'technology': "transport_from_seattle", 'mode': "to_new-york", 'value': 0.225}, @@ -720,6 +274,19 @@ def make_df(base, **kwargs): scen.set_as_default() +# %% duplicate the MESSAGE-scheme transport scenario for additional unit tests + +scen = mp.Scenario(model, scenario) +scen = scen.clone(scen='multi-year', + annotation='adding additional years for unit-testing') + +scen.check_out() +scen.add_set('year', [2020, 2030]) +scen.add_par('technical_lifetime', ['seattle', 'canning_plant', '2020'], + 30, 'y') +scen.commit('adding years and technical lifetime to one technology') + + # %% close the test database, remove the test database properties file mp.close_db()