# multiply recharge by area
recharge_time_series = [i * area for i in recharge_time_series]

BFImax = 0.5

alpha = alpha_reg(discharge_time_series, area)
baseflow_time_series = filter_Eck(BFImax, discharge_time_series, alpha)

#plt.plot(discharge_time_series)
#plt.plot(baseflow_time_series)

popt, pcov, frequency_input, power_spectrum_result = discharge_ftf_fit(
    recharge_time_series,
    baseflow_time_series,
    time_step_size,
    1000,
    method='scipyffthalf',
    initial_guess=1e-2)
power_spectrum_input = power_spectrum(recharge_time_series,
                                      power_spectrum_result,
                                      time_step_size,
                                      method="scipyffthalf",
                                      o_i="i")[1]

plt.loglog(frequency_input, power_spectrum_result)
plt.loglog(frequency_input, power_spectrum_input)

#data = np.hstack((spectrum_input, power_spectrum_result))
#plot_spectrum(data, frequency_input, path=path, name="test")
'''
Beispiel #2
0
     "Spectral analysis for the baseflow (not every functionality is considered (e.g. cut_index, norm))"
 )
 # If the current observation point is equal to the aquifer
 # length, it is assumed that this polyline-file contains the
 # velocities to calculate the baseflow. First, the baseflow
 # is calculated and afterwards, the diffusivity is derived
 # with the spectral analysis.
 task_id = get_ogs_task_id(path_to_project)
 baseflow = get_baseflow_from_polyline(
     task_id, path_to_project,
     path_to_project + "/" + task_id + "_ply_obs_01000_t" +
     str(len(obs_point_list)) + "_GROUNDWATER_FLOW.tec")
 # multiply the recharge time series with the aquifer length to get the total inflow
 recharge = recharge_time_series * aquifer_length
 try:
     D, D_cov, frequency, Sqq = discharge_ftf_fit(
         recharge, baseflow, time_step_size, aquifer_length)
 except RuntimeError:
     print("Optimal parameters not found...")
     D[0], D_cov[0] = [np.nan, np.nan], [[np.nan, np.nan],
                                         [np.nan, np.nan]]
     print("popt and pcov have been set to np.nan")
 except ValueError:
     print(
         "either ydata or xdata contain NaNs, or if incompatible options are used"
     )
     D[0], D_cov[0] = [np.nan, np.nan], [[np.nan, np.nan],
                                         [np.nan, np.nan]]
 except OptimizeWarning:
     print(
         "Covariance of the parameters could not be estimated.")
     #popt, pcov = [np.nan, np.nan], [[np.nan, np.nan],[np.nan, np.nan]]
Beispiel #3
0
    baseflow_tmp = np.loadtxt(path_to_multiple_projects + "/" + dir + "/" +
                              filename)
    baseflow = np.column_stack((baseflow_tmp, baseflow))
baseflow_sum_1301_1400 = np.sum(baseflow, axis=1)

# load the ogs input parameter from a file
kf_list_file = open(path_to_kf_values, "r")
for i, line in enumerate(kf_list_file):
    if i == 1:
        splitted_line = line.strip().split(", ")
        kf_geomean = float(splitted_line[0])
        kf_harmean = float(splitted_line[1])
        kf_arimean = float(splitted_line[2])

# calculate the power spectrum for 1001_1100: White Noise, 0.01
D_1001_1100, D_cov, frequency_1001_1100, power_spectrum_1001_1100 = discharge_ftf_fit(
    recharge_1001_1100, baseflow_sum_1001_1100, 86400, 1000)
power_spectrum_1001_1100_anal = discharge_ftf(frequency_1001_1100, D_1001_1100,
                                              aquifer_length)
power_spectrum_1001_1100_anal = np.reshape(
    power_spectrum_1001_1100_anal, (len(power_spectrum_1001_1100_anal), ))
power_spectrum_1001_1100 = np.reshape(power_spectrum_1001_1100,
                                      (len(power_spectrum_1001_1100), ))
figtxt = "OGS Input Parameter: Ss = %1.3e, D_geo = %1.3e, D_har = %1.3e, D_ari = %1.3e" % (
    Ss1,
    kf_geomean / Ss1,
    kf_harmean / Ss1,
    kf_arimean / Ss1,
) + "\nDerived Parameter:    D = %1.3e, D_cov = %1.1e" % (
    D_1001_1100[0],
    D_cov[0],
)