Bias Correction by Linear Scaling’ Approach using Python
1.4 هزار بار بازدید -
2 سال پیش
-
df_result = {}df = pd.DataFrame(dtype
df_result = {}
df = pd.DataFrame(dtype = np.float64)
for i in zip(TMD.columns, RCM.columns):
TMD_station, RCM_station = i
Jan_obs_mean = (TMD.loc[1, [TMD_station]]).mean()
Feb_obs_mean = (TMD.loc[2, [TMD_station]]).mean()
Mar_obs_mean = (TMD.loc[3, [TMD_station]]).mean()
Apr_obs_mean = (TMD.loc[4, [TMD_station]]).mean()
May_obs_mean = (TMD.loc[5, [TMD_station]]).mean()
Jun_obs_mean = (TMD.loc[6, [TMD_station]]).mean()
Jul_obs_mean = (TMD.loc[7, [TMD_station]]).mean()
Aug_obs_mean = (TMD.loc[8, [TMD_station]]).mean()
Sep_obs_mean = (TMD.loc[9, [TMD_station]]).mean()
Oct_obs_mean = (TMD.loc[10, [TMD_station]]).mean()
Nov_obs_mean = (TMD.loc[11, [TMD_station]]).mean()
Dec_obs_mean = (TMD.loc[12, [TMD_station]]).mean()
Jan_his_mean = (RCM.loc[1, [RCM_station]]).mean()
Feb_his_mean = (RCM.loc[2, [RCM_station]]).mean()
Mar_his_mean = (RCM.loc[3, [RCM_station]]).mean()
Apr_his_mean = (RCM.loc[4, [RCM_station]]).mean()
May_his_mean = (RCM.loc[5, [RCM_station]]).mean()
Jun_his_mean = (RCM.loc[6, [RCM_station]]).mean()
Jul_his_mean = (RCM.loc[7, [RCM_station]]).mean()
Aug_his_mean = (RCM.loc[8, [RCM_station]]).mean()
Sep_his_mean = (RCM.loc[9, [RCM_station]]).mean()
Oct_his_mean = (RCM.loc[10, [RCM_station]]).mean()
Nov_his_mean = (RCM.loc[11, [RCM_station]]).mean()
Dec_his_mean = (RCM.loc[12, [RCM_station]]).mean()
Jan_mean = Jan_obs_mean.sub(Jan_his_mean.squeeze())
Feb_mean = Feb_obs_mean.sub(Feb_his_mean.squeeze())
Mar_mean = Mar_obs_mean.sub(Mar_his_mean.squeeze())
Apr_mean = Apr_obs_mean.sub(Apr_his_mean.squeeze())
May_mean = May_obs_mean.sub(May_his_mean.squeeze())
Jun_mean = Jun_obs_mean.sub(Jun_his_mean.squeeze())
Jul_mean = Jul_obs_mean.sub(Jul_his_mean.squeeze())
Aug_mean = Aug_obs_mean.sub(Aug_his_mean.squeeze())
Sep_mean = Sep_obs_mean.sub(Sep_his_mean.squeeze())
Oct_mean = Oct_obs_mean.sub(Oct_his_mean.squeeze())
Nov_mean = Nov_obs_mean.sub(Nov_his_mean.squeeze())
Dec_mean = Dec_obs_mean.sub(Dec_his_mean.squeeze())
RCM_Jan = RCM.loc[1, [RCM_station]] + Jan_mean.values
RCM_Feb = RCM.loc[2, [RCM_station]] + Feb_mean.values
RCM_Mar = RCM.loc[3, [RCM_station]] + Mar_mean.values
RCM_Apr = RCM.loc[4, [RCM_station]] + Apr_mean.values
RCM_May = RCM.loc[5, [RCM_station]] + May_mean.values
RCM_Jun = RCM.loc[6, [RCM_station]] + Jun_mean.values
RCM_Jul = RCM.loc[7, [RCM_station]] + Jul_mean.values
RCM_Aug = RCM.loc[8, [RCM_station]] + Aug_mean.values
RCM_Sep = RCM.loc[9, [RCM_station]] + Sep_mean.values
RCM_Oct = RCM.loc[10, [RCM_station]] + Oct_mean.values
RCM_Nov = RCM.loc[11, [RCM_station]] + Nov_mean.values
RCM_Dec = RCM.loc[12, [RCM_station]] + Dec_mean.values
df = pd.concat([RCM_Jan, RCM_Feb, RCM_Mar, RCM_Apr, RCM_May, RCM_Jun, RCM_Jul, RCM_Aug, RCM_Sep, RCM_Oct, RCM_Nov, RCM_Dec])
df.set_index(df_date.index , inplace = True)
df_result[TMD_station] = df
df = pd.DataFrame(dtype = np.float64)
for i in zip(TMD.columns, RCM.columns):
TMD_station, RCM_station = i
Jan_obs_mean = (TMD.loc[1, [TMD_station]]).mean()
Feb_obs_mean = (TMD.loc[2, [TMD_station]]).mean()
Mar_obs_mean = (TMD.loc[3, [TMD_station]]).mean()
Apr_obs_mean = (TMD.loc[4, [TMD_station]]).mean()
May_obs_mean = (TMD.loc[5, [TMD_station]]).mean()
Jun_obs_mean = (TMD.loc[6, [TMD_station]]).mean()
Jul_obs_mean = (TMD.loc[7, [TMD_station]]).mean()
Aug_obs_mean = (TMD.loc[8, [TMD_station]]).mean()
Sep_obs_mean = (TMD.loc[9, [TMD_station]]).mean()
Oct_obs_mean = (TMD.loc[10, [TMD_station]]).mean()
Nov_obs_mean = (TMD.loc[11, [TMD_station]]).mean()
Dec_obs_mean = (TMD.loc[12, [TMD_station]]).mean()
Jan_his_mean = (RCM.loc[1, [RCM_station]]).mean()
Feb_his_mean = (RCM.loc[2, [RCM_station]]).mean()
Mar_his_mean = (RCM.loc[3, [RCM_station]]).mean()
Apr_his_mean = (RCM.loc[4, [RCM_station]]).mean()
May_his_mean = (RCM.loc[5, [RCM_station]]).mean()
Jun_his_mean = (RCM.loc[6, [RCM_station]]).mean()
Jul_his_mean = (RCM.loc[7, [RCM_station]]).mean()
Aug_his_mean = (RCM.loc[8, [RCM_station]]).mean()
Sep_his_mean = (RCM.loc[9, [RCM_station]]).mean()
Oct_his_mean = (RCM.loc[10, [RCM_station]]).mean()
Nov_his_mean = (RCM.loc[11, [RCM_station]]).mean()
Dec_his_mean = (RCM.loc[12, [RCM_station]]).mean()
Jan_mean = Jan_obs_mean.sub(Jan_his_mean.squeeze())
Feb_mean = Feb_obs_mean.sub(Feb_his_mean.squeeze())
Mar_mean = Mar_obs_mean.sub(Mar_his_mean.squeeze())
Apr_mean = Apr_obs_mean.sub(Apr_his_mean.squeeze())
May_mean = May_obs_mean.sub(May_his_mean.squeeze())
Jun_mean = Jun_obs_mean.sub(Jun_his_mean.squeeze())
Jul_mean = Jul_obs_mean.sub(Jul_his_mean.squeeze())
Aug_mean = Aug_obs_mean.sub(Aug_his_mean.squeeze())
Sep_mean = Sep_obs_mean.sub(Sep_his_mean.squeeze())
Oct_mean = Oct_obs_mean.sub(Oct_his_mean.squeeze())
Nov_mean = Nov_obs_mean.sub(Nov_his_mean.squeeze())
Dec_mean = Dec_obs_mean.sub(Dec_his_mean.squeeze())
RCM_Jan = RCM.loc[1, [RCM_station]] + Jan_mean.values
RCM_Feb = RCM.loc[2, [RCM_station]] + Feb_mean.values
RCM_Mar = RCM.loc[3, [RCM_station]] + Mar_mean.values
RCM_Apr = RCM.loc[4, [RCM_station]] + Apr_mean.values
RCM_May = RCM.loc[5, [RCM_station]] + May_mean.values
RCM_Jun = RCM.loc[6, [RCM_station]] + Jun_mean.values
RCM_Jul = RCM.loc[7, [RCM_station]] + Jul_mean.values
RCM_Aug = RCM.loc[8, [RCM_station]] + Aug_mean.values
RCM_Sep = RCM.loc[9, [RCM_station]] + Sep_mean.values
RCM_Oct = RCM.loc[10, [RCM_station]] + Oct_mean.values
RCM_Nov = RCM.loc[11, [RCM_station]] + Nov_mean.values
RCM_Dec = RCM.loc[12, [RCM_station]] + Dec_mean.values
df = pd.concat([RCM_Jan, RCM_Feb, RCM_Mar, RCM_Apr, RCM_May, RCM_Jun, RCM_Jul, RCM_Aug, RCM_Sep, RCM_Oct, RCM_Nov, RCM_Dec])
df.set_index(df_date.index , inplace = True)
df_result[TMD_station] = df
2 سال پیش
در تاریخ 1401/03/28 منتشر شده
است.
1,498
بـار بازدید شده