From ce5ec04d9d5f7e6815793f579f61c397796272a1 Mon Sep 17 00:00:00 2001 From: adrivinca Date: Mon, 2 Dec 2024 11:26:35 +0100 Subject: [PATCH] Remove old files not used --- .../POWER_PLANTS_2016_Raptis.csv | 3 - .../raptis_types_map_cooling_type.csv | 3 - .../raptis_types_map_unit_type.csv | 3 - .../calculate_ppl_cooling_technology_shares.R | 98 ------------------- 4 files changed, 107 deletions(-) delete mode 100644 message_ix_models/data/water/ppl_cooling_tech/POWER_PLANTS_2016_Raptis.csv delete mode 100644 message_ix_models/data/water/ppl_cooling_tech/raptis_types_map_cooling_type.csv delete mode 100644 message_ix_models/data/water/ppl_cooling_tech/raptis_types_map_unit_type.csv diff --git a/message_ix_models/data/water/ppl_cooling_tech/POWER_PLANTS_2016_Raptis.csv b/message_ix_models/data/water/ppl_cooling_tech/POWER_PLANTS_2016_Raptis.csv deleted file mode 100644 index 89cb9a0fcb..0000000000 --- a/message_ix_models/data/water/ppl_cooling_tech/POWER_PLANTS_2016_Raptis.csv +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:dca1895bec58abb28553bb3924f36fa82487c5dd1e53ab4c2de705ef0f75ae4d -size 4181527 diff --git a/message_ix_models/data/water/ppl_cooling_tech/raptis_types_map_cooling_type.csv b/message_ix_models/data/water/ppl_cooling_tech/raptis_types_map_cooling_type.csv deleted file mode 100644 index 9c47ea52bb..0000000000 --- a/message_ix_models/data/water/ppl_cooling_tech/raptis_types_map_cooling_type.csv +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:7a6f722103b60992412aba1f51cf3bbaad06d585de044b7c6b0824a5855fc19d -size 401 diff --git a/message_ix_models/data/water/ppl_cooling_tech/raptis_types_map_unit_type.csv b/message_ix_models/data/water/ppl_cooling_tech/raptis_types_map_unit_type.csv deleted file mode 100644 index 6c3238dbdc..0000000000 --- a/message_ix_models/data/water/ppl_cooling_tech/raptis_types_map_unit_type.csv +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:1370ec1ee0a88142c4aed8724b5fa8b0a0e94b9a7c35d5cc81e0475c9e9c7236 -size 1062 diff --git a/message_ix_models/model/water/data/pre_processing/calculate_ppl_cooling_technology_shares.R b/message_ix_models/model/water/data/pre_processing/calculate_ppl_cooling_technology_shares.R index ce030a29f9..e76a2d63ff 100644 --- a/message_ix_models/model/water/data/pre_processing/calculate_ppl_cooling_technology_shares.R +++ b/message_ix_models/model/water/data/pre_processing/calculate_ppl_cooling_technology_shares.R @@ -200,101 +200,3 @@ cooltech_cost_shares_c <- cooltech_cost_shares %>% cooltech_cost_shares_c[is.na(cooltech_cost_shares_c)] <- 0 # write new file write.csv(cooltech_cost_shares_c, paste0(data_subf, "/cooltech_cost_and_shares_country.csv"), row.names = FALSE) - - -# OLD DATABASE, with the new one, most of this processing is done already by the script -# https://github.com/OFR-IIASA/message_data/blob/RES_add_5_year_timesteps2/data/model/platts_historical_capacity/merge_WEPP_Raptis_CARMA.py - -# # loading -# temp = readOGR(path.expand(paste0(data_subf,'\\delineation')),'MSG11_reg_simpl',verbose=FALSE) -# -# # the input shape file should come externally, in some model setup -# # usually it has two columns, the first should be called 'PID', the second 'REGION' -# # only the second column matter in terms of name, and should have the region names used in the model -# -# region_units.spdf = spTransform(temp, CRS("+proj=longlat")) -# rm(temp) - -# # Read in Raptis et al data -# ppl.df = data.frame(read.csv(paste0(data_subf,'/ppl_cooling_tech/POWER_PLANTS_2016_Raptis.csv'),stringsAsFactors=FALSE)) -# raptis_types_map_cooling.df = data.frame(read.csv(paste0(data_subf,'/ppl_cooling_tech/raptis_types_map_cooling_type.csv'),stringsAsFactors=FALSE)) -# raptis_types_map_unit.df = data.frame(read.csv(paste0(data_subf,'/ppl_cooling_tech/raptis_types_map_unit_type.csv'),stringsAsFactors=FALSE)) -# -# # MESSAGE technologies -# msg_types.df = data.frame(read.csv(paste0(data_subf,'/ppl_cooling_tech/tech_names_ssp_msg.csv'),stringsAsFactors=FALSE)) -# msg_ppl = unique(c(raptis_types_map_unit.df$msgssp_type,raptis_types_map_unit.df$alt1,raptis_types_map_unit.df$alt2,raptis_types_map_unit.df$alt3)) -# msg_ppl = msg_ppl[-1*(which(msg_ppl==''))] -# msg_cool = unique(raptis_types_map_cooling.df$msgssp_type) -# -# fuel_group = lapply(1:length(msg_ppl),function(x){ -# ind1 = which( as.character(raptis_types_map_unit.df$msgssp_type) == as.character(msg_ppl[x]) | as.character(raptis_types_map_unit.df$alt1) == as.character(msg_ppl[x]) | as.character(raptis_types_map_unit.df$alt2) == as.character(msg_ppl[x]) | as.character(raptis_types_map_unit.df$alt3) == as.character(msg_ppl[x]) ) -# return(unique(unlist(strsplit( as.character(raptis_types_map_unit.df$raptis_type[ind1]),'[.]' ))[seq(1,length(unlist(strsplit( as.character(raptis_types_map_unit.df$raptis_type[ind1]),'[.]' ))),b=2)])) -# }) -# -# utype = lapply(1:length(msg_ppl),function(x){ -# ind1 = which( as.character(raptis_types_map_unit.df$msgssp_type) == as.character(msg_ppl[x]) | as.character(raptis_types_map_unit.df$alt1) == as.character(msg_ppl[x]) | as.character(raptis_types_map_unit.df$alt2) == as.character(msg_ppl[x]) | as.character(raptis_types_map_unit.df$alt3) == as.character(msg_ppl[x]) ) -# return(unique(unlist(strsplit( as.character(raptis_types_map_unit.df$raptis_type[ind1]),'[.]' ))[seq(2,length(unlist(strsplit( as.character(raptis_types_map_unit.df$raptis_type[ind1]),'[.]' ))),b=2)])) -# } ) -# -# cool = lapply(1:length(msg_cool),function(x){ as.character(raptis_types_map_cooling.df$raptis_type[which( as.character(raptis_types_map_cooling.df$msgssp_type) == as.character(msg_cool[x]) )])}) -# -# # Pull out data for this specific technology for each region -# cool_techs = unlist(lapply(1:length(msg_cool), function(x){as.matrix(unlist(lapply(1:length(msg_ppl),function(y){paste(msg_ppl[y],msg_cool[x],sep='.')})))})) -# xs = rep(seq(1,length(msg_ppl),by=1),length(msg_cool)) -# ys = unlist(lapply(1:length(msg_cool),function(dd){ rep(dd,length(msg_ppl)) })) -# -# # Cooling techs by pid -# cool_techs_by_pid = data.frame(do.call(rbind, lapply(1:length(cool_techs), function(z){ -# xx = xs[z] -# yy = ys[z] -# temp = ppl.df[which( as.character(ppl.df$Fuel_group) %in% as.character(fuel_group[[xx]]) & -# as.character(ppl.df$UTYPE) %in% as.character(utype[[xx]]) & -# as.character(ppl.df$COOL_complete) %in% as.character(cool[[yy]]) ),] -# if(nrow(temp)>0) -# { -# temp$x = temp$long -# temp$y = temp$lat -# coordinates(temp) = ~ x + y -# proj4string(temp) = proj4string(region_units.spdf) -# temp$pid = unlist(over(temp,region_units.spdf[,which(names(region_units.spdf) == 'PID')])) -# temp = temp[-1*(which(is.na(temp$pid) | is.na(temp$MW))),] -# mw_by_pid = unlist(lapply(1:length(region_units.spdf@data$PID), function(bb){ max(0, sum( temp$MW[ which( as.character(temp$pid) == as.character(region_units.spdf@data$PID[bb]) ) ], na.rm=TRUE ), na.rm=TRUE) } ) ) -# return(mw_by_pid) -# }else -# { -# mw_by_pid = rep(0,length(region_units.spdf@data$REGION)) -# return(mw_by_pid) -# } -# }))) -# row.names(cool_techs_by_pid) = cool_techs -# -# type_general = unlist(strsplit( cool_techs, '[.]' ))[seq(1,length(unlist(strsplit( cool_techs, '[.]' ))),by=2)] -# cool_general = unlist(strsplit( cool_techs, '[.]' ))[seq(2,length(unlist(strsplit( cool_techs, '[.]' ))),by=2)] -# cool_techs_shares_by_pid = data.frame( do.call( cbind, lapply(1:length(region_units.spdf@data$REGION), function(r){ as.matrix( unlist( lapply( 1:length(cool_techs), function(z){ -# share = cool_techs_by_pid[z,r] / sum( c( cool_techs_by_pid[ which( as.character(type_general) == as.character(type_general[z]) ), r] ), na.rm = TRUE) -# if( is.na(share) | length(share) == 0 ){share = round( sum( c( cool_techs_by_pid[ which( as.character(cool_general) == as.character(cool_general[z]) ), r] ), na.rm = TRUE) / sum( c( cool_techs_by_pid[ , r] ), na.rm = TRUE), digits = 3)} -# return(round(share, digits = 3)) } ) ) ) } ) ) ) -# row.names(cool_techs_shares_by_pid) = cool_techs -# names(cool_techs_shares_by_pid) = as.character(region_units.spdf@data$REGION) -# cool_techs_shares_by_pid$cooling_utype = as.character(cool_techs) -# cool_techs_shares_by_pid$cooling = as.character(cool_general) -# cool_techs_shares_by_pid$utype = as.character(type_general) -# cool_techs_shares_by_pid = cool_techs_shares_by_pid[,c('utype','cooling',as.character(region_units.spdf@data$REGION))] -# cool_techs_shares_by_pid = cool_techs_shares_by_pid[ order( cool_techs_shares_by_pid$utype ), ] -# -# # This will be the file -# write.csv(cool_techs_shares_by_pid,paste0(data_subf,'/cool_techs_region_share.csv'),row.names = FALSE) -# -# #add 'mix_' to the columns names for regions -# cool_techs_shares_by_pid2 = cool_techs_shares_by_pid -# new_names = paste0('mix_', names(cool_techs_shares_by_pid2)[!names(cool_techs_shares_by_pid2) %in% c('utype','cooling')] ) -# names(cool_techs_shares_by_pid2)[!names(cool_techs_shares_by_pid2) %in% c('utype','cooling')] = new_names -# -# # add the data to the cooltech_cost_and_shares_ssp_msg.csv file -# cooltech_cost_shares = read.csv(paste0(data_subf,'/cooltech_cost_and_shares_ssp_msg.csv'),stringsAsFactors=FALSE) -# cooltech_cost_shares = cooltech_cost_shares %>% -# select(utype, cooling,investment_million_USD_per_MW_low, investment_million_USD_per_MW_mid, investment_million_USD_per_MW_high) %>% -# left_join(cool_techs_shares_by_pid2) -# -# # write new file -# write.csv(cool_techs_shares_by_pid,paste0(data_subf,'/cooltech_cost_and_shares_ssp_msg.csv'),row.names = FALSE)