Commit ad38f71a authored by Laura LINDEPERG's avatar Laura LINDEPERG
Browse files

Select qualitative hydro years

parent d3b3f67a
......@@ -15,6 +15,10 @@ class HydroClimaticFluxes(object):
discharge_timeseries = pd.read_csv(filepath)
self.discharge_timeseries = discharge_timeseries
def keep_clean_HydroYear(self):
import read_BankHydro as readBH
self.discharge_timeseries = readBH.delete_HydroYear_withNan(self.discharge_timeseries)
def extract_safran_variable(self, foldername, quantity_to_retrieve='Ptot'):
import netCDF4 as nc
......@@ -35,6 +35,7 @@ class Watershed(object):
from HydroClimaticFluxes import HydroClimaticFluxes
self.hydro_climatic_fluxes = HydroClimaticFluxes(self.code)
self.hydro_climatic_fluxes.extract_discharge_timeseries(foldername, type_data='BanqueHydro')
# self.hydro_climatic_fluxes.extract_discharge_timeseries(foldername, type_data='csv_file')
def extract_SAFRAN_forcings(self, foldername):
......@@ -106,8 +106,9 @@ def delete_HydroYear_withNan(df_obs, NaNvalues_number=20):
# create a NaN column with 1 value for NaN values
df_obs['NaN'] = df_obs['Q'].isnull().astype('int64')
# create an Hydrological Date column with 1st of January corresponding to 1st of september
df_obs['HydroDate'] = df_obs.index + pd.DateOffset(months=-8)
# create an Hydrological Date column with 1st of January corresponding to 1st of september -> does it mean "beginning of the hydrological year corresponding to 1st of september" ?
# df_obs['HydroDate'] = df_obs.index + pd.DateOffset(months=-8)
df_obs['HydroDate'] = df_obs.Datetime + pd.DateOffset(months=-8)
# delineate from that the Hydro Year
df_obs['HydroYear'] = pd.DatetimeIndex(df_obs['HydroDate']).year
# get yearly average with number of NaN values per year
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