# Load interpolated precipitation data
#---------------------------------------------------------
print('import interpolated precipitation data')
interpolated_precipitation_data = np.load(
    stationprecippath + '\interpolated_precipitation_newmethod.npy')
precip['date_meteoswiss'] = interpolated_precipitation_data[0, :]

interp_ind = treenetstationnames.index(treenetstation)
precip['precip_interpolated'] = interpolated_precipitation_data[
    interp_ind + 1, :].astype(float)

#---------------------------------------------------------
# Import processed combiprecip data
# Acess data with combiprecip_data[()][key]
#---------------------------------------------------------
combiprecip_data = import_combiprecip(combiprecippath=combiprecippath,processing_combiprecip='no',\
                                      save_combiprecip='yes')

#---------------------------------------------------------
# Extract location from combiprecip dataset
#---------------------------------------------------------
station_index = np.where(
    combiprecip_data[()]['combiprecip'][0, :] == station_id)[0][0]
precip['combiprecip'] = combiprecip_data[()]['combiprecip'][1:, station_index]
precip['date_combiprecip'] = np.array(combiprecip_data[()]['date_combiprecip'])

#---------------------------------------------------------
# Find out which timespans are covered by the 3 datasets
#---------------------------------------------------------
# Find latest starting date
if (precip['date_combiprecip'][0] > precip['date_meteoswiss'][0]) and \
   (precip['date_combiprecip'][0] > precip['date_hourly_UTC'][0]):
    stationprecippath + '\interpolated_precipitation_version3.npy')
#interpolated_precipitation_data = np.load(stationprecippath+'\interpolated_precipitation_newmethod.npy')
#interpolated_precipitation_data = np.load(stationprecippath+'\interpolated_precipitation_standardgradient.npy')

precip['date_meteoswiss'] = interpolated_precipitation_data[0, :]

interp_ind = treenetstationnames.index(treenetstation)
precip['precip_interpolated'] = interpolated_precipitation_data[
    interp_ind + 1, :].astype(float)

#---------------------------------------------------------
# Import combiprecip data
# Note: Combiprecip data has gaps --> needs processing
# Option to process or load the processed data
#---------------------------------------------------------
combiprecip_data = import_combiprecip(combiprecippath=combiprecippath,processing_combiprecip=processing_combiprecip,\
                                      save_combiprecip=save_combiprecip)

#---------------------------------------------------------
# Extract location from combiprecip dataset
#---------------------------------------------------------
station_index = np.where(
    combiprecip_data[()]['combiprecip'][0, :] == station_id)[0][0]
precip['combiprecip'] = combiprecip_data[()]['combiprecip'][1:, station_index]
precip['date_combiprecip'] = np.array(combiprecip_data[()]['date_combiprecip'])

#---------------------------------------------------------
# Find out which timespans are covered by the 3 datasets
#---------------------------------------------------------
# Find latest starting date
if (precip['date_combiprecip'][0] > precip['date_meteoswiss'][0]) and \
   (precip['date_combiprecip'][0] > precip['date_hourly_UTC'][0]):