verify pyEMU Influence class


In [2]:
%matplotlib inline
import os
import shutil
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import pyemu


setting random seed

In [3]:
os.system("infstat.exe pf14 pf14.infstat.out")


Out[3]:
0

In [6]:
pst = pyemu.Pst("pf14.pst")
with open("pf14.infstat.out",'r') as f:
    while True:
        line = f.readline()
        if line == "":
            raise Exception()
        if "cook's d" in line.lower():
            f.readline()
            start = f.tell()
            break
    df_cooks = pd.read_csv(f,delim_whitespace=True,nrows=pst.nobs)
    f.seek(start)
    while True:
        line = f.readline()
        if line == "":
            raise Exception()
        if "dfbetas ----" in line.lower():
            f.readline()
            break
    df_dfbetas = pd.read_csv(f,delim_whitespace=True,nrows=pst.nobs)

In [7]:
df_dfbetas


Out[7]:
kparkfalls__ bedrockk____ pfrecharge__ cdrainage___ cseepage____ cstream_____
oid:_1_poor 7.296465e-07 -9.149621e-08 -2.501412e-07 2.592756e-07 5.521073e-08 3.492918e-07
oid:_12_poor -9.266424e-05 -2.229512e-05 -9.277893e-05 -6.684104e-05 -1.221704e-04 1.412851e-05
oid:_13_fair -1.226074e-03 1.386711e-03 -1.958215e-03 -1.102326e-03 -7.066664e-04 -2.818863e-03
oid:_16_fair -4.736516e-03 1.744334e-03 -3.499406e-03 -3.766151e-03 -2.191803e-03 -5.301673e-03
oid:_18_fair 1.195891e-03 -2.462083e-04 -4.578619e-04 9.907016e-04 -2.846806e-04 7.982015e-04
oid:_23_fair 2.407594e-04 -7.323613e-05 4.152173e-04 9.240213e-04 -1.667119e-05 3.319723e-04
oid:_36_fair 1.276520e-05 1.154360e-06 -1.615328e-05 9.858149e-07 -9.042215e-07 -6.951450e-06
oid:_39_fair -1.852110e-04 4.972137e-05 -7.172616e-04 3.004617e-04 -6.077521e-04 -4.295872e-04
oid:_46_fair 1.722479e-04 -3.443222e-05 1.504791e-04 -8.169563e-05 1.598217e-04 2.323584e-04
oid:_50_fair 3.270414e-06 3.121916e-05 1.699695e-07 9.276776e-05 1.378271e-05 -9.581402e-05
oid:_52_fair 1.213160e-03 4.086753e-05 -2.824818e-03 1.964492e-03 -1.752118e-03 -7.727240e-04
oid:_55_best -5.666290e-01 -2.689800e-01 4.374430e-01 -4.198220e-01 -3.233550e-01 8.818350e-01
oid:_56_best -3.264982e-03 -8.095768e-04 3.239579e-03 1.159243e-03 -1.642038e-03 2.966585e-03
oid:_57_poor -4.532865e-04 1.761014e-05 1.236982e-04 -1.205742e-04 -1.286501e-04 -1.058353e-04
oid:_58_best 4.252336e-02 -5.760904e-03 3.926031e-02 9.242621e-02 1.050311e-02 3.172461e-02
oid:_59_best 5.473575e-03 -8.508650e-04 4.066043e-03 1.215869e-02 4.951453e-04 4.017677e-03
oid:_60_best -2.384392e-02 1.335925e-03 -3.257783e-02 -1.076524e-02 -2.765823e-02 -2.223241e-02
oid:_62_best -1.060300e-01 -6.537604e-04 -6.423140e-02 3.121743e-02 -1.191440e-01 -4.000235e-02
oid:_63_best 1.512829e-03 -2.740537e-04 1.277748e-03 3.378733e-03 1.640163e-04 1.296023e-03
oid:_64_best -1.141996e-06 6.267134e-07 -2.012524e-06 -1.211248e-06 -4.507051e-07 -3.024736e-06
oid:_65_best 1.094809e-03 -2.187796e-04 9.790318e-04 2.365057e-03 1.363439e-04 1.044668e-03
oid:_66_best 1.452616e-02 5.306078e-03 1.515715e-02 -1.810634e-03 2.731726e-02 -7.971612e-03
oid:_68_best -2.443001e-03 5.921310e-04 -2.288433e-03 -6.845766e-03 3.017950e-04 -2.488931e-03
oid:_69_best -1.658546e-03 3.786241e-04 -1.585165e-03 -4.355692e-03 4.841604e-05 -1.662484e-03
oid:_70_best 1.057417e-02 -1.811088e-03 9.925678e-03 2.624260e-02 1.066260e-03 8.730259e-03
oid:_71_best -2.609116e-02 3.778124e-03 -3.395400e-02 -2.783275e-02 -2.548809e-02 -1.941925e-02
oid:_72_best -7.747017e-03 1.395344e-03 -7.143029e-03 -1.847750e-02 -8.327886e-04 -6.681258e-03
oid:_74_best 4.580092e-03 -7.290260e-03 1.952686e-02 6.511154e-03 7.402533e-03 1.883242e-02
oid:_75_best 1.593946e-02 3.131920e-04 6.996901e-03 -4.468503e-03 1.653594e-02 4.345851e-03
oid:_76_best 3.876956e-02 -3.151701e-02 1.148710e-01 5.678803e-02 2.246881e-02 1.524580e-01
... ... ... ... ... ... ...
ap_flds_fcrd_mix 1.847420e-01 1.908010e-01 -3.459750e-01 -2.987732e-02 -3.750810e-01 5.388870e-01
ap_siev_fr124_mix 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
ap_siev_shp_rd_gw 2.128587e-03 -1.755810e-03 3.550428e-03 1.750350e-03 1.039231e-03 5.717540e-03
ap_mainbranch_gw 7.311154e-03 2.917270e-03 -6.755809e-03 3.023859e-03 -1.020443e-02 1.873712e-02
ap_dsofdam_gw -2.641223e-02 5.248929e-03 3.474554e-04 -1.430904e-02 1.242596e-02 -5.323778e-02
ap_wflowing_trib_sw 3.141650e-03 8.644062e-04 -4.193634e-03 -1.451959e-03 -1.422700e-04 -3.118274e-04
ap_eflowing_trib_sw 3.294098e-03 3.798112e-03 -1.934201e-03 -3.745622e-04 -1.009999e-03 3.847208e-03
usfs243el01_gw_b 1.550460e-01 1.705330e+00 -3.202280e+00 -4.820140e-01 -2.938910e+00 1.772380e+00
usfs_243el02_gw_b 1.154110e+00 -3.562340e-01 -5.769440e-01 4.207910e-01 -4.946170e-01 1.638920e+00
usfs_245el05_gw_a 1.157901e-04 -1.862050e-05 -2.167982e-05 3.826667e-05 1.794637e-05 7.544975e-05
usfs_243el06_gw_a -3.231273e-03 -2.570688e-02 1.160110e-02 -5.468472e-03 2.145171e-02 -2.002016e-02
usfs_243el07_gw_b 4.888237e-05 -2.433824e-04 5.038613e-04 -2.178480e-05 3.952256e-04 1.520559e-04
usfs_244el08_gw_b 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
usfs_244el09_sw_b 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
usfs_246el10_sw_a 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
usfs_239fl3_gw_b -2.710090e-01 7.113262e-02 -1.213120e-01 6.017710e-01 5.644860e-01 7.471225e-03
usfs_240fl5_gw_b -5.358720e-01 7.474120e-01 2.282320e-01 1.206750e-01 9.239810e-01 -1.235860e+00
usfs_23811_gw_a 9.314522e-05 -1.691528e-05 4.042372e-05 9.459025e-06 5.919090e-05 8.321310e-05
usfs_24207_mix_b -1.666822e-03 2.621841e-04 7.653152e-05 2.046151e-04 -5.489507e-04 -1.412069e-03
usfs_24212_gw_a 2.540481e-03 2.527784e-04 -5.960606e-04 -1.570788e-03 9.698140e-04 2.112661e-03
usfs_24213_mix_b -3.170590e-01 2.462020e-01 -1.397030e-01 1.647100e-01 -3.656730e-01 -2.876909e-02
usfs_24214_mix_a -2.409930e-01 3.795850e-01 -3.269080e-01 9.549506e-02 -5.428940e-01 2.938930e-01
usfs_24216_mix_b 2.123845e-06 5.033077e-07 3.547475e-06 4.556850e-06 1.553288e-06 7.650433e-07
usfs_24218_mix_a 8.818569e-04 -1.049607e-04 1.687892e-04 5.282090e-05 3.330889e-04 9.137465e-04
usfs_24229_mix_b 1.404012e-02 -2.769141e-03 1.992860e-04 -4.702794e-03 6.449417e-03 1.249638e-02
usfs_24230_mix_b -3.049370e-01 2.579360e-01 -1.870230e-01 1.246820e-01 -3.938000e-01 2.227556e-02
usfs_24232_mix_b -1.659150e-01 2.412460e-01 -2.314790e-01 1.864521e-02 -3.509680e-01 1.898160e-01
usfs_24233_gw_b 9.755548e-02 -2.519015e-02 3.009167e-02 -1.698206e-02 5.654746e-02 1.089930e-01
usfs_24234_mix_b 2.296379e-02 -2.981926e-03 1.872027e-02 7.919997e-03 1.795283e-02 1.853278e-02
usfs_24235_gw_b 1.669350e-03 -2.167707e-04 1.360868e-03 5.757432e-04 1.305079e-03 1.347238e-03

1015 rows × 6 columns


In [ ]: