Commit 1a3ae83c authored by Laura LINDEPERG's avatar Laura LINDEPERG
Browse files

mean Pnet extraction

parent 7bd02e73
......@@ -96,6 +96,55 @@ for i in watershed_code:
# infile_i.close()
# *************************** A piece of code which aims at extracting mean values of Pnet (Ptot-ET0) from safran timeseries
shp_watersheds_path = 'C:/Users/laura.lindeperg/Documents/DonneesLaura/Watersheds/616_Catchments.shp'
shp_watersheds = gpd.read_file(shp_watersheds_path)
safran_foldername = 'C:/Users/laura.lindeperg/Documents/DonneesLaura/Watersheds/SAFRAN/'
# List of the stations'codes
watershed_code = shp_watersheds.loc[:,'Code']
# Get a sample of them for test
code_for_test = watershed_code.loc[0:1]
values_of_Pnet_moy = pd.DataFrame()
# for i in code_for_test:
for i in watershed_code:
safran_timeseries_i = pd.read_csv(safran_foldername+i+'_safran_timeseries.csv')
P_net_i = safran_timeseries_i['Ptot']-safran_timeseries_i['ET0']
P_net_moy_i = P_net_i.mean()
new_row = {'code' : i, 'P_net_moy' : P_net_moy_i}
values_of_Pnet_moy = values_of_Pnet_moy.append(new_row, ignore_index=True)
# And save it
# values_of_Pnet_moy.to_csv('616_stations_Pnet_moy_df.csv', index=False)
# df_v0 = pd.read_csv('4_stations_df_v0.csv')
# df_shp = pd.read_csv('4_stations_df_shp_read_from_files.csv')
# df_brgm = pd.read_csv('4_stations_df_shpANDbrgm_read_from_files.csv')
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment