def subset_preind(): # subset the historical file into overlapping 12 year files, starting in 1899 preind_long_file = get_preind_output_path() preind_path = preind_long_file[0:preind_long_file.rfind("/")] + "/" n_months = 12 st_yr = 1855 out_fname = preind_path + "so2dms_prei_N96_" + str(st_yr) + "_" + str(st_yr) subset_ancil(preind_long_file, out_fname, st_yr, 1, n_months) print out_fname
def subset_rcp85(): # subset the rcp85 file into overlapping 12 year files, starting in 2009 rcp_long_file = get_rcp85_output_path() rcp_path = rcp_long_file[0:rcp_long_file.rfind("/")] + "/" n_months = 144 for st_yr in range(2009,2099,10): out_fname = rcp_path + "so2dms_rcp85_N96_" + str(st_yr) + "_" + str(st_yr+11) subset_ancil(rcp_long_file, out_fname, st_yr, 1, n_months) print out_fname
def subset_historical(): # subset the historical file into overlapping 12 year files, starting in 1899 hist_long_file = get_historical_output_path() hist_path = hist_long_file[0:hist_long_file.rfind("/")] + "/" n_months = 144 for st_yr in range(1899,1999,10): out_fname = hist_path + "so2dms_hist_N96_" + str(st_yr) + "_" + str(st_yr+11) subset_ancil(hist_long_file, out_fname, st_yr, 1, n_months) print out_fname
def subset_preind(): # subset the historical file into overlapping 12 year files, starting in 1899 preind_long_file = get_preind_output_path() preind_path = preind_long_file[0:preind_long_file.rfind("/")] + "/" n_months = 12 st_yr = 1855 out_fname = preind_path + "so2dms_prei_N96_" + str(st_yr) + "_" + str( st_yr) subset_ancil(preind_long_file, out_fname, st_yr, 1, n_months) print out_fname
def subset_rcp85(): # subset the rcp85 file into overlapping 12 year files, starting in 2009 rcp_long_file = get_rcp85_output_path() rcp_path = rcp_long_file[0:rcp_long_file.rfind("/")] + "/" n_months = 144 for st_yr in range(2009, 2099, 10): out_fname = rcp_path + "so2dms_rcp85_N96_" + str(st_yr) + "_" + str( st_yr + 11) subset_ancil(rcp_long_file, out_fname, st_yr, 1, n_months) print out_fname
def subset_historical(): # subset the historical file into overlapping 12 year files, starting in 1899 hist_long_file = get_historical_output_path() hist_path = hist_long_file[0:hist_long_file.rfind("/")] + "/" n_months = 144 for st_yr in range(1899, 1999, 10): out_fname = hist_path + "so2dms_hist_N96_" + str(st_yr) + "_" + str( st_yr + 11) subset_ancil(hist_long_file, out_fname, st_yr, 1, n_months) print out_fname
def create_rcp_crossover(rcp_fname, out_fname): # create the rcp26 file where the crossover occurs, i.e. at the end of the # historical period and the beginning of the RCP period hist_long_file = get_historical_output_path() rcp_long_file = rcp_fname # create the two temporary subset files hist_temp_name = "hist_temp" rcp_temp_name = "rcp_temp" # subset the files subset_ancil(hist_long_file, hist_temp_name, 1999, 1, 72) subset_ancil(rcp_long_file, rcp_temp_name, 2005, 1, 72) # concatenate the two temporary files together concat_files([hist_temp_name, rcp_temp_name], out_fname) # delete the temp files os.remove(hist_temp_name) os.remove(rcp_temp_name)