## the following is outcommented because by now it has to be done by hand ( currently only one gdx is handed to the next run, so it is impossible to fix to one run and use the tax from another run)
## Update CO2 tax information for exogenous carbon price runs with the same CO2 price as a previous run
#AJS quit if title is too long - GAMS can't handle that
if(nchar(cfg$title)>75|grepl("\\.",cfg$title)){
stop("This title is too long or the name contains dots - GAMS would not tolerate this, and quit working at a point where you least expect it. Stopping now. ")
content<-c(content,'',paste(' all_regi "all regions" /',paste(regions,collapse=','),'/',sep=''),'')
# Creating sets for H12 subregions
subsets<-toolRegionSubsets(map=cfg$regionmapping)
if(is.null(subsets[["EUR"]]))
subsets[["EUR"]]<-c("EUR")
content<-c(content,paste(' ext_regi "extended regions list (includes subsets of H12 regions)" / ',paste(c(paste0(names(subsets),"_regi"),regions),collapse=','),' /',sep=''),'')
content<-c(content,' regi_group(ext_regi,all_regi) "region groups (regions that together corresponds to a H12 region)"')
out<-mag[,,"Production Cost|Agriculture|Biomass|Energy Crops (million US$2005/yr)"]/1000/1000# with transformation factor from 10E6 US$2005 to 10E12 US$2005
}
else{
# in old MAgPIE reports the unit is reported to be "billion", however the values are in million
out<-mag[,,"Production Cost|Agriculture|Biomass|Energy Crops (billion US$2005/yr)"]/1000/1000# with transformation factor from 10E6 US$2005 to 10E12 US$2005