Commit b4d33ded authored by Marcais Jean's avatar Marcais Jean
Browse files

Add delta V computation

parent bde0a8fb
import numpy as np
import pandas as pd
......@@ -81,8 +82,8 @@ class HydroClimaticFluxes(object):
# self.intersect_safran_gpd_and_contour(Ptot_gpd, catchment_contour_shp, 'Ptot')
ET0_gpd = self.extract_safran_variable(foldername, 'ET0')
self.intersect_safran_gpd_and_contour(ET0_gpd, catchment_contour_shp, 'ET0')
# Tair_gpd = self.extract_safran_variable(foldername, 'Tair')
# self.intersect_safran_gpd_and_contour(Tair_gpd, catchment_contour_shp, 'Tair')
Tair_gpd = self.extract_safran_variable(foldername, 'Tair')
self.intersect_safran_gpd_and_contour(Tair_gpd, catchment_contour_shp, 'Tair')
Snow_gpd = self.extract_safran_variable(foldername, 'Snow')
self.intersect_safran_gpd_and_contour(Snow_gpd, catchment_contour_shp, 'Snow')
Rain_gpd = self.extract_safran_variable(foldername, 'Rain')
......@@ -101,6 +102,19 @@ class HydroClimaticFluxes(object):
how=merging_option).sort_values(by='Datetime')
return hydroclim_dataframe
def compute_dV(self, field_capacity=200):
hydroclim_dataframe = self.merge_time_series('inner')
hydroclim_dataframe['dV'] = np.NaN
hydroclim_dataframe = hydroclim_dataframe.reset_index(drop=True)
for i, row in hydroclim_dataframe.iterrows():
if i==0:
hydroclim_dataframe.loc[i, 'dV'] = field_capacity
else:
alpha = np.min([hydroclim_dataframe.loc[i-1, 'dV']/field_capacity, 1])
hydroclim_dataframe.loc[i, 'dV'] = hydroclim_dataframe.loc[i, 'Ptot'] - hydroclim_dataframe.loc[
i, 'Q'] - alpha * hydroclim_dataframe.loc[i, 'ET0'] + hydroclim_dataframe.loc[i - 1, 'dV']
return hydroclim_dataframe
@staticmethod
def test():
foldername = '/home/jean.marcais/Donnees/BanqueHydro/'
......
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