Import Dependencies


In [1]:
%matplotlib inline
import os
import sys
import platform
import matplotlib

import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.dates as dates
import matplotlib.ticker as tick
from matplotlib.backends.backend_pdf import PdfPages
from datetime import datetime,timedelta
from pylab import rcParams
rcParams['figure.figsize'] = 15, 10

In [2]:
import ipywidgets as widgets
widgets.Widget.widget_types.values()
from IPython.display import display
import traitlets

In [3]:
# custom functions for transducer data import
#import Snake_Valley_Data_Import as svdi
import wellapplication.transport as svdi

Declare software versions


In [4]:
print("Operating System " + platform.system() + " " + platform.release())
print("Python Version " + str(sys.version))
print("Pandas Version " + str(pd.__version__))
print("Numpy Version " + str(np.__version__))
print("Matplotlib Version " + str(matplotlib.__version__))


Operating System Windows 7
Python Version 2.7.10 (default, May 23 2015, 09:40:32) [MSC v.1500 32 bit (Intel)]
Pandas Version 0.18.1
Numpy Version 1.11.0
Matplotlib Version 1.5.1

Designate root environments


In [5]:
drive = 'M:'
raw_archive_folder = drive + '/PROJECTS/Snake Valley Water/Transducer Data/Raw_data_archive'
folder = raw_archive_folder + '/2016/2016 q2/'
enteredFolder = folder + '/entered/'
checkFolder = folder + '/toCheck/'
wellinfofile = drive + raw_archive_folder + '/well table 2015-03-23.csv'

Import Connection Info For Database


In [6]:
sys.path.append(raw_archive_folder)
import engineGetter

In [7]:
if not os.path.exists(enteredFolder):
    print('Creating Output Folder')
    os.makedirs(enteredFolder)
else:
    print('Output Folder Exists')


Creating Output Folder

In [8]:
if not os.path.exists(checkFolder):
    print('Creating Check Folder')
    os.makedirs(checkFolder)
else:
    print('Check Folder Exists')


Creating Check Folder

Import Relevant Data

Well Information


In [9]:
wellinf = pd.read_csv(raw_archive_folder + '/well table 2015-03-23.csv',index_col=0)
wellinf["G_Elev_m"] = wellinf["GroundElevation"]/3.2808
wellinf["Well"] = wellinf['Well'].apply(lambda x: str(x).lower().strip())
wellinf['WellID'] = wellinf.index.values
#wellinfo = svdi.barodistance(wellinfo)
wellinfo = svdi.make_files_table(folder, wellinf)
wellinfo.to_csv(folder+"/wellinfo4.csv")

Manual Water Levels


In [10]:
manualwls = raw_archive_folder + "/All tape measurements.csv"
manual = pd.read_csv(manualwls, index_col="DateTime", engine="python")

New Barometric Pressure Data


In [11]:
pw03baro_append = folder + "\\pw03 baro 2016-08-03.xle"
pw10baro_append = folder + "\\pw10 baro 2016-08-03.xle"
pw19baro_append = folder + "\\pw19 baro 2016-08-04.xle"

Compile Barometric Pressure Data

Skip this section if you have already compiled the data to save on processing time.

Call Up Existing Data


In [12]:
pw03baro = raw_archive_folder + "\\pw03baro.csv"
pw10baro = raw_archive_folder + "\\pw10baro.csv"
pw19baro = raw_archive_folder +  "\\pw19baro.csv"

Append New Data to Existing Data


In [13]:
svdi.appendomatic(pw03baro_append,pw03baro)
svdi.appendomatic(pw10baro_append,pw10baro)
svdi.appendomatic(pw19baro_append,pw19baro)

In [14]:
# duplicated to update changes made by appendomatic
pw03baro = pd.read_csv(raw_archive_folder + "\\pw03baro.csv",index_col='DateTime',parse_dates=True)
pw10baro = pd.read_csv(raw_archive_folder + "\\pw10baro.csv",index_col='DateTime',parse_dates=True)
pw19baro = pd.read_csv(raw_archive_folder + "\\pw19baro.csv",index_col='DateTime',parse_dates=True)

In [15]:
pw03baro['pw03'] = pw03baro['Level']
pw03baro = svdi.hourly_resample(pw03baro['pw03'].to_frame())
pw10baro['pw10'] = pw10baro['Level']
pw10baro = svdi.hourly_resample(pw10baro['pw10'].to_frame())
pw19baro['pw19'] = pw19baro['Level']
pw19baro = svdi.hourly_resample(pw19baro['pw19'].to_frame())

In [16]:
baro = pd.merge(pw03baro,pw10baro,how="outer",left_index=True,right_index=True)
baro = pd.merge(baro,pw19baro,how="outer",left_index=True,right_index=True)
baro.dropna(axis=0,inplace=True)
baro['integr'] = 0 #for vented transducers

In [30]:
baro[baro.index.to_datetime()==pd.datetime(2015,11,15,10)]


Out[30]:
pw03 pw10 pw19 integr
DateTime
2015-11-15 10:00:00 2.4887 2.89 2.9464 0

In [17]:
baro[['pw03','pw10','pw19']].plot()


Out[17]:
<matplotlib.axes._subplots.AxesSubplot at 0x9a8a610>

In [18]:
baro.to_csv(raw_archive_folder + '\\baro.csv')

Water Level Tranducer Data

Export and Plot Data

Export Manual Data


In [19]:
manualwls = raw_archive_folder + "\\All tape measurements.csv"
manual = pd.read_csv(manualwls, index_col="DateTime", engine="python")
manualrecent = manual[manual.index.to_datetime() > pd.datetime(2015,6,1)]
manualrecent.dropna(inplace=True)
manualrecent.reset_index(inplace=True)
print manualrecent.dtypes
manualrecent = pd.merge(manualrecent, wellinfo, how='left',left_on='WellID', right_index=True)
manualrecent.loc[:,"MeasuredLevel"] = np.nan
manualrecent.loc[:,"Temp"] = np.nan
manualrecent.loc[:,"BaroEfficiencyCorrected"] = np.nan 
manualrecent.loc[:,"DeltaLevel"] = np.nan
manualrecent.loc[:,"DriftCorrection"] = np.nan
manualrecent.loc[:,"MeasuredBy"] = np.nan
manualrecent.loc[:,"Tape"] = 1
manualrecent.loc[:,"DTWBelowGroundSurface"] = np.nan
manualrecent.loc[:,"WaterElevation"] = np.nan
#manualrecent["DTWBelowGroundSurface"] = np.nan
manualrecent.loc[:,"DTWBelowCasing"] = manualrecent.loc[:,"MeasuredDTW"]
manualrecent.loc[:,"DTWBelowGroundSurface"] = manualrecent.loc[:,"MeasuredDTW"] - manualrecent.loc[:,"Offset"]
manualrecent.loc[:,"WaterElevation"] = manualrecent.loc[:,'GroundElevation'] - manualrecent.loc[:,"DTWBelowGroundSurface"]
print manualrecent

#outpath = pathlist[0] + '\\' + pathlist[1] + '\\' + pathlist[2] + '\\' + pathlist[3] + '\\' + pathlist[4] + '\\' + 'Manual' + '.csv'  
manualrecent.to_csv(raw_archive_folder+ 'Manual' + '.csv', index=True, columns= ["WellID","DateTime","MeasuredLevel","Temp","BaroEfficiencyCorrected","DeltaLevel",
                                             "MeasuredDTW","DriftCorrection","DTWBelowCasing","DTWBelowGroundSurface",
                                             "WaterElevation","Tape","MeasuredBy"])


DateTime        object
WellID         float64
MeasuredDTW    float64
WellName        object
dtype: object
            DateTime  WellID_x  MeasuredDTW                  WellName  \
0    6/23/2015 14:47      21.0        41.35                    PW07MX   
1    6/23/2015 14:51      20.0        48.54                     PW07B   
2    6/23/2015 14:53      19.0        46.77                     PW07A   
3    6/23/2015 15:50      23.0       101.97                     PW08B   
4    6/23/2015 15:54      22.0       102.30                     PW08A   
5    6/23/2015 16:15      30.0       210.44                     PW11D   
6    6/23/2015 16:17      31.0       210.33                     PW11E   
7    6/23/2015 16:21      28.0       215.52                     PW11B   
8    6/23/2015 16:25      29.0       215.05                     PW11C   
9    6/23/2015 16:52      72.0         8.42          Needle Point BLM   
10   6/23/2015 16:58      57.0         9.35                     SG23B   
11   6/23/2015 17:12      71.0        71.47     Snake Valley South MX   
12   6/23/2015 17:28       4.0        31.32                     PW02A   
13   6/23/2015 17:31       5.0        30.56                     PW02B   
14   6/23/2015 17:52      41.0        28.71                     AG16B   
15   6/23/2015 17:54      42.0        16.96                     AG16C   
16   6/23/2015 18:01      40.0        21.86                     AG16A   
17    6/24/2015 7:21       1.0       104.59                     PW01A   
18    6/24/2015 7:32       2.0       105.59                     PW01B   
19    6/24/2015 7:38       3.0       122.93                     PW01C   
20    6/24/2015 9:14      39.0        83.51                      AG15   
21    6/24/2015 9:48       9.0       592.91                     PW04A   
22    6/24/2015 9:58      10.0       592.70                     PW04B   
23   6/24/2015 11:00      33.0        74.24                     AG13A   
24   6/24/2015 11:03      34.0        82.42                     AG13B   
25   6/24/2015 11:05      35.0        84.10                     AG13C   
26   6/24/2015 11:21      11.0        56.86                     PW05A   
27   6/24/2015 11:24      12.0        41.57                     PW05B   
28   6/24/2015 11:26      13.0        40.14                     PW05C   
29   6/24/2015 11:56      38.0        22.78                     AG14C   
..               ...       ...          ...                       ...   
268    8/4/2016 9:37      48.0       195.97                     PW19A   
269    8/4/2016 9:49      49.0       195.30                     PW19B   
270    8/4/2016 9:43      50.0       198.32                     PW19C   
271   8/3/2016 11:01      51.0       293.71                      PW20   
272    8/4/2016 8:25      52.0         7.74                     SG21A   
273    8/4/2016 8:28      53.0         7.64                     SG21B   
274    8/4/2016 8:22      54.0         4.91                     SG21C   
275    8/4/2016 8:45      55.0         4.85                     SG22A   
276    8/4/2016 8:50      56.0        -2.14                     SG22B   
277   8/1/2016 14:15      57.0        10.32                     SG23B   
278   8/1/2016 14:45      57.0        10.00                     SG23B   
279   8/2/2016 13:22      58.0         5.67                     SG24A   
280   8/2/2016 13:20      59.0         3.70                     SG24B   
281   8/2/2016 13:24      60.0         1.86                     SG24C   
282    8/3/2016 8:24      61.0         5.60                     SG25A   
283    8/3/2016 8:28      62.0         5.62                     SG25B   
284    8/3/2016 8:26      63.0         2.67                     SG25C   
285    8/3/2016 9:05      64.0         9.69                     SG25D   
286    8/3/2016 7:45      65.0         6.42                     SG26A   
287    8/3/2016 7:37      66.0         2.77                     SG26B   
288    8/3/2016 7:47      67.0         2.82                     SG26C   
289    8/3/2016 6:56      68.0         8.42                      SG27   
290   8/2/2016 13:05      69.0        43.22           Twin Springs MX   
291   8/2/2016 14:20      70.0        23.48     Snake Valley North MX   
292   8/1/2016 15:05      71.0        71.67     Snake Valley South MX   
293   8/1/2016 14:22      72.0         9.39          Needle Point BLM   
294   8/2/2016 11:15      73.0        81.57                Eskdale MX   
295   8/2/2016 15:00      74.0        46.96               Baker Creek   
296   8/3/2016 13:12      75.0        54.51           Central Tule MX   
297    8/4/2016 7:35     136.0        60.93  Callao Agricultural Well   

           date extensions                        full_file_name  \
0    2016-08-02       .xle                  pw05a 2016-08-02.xle   
1    2016-08-02       .csv                  pw04b 2016-08-02.csv   
2    2016-08-02       .csv                  pw04a 2016-08-02.csv   
3    2016-08-02       .csv                  pw05c 2016-08-02.csv   
4    2016-08-02       .csv                  pw05b 2016-08-02.csv   
5    2016-08-01       .csv                  pw07b 2016-08-01.csv   
6    2016-08-01       .xle                  pw08a 2016-08-01.xle   
7    2016-08-02       .xle                 pw06mx 2016-08-02.xle   
8    2016-08-01       .xle                  pw07a 2016-08-01.xle   
9           NaN        NaN                                   NaN   
10   2016-08-03       .xle                  sg26a 2016-08-03.xle   
11          NaN        NaN                                   NaN   
12   2016-08-02       .csv                  ag14b 2016-08-02.csv   
13   2016-08-02       .xle                  ag14c 2016-08-02.xle   
14   2016-08-03       .xle                  pw17b 2016-08-03.xle   
15   2016-08-03       .csv                  pw17c 2016-08-03.csv   
16   2016-08-03       .csv                  pw17a 2016-08-03.csv   
17   2016-08-02       .xle                  ag13b 2016-08-02.xle   
18   2016-08-02       .xle                  ag13c 2016-08-02.xle   
19   2016-08-02       .csv                  ag14a 2016-08-02.csv   
20   2016-08-01       .xle                  pw11e 2016-08-01.xle   
21   2016-08-03       .xle        central tule mx 2016-08-03.xle   
22   2016-08-02       .csv             eskdale mx 2016-08-02.csv   
23   2016-08-02       .csv                  pw09a 2016-08-02.csv   
24   2016-08-02       .csv                  pw09b 2016-08-02.csv   
25   2016-08-03       .xle                  pw10a 2016-08-03.xle   
26   2016-08-02       .xle                  pw01a 2016-08-02.xle   
27   2016-08-02       .xle                  pw01b 2016-08-02.xle   
28   2016-08-02       .csv                  pw01c 2016-08-02.csv   
29   2016-08-01       .csv                  pw11c 2016-08-01.csv   
..          ...        ...                                   ...   
268  2016-08-04       .xle                  sg22a 2016-08-04.xle   
269  2016-08-04       .xle                  sg22b 2016-08-04.xle   
270  2016-08-01       .xle                  sg23b 2016-08-01.xle   
271  2016-08-02       .xle                  sg24b 2016-08-02.xle   
272  2016-08-02       .xle                  sg24c 2016-08-02.xle   
273  2016-08-03       .xle                  sg25a 2016-08-03.xle   
274  2016-08-03       .xle                  sg25b 2016-08-03.xle   
275  2016-08-03       .xle                  sg25c 2016-08-03.xle   
276  2016-08-03       .xle                  sg25d 2016-08-03.xle   
277  2016-08-03       .xle                  sg26a 2016-08-03.xle   
278  2016-08-03       .xle                  sg26a 2016-08-03.xle   
279  2016-08-02       .xle  snake valley north mx 2016-08-02.xle   
280  2016-08-01       .xle  snake valley south mx 2016-08-01.xle   
281  2016-08-02       .xle        twin springs mx 2016-08-02.xle   
282  2016-08-01       .xle       needle point blm 2016-08-01.xle   
283  2016-08-03       .xle       coyote knolls mx 2016-08-03.xle   
284         NaN        NaN                                   NaN   
285         NaN        NaN                                   NaN   
286         NaN        NaN                                   NaN   
287         NaN        NaN                                   NaN   
288         NaN        NaN                                   NaN   
289         NaN        NaN                                   NaN   
290         NaN        NaN                                   NaN   
291         NaN        NaN                                   NaN   
292         NaN        NaN                                   NaN   
293         NaN        NaN                                   NaN   
294         NaN        NaN                                   NaN   
295         NaN        NaN                                   NaN   
296         NaN        NaN                                   NaN   
297         NaN        NaN                                   NaN   

                    siteid LoggerTypeName  SiteID       ...        \
0                    pw05a        Solinst     5.0       ...         
1                    pw04b   Global Water     4.0       ...         
2                    pw04a   Global Water     4.0       ...         
3                    pw05c   Global Water     5.0       ...         
4                    pw05b   Global Water     5.0       ...         
5                    pw07b   Global Water     7.0       ...         
6                    pw08a        Solinst     8.0       ...         
7                   pw06mx        Solinst     6.0       ...         
8                    pw07a        Solinst     7.0       ...         
9                      NaN            NaN     NaN       ...         
10                   sg26a        Solinst    26.0       ...         
11                     NaN            NaN     NaN       ...         
12                   ag14b   Global Water    14.0       ...         
13                   ag14c        Solinst    14.0       ...         
14                   pw17b        Solinst    17.0       ...         
15                   pw17c   Global Water    17.0       ...         
16                   pw17a   Global Water    17.0       ...         
17                   ag13b        Solinst    13.0       ...         
18                   ag13c        Solinst    13.0       ...         
19                   ag14a   Global Water    14.0       ...         
20                   pw11e        Solinst    11.0       ...         
21         central tule mx        Solinst    33.0       ...         
22              eskdale mx   Global Water    31.0       ...         
23                   pw09a   Global Water     9.0       ...         
24                   pw09b   Global Water     9.0       ...         
25                   pw10a        Solinst    10.0       ...         
26                   pw01a        Solinst     1.0       ...         
27                   pw01b        Solinst     1.0       ...         
28                   pw01c   Global Water     1.0       ...         
29                   pw11c   Global Water    11.0       ...         
..                     ...            ...     ...       ...         
268                  sg22a        Solinst    22.0       ...         
269                  sg22b        Solinst    22.0       ...         
270                  sg23b        Solinst    23.0       ...         
271                  sg24b        Solinst    24.0       ...         
272                  sg24c        Solinst    24.0       ...         
273                  sg25a        Solinst    25.0       ...         
274                  sg25b        Solinst    25.0       ...         
275                  sg25c        Solinst    25.0       ...         
276                  sg25d        Solinst    25.0       ...         
277                  sg26a        Solinst    26.0       ...         
278                  sg26a        Solinst    26.0       ...         
279  snake valley north mx        Solinst    29.0       ...         
280  snake valley south mx        Solinst    30.0       ...         
281        twin springs mx        Solinst    28.0       ...         
282       needle point blm        Solinst    23.0       ...         
283       coyote knolls mx        Solinst    34.0       ...         
284                    NaN            NaN     NaN       ...         
285                    NaN            NaN     NaN       ...         
286                    NaN            NaN     NaN       ...         
287                    NaN            NaN     NaN       ...         
288                    NaN            NaN     NaN       ...         
289                    NaN            NaN     NaN       ...         
290                    NaN            NaN     NaN       ...         
291                    NaN            NaN     NaN       ...         
292                    NaN            NaN     NaN       ...         
293                    NaN            NaN     NaN       ...         
294                    NaN            NaN     NaN       ...         
295                    NaN            NaN     NaN       ...         
296                    NaN            NaN     NaN       ...         
297                    NaN            NaN     NaN       ...         

    MeasuredLevel Temp  BaroEfficiencyCorrected  DeltaLevel  DriftCorrection  \
0             NaN  NaN                      NaN         NaN              NaN   
1             NaN  NaN                      NaN         NaN              NaN   
2             NaN  NaN                      NaN         NaN              NaN   
3             NaN  NaN                      NaN         NaN              NaN   
4             NaN  NaN                      NaN         NaN              NaN   
5             NaN  NaN                      NaN         NaN              NaN   
6             NaN  NaN                      NaN         NaN              NaN   
7             NaN  NaN                      NaN         NaN              NaN   
8             NaN  NaN                      NaN         NaN              NaN   
9             NaN  NaN                      NaN         NaN              NaN   
10            NaN  NaN                      NaN         NaN              NaN   
11            NaN  NaN                      NaN         NaN              NaN   
12            NaN  NaN                      NaN         NaN              NaN   
13            NaN  NaN                      NaN         NaN              NaN   
14            NaN  NaN                      NaN         NaN              NaN   
15            NaN  NaN                      NaN         NaN              NaN   
16            NaN  NaN                      NaN         NaN              NaN   
17            NaN  NaN                      NaN         NaN              NaN   
18            NaN  NaN                      NaN         NaN              NaN   
19            NaN  NaN                      NaN         NaN              NaN   
20            NaN  NaN                      NaN         NaN              NaN   
21            NaN  NaN                      NaN         NaN              NaN   
22            NaN  NaN                      NaN         NaN              NaN   
23            NaN  NaN                      NaN         NaN              NaN   
24            NaN  NaN                      NaN         NaN              NaN   
25            NaN  NaN                      NaN         NaN              NaN   
26            NaN  NaN                      NaN         NaN              NaN   
27            NaN  NaN                      NaN         NaN              NaN   
28            NaN  NaN                      NaN         NaN              NaN   
29            NaN  NaN                      NaN         NaN              NaN   
..            ...  ...                      ...         ...              ...   
268           NaN  NaN                      NaN         NaN              NaN   
269           NaN  NaN                      NaN         NaN              NaN   
270           NaN  NaN                      NaN         NaN              NaN   
271           NaN  NaN                      NaN         NaN              NaN   
272           NaN  NaN                      NaN         NaN              NaN   
273           NaN  NaN                      NaN         NaN              NaN   
274           NaN  NaN                      NaN         NaN              NaN   
275           NaN  NaN                      NaN         NaN              NaN   
276           NaN  NaN                      NaN         NaN              NaN   
277           NaN  NaN                      NaN         NaN              NaN   
278           NaN  NaN                      NaN         NaN              NaN   
279           NaN  NaN                      NaN         NaN              NaN   
280           NaN  NaN                      NaN         NaN              NaN   
281           NaN  NaN                      NaN         NaN              NaN   
282           NaN  NaN                      NaN         NaN              NaN   
283           NaN  NaN                      NaN         NaN              NaN   
284           NaN  NaN                      NaN         NaN              NaN   
285           NaN  NaN                      NaN         NaN              NaN   
286           NaN  NaN                      NaN         NaN              NaN   
287           NaN  NaN                      NaN         NaN              NaN   
288           NaN  NaN                      NaN         NaN              NaN   
289           NaN  NaN                      NaN         NaN              NaN   
290           NaN  NaN                      NaN         NaN              NaN   
291           NaN  NaN                      NaN         NaN              NaN   
292           NaN  NaN                      NaN         NaN              NaN   
293           NaN  NaN                      NaN         NaN              NaN   
294           NaN  NaN                      NaN         NaN              NaN   
295           NaN  NaN                      NaN         NaN              NaN   
296           NaN  NaN                      NaN         NaN              NaN   
297           NaN  NaN                      NaN         NaN              NaN   

     MeasuredBy Tape  DTWBelowGroundSurface  WaterElevation  DTWBelowCasing  
0           NaN    1                  39.49         5040.21           41.35  
1           NaN    1                  46.83         6133.37           48.54  
2           NaN    1                  44.75         6135.45           46.77  
3           NaN    1                 100.58         4979.12          101.97  
4           NaN    1                 100.67         4979.03          102.30  
5           NaN    1                 208.59         4814.41          210.44  
6           NaN    1                 209.05         5517.75          210.33  
7           NaN    1                 215.13         4759.97          215.52  
8           NaN    1                 213.45         4810.05          215.05  
9           NaN    1                    NaN             NaN            8.42  
10          NaN    1                   7.13         4787.67            9.35  
11          NaN    1                    NaN             NaN           71.47  
12          NaN    1                  30.48         4979.32           31.32  
13          NaN    1                  30.10         4979.70           30.56  
14          NaN    1                  26.70         4480.20           28.71  
15          NaN    1                  14.95         4491.95           16.96  
16          NaN    1                  20.07         4487.43           21.86  
17          NaN    1                 103.12         5158.98          104.59  
18          NaN    1                 103.64         5158.46          105.59  
19          NaN    1                 121.36         4889.04          122.93  
20          NaN    1                  81.48         5578.02           83.51  
21          NaN    1                 589.80         3892.60          592.91  
22          NaN    1                 588.51         4453.69          592.70  
23          NaN    1                  73.15         5052.85           74.24  
24          NaN    1                  81.42         5043.08           82.42  
25          NaN    1                  82.21         5184.09           84.10  
26          NaN    1                  54.28         5258.42           56.86  
27          NaN    1                  39.29         5273.41           41.57  
28          NaN    1                  37.96         5274.74           40.14  
29          NaN    1                  21.74         5643.26           22.78  
..          ...  ...                    ...             ...             ...  
268         NaN    1                 193.14         4123.26          195.97  
269         NaN    1                 192.04         4125.36          195.30  
270         NaN    1                 195.89         5254.41          198.32  
271         NaN    1                 291.93         4527.57          293.71  
272         NaN    1                   5.83         4814.27            7.74  
273         NaN    1                   5.54         4783.46            7.64  
274         NaN    1                   2.69         4786.31            4.91  
275         NaN    1                   2.69         4786.41            4.85  
276         NaN    1                  -4.46         4799.56           -2.14  
277         NaN    1                   8.10         4786.70           10.32  
278         NaN    1                   7.78         4787.02           10.00  
279         NaN    1                   3.54         5092.56            5.67  
280         NaN    1                   1.55         5580.35            3.70  
281         NaN    1                   1.65         4889.05            1.86  
282         NaN    1                   3.70         5446.60            5.60  
283         NaN    1                   2.10         4568.70            5.62  
284         NaN    1                    NaN             NaN            2.67  
285         NaN    1                    NaN             NaN            9.69  
286         NaN    1                    NaN             NaN            6.42  
287         NaN    1                    NaN             NaN            2.77  
288         NaN    1                    NaN             NaN            2.82  
289         NaN    1                    NaN             NaN            8.42  
290         NaN    1                    NaN             NaN           43.22  
291         NaN    1                    NaN             NaN           23.48  
292         NaN    1                    NaN             NaN           71.67  
293         NaN    1                    NaN             NaN            9.39  
294         NaN    1                    NaN             NaN           81.57  
295         NaN    1                    NaN             NaN           46.96  
296         NaN    1                    NaN             NaN           54.51  
297         NaN    1                    NaN             NaN           60.93  

[298 rows x 64 columns]
c:\users\paulinkenbrandt\documents\github\env\lib\site-packages\ipykernel\__main__.py:4: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy

In [20]:
manual['DateTime'] = manual.index.to_datetime()
manual.to_csv(raw_archive_folder+ 'Manual' + '.csv', index=False, columns= ["WellID","DateTime","MeasuredLevel","Temp","BaroEfficiencyCorrected","DeltaLevel",
                                             "MeasuredDTW","DriftCorrection","DTWBelowCasing","DTWBelowGroundSurface",
                                             "WaterElevation","Tape","MeasuredBy"])

List Files to Export


In [21]:
print wellinfo.loc[:,'full_file_name']


0                     ag13a 2016-08-02.xle
1                     ag13b 2016-08-02.xle
2                     ag13c 2016-08-02.xle
3                     ag14a 2016-08-02.csv
4                     ag14b 2016-08-02.csv
5                     ag14c 2016-08-02.xle
6                      ag15 2016-08-02.csv
7                     ag16a 2016-08-02.xle
8                     ag16b 2016-08-02.xle
9           central tule mx 2016-08-03.xle
10               eskdale mx 2016-08-02.csv
11                    pw01a 2016-08-02.xle
12                    pw01b 2016-08-02.xle
13                    pw01c 2016-08-02.csv
14                    pw02a 2016-08-01.xle
15                    pw02b 2016-08-01.xle
16                    pw03a 2016-08-03.xle
17                    pw03b 2016-08-03.xle
18                    pw03z 2016-08-03.xle
19                    pw04a 2016-08-02.csv
20                    pw04b 2016-08-02.csv
21                    pw05a 2016-08-02.xle
22                    pw05b 2016-08-02.csv
23                    pw05c 2016-08-02.csv
24                    pw06a 2016-08-02.csv
25                    pw06b 2016-08-02.xle
26                    pw06c 2016-08-02.csv
27                    pw06d 2016-08-02.csv
28                   pw06mx 2016-08-02.xle
29                    pw07a 2016-08-01.xle
                      ...                 
33                    pw09a 2016-08-02.csv
34                    pw09b 2016-08-02.csv
35                    pw10a 2016-08-03.xle
36                    pw10b 2016-08-03.csv
37                    pw11b 2016-08-01.csv
38                    pw11c 2016-08-01.csv
39                    pw11e 2016-08-01.xle
40                    pw17a 2016-08-03.csv
41                    pw17b 2016-08-03.xle
42                    pw17c 2016-08-03.csv
43                    pw19b 2016-08-04.csv
44                    pw19c 2016-08-04.xle
45                    sg21a 2016-08-04.xle
46                    sg21b 2016-08-04.xle
47                    sg21c 2016-08-04.xle
48                    sg22a 2016-08-04.xle
49                    sg22b 2016-08-04.xle
50                    sg23b 2016-08-01.xle
51                    sg24b 2016-08-02.xle
52                    sg24c 2016-08-02.xle
53                    sg25a 2016-08-03.xle
54                    sg25b 2016-08-03.xle
55                    sg25c 2016-08-03.xle
56                    sg25d 2016-08-03.xle
57                    sg26a 2016-08-03.xle
58    snake valley north mx 2016-08-02.xle
59    snake valley south mx 2016-08-01.xle
60          twin springs mx 2016-08-02.xle
61         needle point blm 2016-08-01.xle
62         coyote knolls mx 2016-08-03.xle
Name: full_file_name, dtype: object

Files To Database


In [22]:
manualwls = raw_archive_folder + '/All tape measurements.csv'
manual = pd.read_csv(manualwls, index_col="DateTime", engine="python")
barofile = raw_archive_folder + '/baro.csv'
baro = pd.read_csv(barofile,index_col=0, parse_dates=True)
wellinfo = pd.read_csv(folder + '/wellinfo4.csv')

In [23]:
engine = engineGetter.getEngine()

Add Select Wells


In [26]:
form = widgets.VBox()
welllist = ["pw07mx 2015-11-30.csv","pw02a 11-30-2015.xle","pw02a 2016-07-07.xle","sg23b 2016-05-02.xle"]
welllist = welllist+ list(wellinfo.loc[:,'full_file_name'].values)
#print welllist

wells = widgets.SelectMultiple(description="Well", options=welllist,padding=4)
pdfName = widgets.Text(description="PDF:",padding=4)
driftTol = widgets.FloatSlider(value=0.05, min=0.00, max=10.0, step=0.05, description='Drift Tolerance:')
form.children = [wells, pdfName, driftTol]
display(form)

In [27]:
for i in wells.value:
    print folder+'/'+i
    inputfile = folder +'/'+i
    g, drift, wellname = svdi.imp_new_well(inputfile, wellinfo, manual, baro)
    glist = g.columns.tolist()
    y1 = g['WaterElevation'].values
    y2 = baro['pw03'].values
    x1 = g.index.values
    x2 = baro.index.values
    wellname, wellid = svdi.getwellid(folder+'\\'+i,wellinfo)
    ylast = wellinfo[wellinfo['WellID']==wellid]['GroundElevation'].values[0] + wellinfo[wellinfo['WellID']==wellid]['Offset'].values[0] - svdi.fcl(manual[manual['WellID']== wellid],max(g.index.to_datetime()))[1]
    yfirst = wellinfo[wellinfo['WellID']==wellid]['GroundElevation'].values[0] + wellinfo[wellinfo['WellID']==wellid]['Offset'].values[0] - svdi.fcl(manual[manual['WellID']== wellid],min(g.index.to_datetime()))[1]
    xlast = pd.to_datetime((svdi.fcl(manual[manual['WellID']== wellid],max(pd.to_datetime(g.index)))).name)
    xfirst = pd.to_datetime((svdi.fcl(manual[manual['WellID']== wellid],min(pd.to_datetime(g.index)))).name)
    x4 = [xfirst,xlast]
    y4 = [yfirst,ylast]
    fig, ax1 = plt.subplots()
    ax1.scatter(x4,y4,color='purple')
    ax1.plot(x1,y1,color='blue',label='Water Level Elevation')
    ax1.set_ylabel('Water Level Elevation',color='blue')
    y_formatter = tick.ScalarFormatter(useOffset=False)
    ax1.yaxis.set_major_formatter(y_formatter)
    ax2 = ax1.twinx()
    ax2.set_ylabel('Barometric Pressure (ft)', color='red') 
    ax2.plot(x2,y2,color='red',label='Barometric pressure (ft)')
    h1, l1 = ax1.get_legend_handles_labels()
    h2, l2 = ax2.get_legend_handles_labels()
    ax1.legend(h1+h2, l1+l2, loc=3)
    plt.xlim(xfirst-timedelta(days=3),xlast+timedelta(days=3))
    plt.title('Well: ' + wellname.title() + '  ' + 'Total Drift = ' + str(g['DriftCorrection'][-1]))


M:/PROJECTS/Snake Valley Water/Transducer Data/Raw_data_archive/2016/2016 q2//pw07mx 2015-11-30.csv
---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
<ipython-input-27-79d38de7f484> in <module>()
      2     print folder+'/'+i
      3     inputfile = folder +'/'+i
----> 4     g, drift, wellname = svdi.imp_new_well(inputfile, wellinfo, manual, baro)
      5     glist = g.columns.tolist()
      6     y1 = g['WaterElevation'].values

c:\users\paulinkenbrandt\documents\github\env\lib\site-packages\wellapplication-0.2.13-py2.7.egg\wellapplication\transport.pyc in imp_new_well(infile, wellinfo, manual, baro)
    461 
    462         ''' 
--> 463         wellname, wellid = transport.getwellid(infile,wellinfo) #see custom getwellid function
    464         print('Well = ' + wellname)
    465         if wellinfo[wellinfo['Well']==wellname]['LoggerTypeName'].values[0] == 'Solinst': # Reads Solinst Raw File

c:\users\paulinkenbrandt\documents\github\env\lib\site-packages\wellapplication-0.2.13-py2.7.egg\wellapplication\transport.pyc in getwellid(infile, wellinfo)
     68         else:
     69             wellname = transport.getfilename(infile)[0:s.start()].strip().lower()
---> 70         wellid = wellinfo[wellinfo['Well']==wellname]['WellID'].values[0]
     71         return wellname, wellid
     72 

IndexError: index 0 is out of bounds for axis 0 with size 0

In [65]:
pdf_pages = PdfPages(folder + '/' + pdfName.value + '.pdf')
for i in wells.value:
    print folder+'/'+i
    inputfile = folder +'/'+i
    g, drift, wellname = svdi.imp_new_well(inputfile, wellinfo, manual, baro)
    quer = "SELECT * FROM groundwater.reading where WellID = " + str(g['WellID'].values[0]) + " and DateTime > \'" + str(g.index.values[-1])[0:10] + " "+ str(g.index.values[-1])[11:19] + "\'"

    if abs(float(drift)) < driftTol.value:
        if len(pd.read_sql_query(sql=quer,con=engine))<1:
            g.to_csv(enteredFolder+wellname+".csv", index=False)
            tablename = 'reading'
            g.to_sql(con=engine, name = tablename, if_exists='append', flavor='mysql', index=False)
            print("Added to DB table " + tablename)
        else:
            print("Already Entered")
            print(len(pd.read_sql_query(sql=quer,con=engine)))
    else:
        g.to_csv(checkFolder+wellname+".csv", index=False, columns= ["WellID","DateTime","MeasuredLevel","Temp","BaroEfficiencyCorrected","DeltaLevel",
                                             "MeasuredDTW","DriftCorrection","DTWBelowCasing","DTWBelowGroundSurface",
                                             "WaterElevation","Tape","MeasuredBy"])
        print("Check File")
    glist = g.columns.tolist()
    for j in range(len(glist)):
        if 'pw' in glist[j]:
            h = glist[j]
    y1 = g['WaterElevation'].values
    y2 = baro['pw03'].values
    x1 = g.index.values
    x2 = baro.index.values
    wellname, wellid = svdi.getwellid(folder+'\\'+i,wellinfo)
    ylast = wellinfo[wellinfo['WellID']==wellid]['GroundElevation'].values[0] + wellinfo[wellinfo['WellID']==wellid]['Offset'].values[0] - svdi.fcl(manual[manual['WellID']== wellid],max(pd.to_datetime(g.index)))[1]
    yfirst = wellinfo[wellinfo['WellID']==wellid]['GroundElevation'].values[0] + wellinfo[wellinfo['WellID']==wellid]['Offset'].values[0] - svdi.fcl(manual[manual['WellID']== wellid],min(pd.to_datetime(g.index)))[1]
    xlast = pd.to_datetime(svdi.fcl(manual[manual['WellID']== wellid],max(pd.to_datetime(g.index))).name)
    xfirst = pd.to_datetime(svdi.fcl(manual[manual['WellID']== wellid],min(pd.to_datetime(g.index))).name)
    x4 = [xfirst,xlast]
    y4 = [yfirst,ylast]
    fig, ax1 = plt.subplots()
    ax1.scatter(x4,y4,color='purple')
    ax1.plot(x1,y1,color='blue',label='Water Level Elevation')
    ax1.set_ylabel('Water Level Elevation',color='blue')
    y_formatter = tick.ScalarFormatter(useOffset=False)
    ax1.yaxis.set_major_formatter(y_formatter)
    ax2 = ax1.twinx()
    ax2.set_ylabel('Barometric Pressure (ft)', color='red') 
    ax2.plot(x2,y2,color='red',label='Barometric pressure (ft)')
    h1, l1 = ax1.get_legend_handles_labels()
    h2, l2 = ax2.get_legend_handles_labels()
    ax1.legend(h1+h2, l1+l2, loc=3)
    plt.xlim(xfirst-timedelta(days=3),xlast+timedelta(days=3))
    plt.title('Well: ' + wellname.title() + '  ' + 'Total Drift = ' + str(g['DriftCorrection'][-1]))
    
    pdf_pages.savefig(fig)
    plt.close()
pdf_pages.close()
print("DONE!")
print("Files in "+ folder+'\\wells.pdf')
print(datetime.now())


M:/PROJECTS/Snake Valley Water/Transducer Data/Raw_data_archive/2016//sg23b 2016-05-02.xle
Well = sg23b
Dropped from end to 2016-05-02 15:00:00
No BP match, using pw03
Efficiency = 0.1
Max Drift = -0.0355
Added to DB table reading
DONE!
Files in M:/PROJECTS/Snake Valley Water/Transducer Data/Raw_data_archive/2016/\wells.pdf
2016-05-31 10:58:52.224000

Add All Wells (with small drift)


In [24]:
form = widgets.VBox()
driftTol = widgets.FloatSlider(value=0.05, min=0.00, max=10.0, step=0.05, description='Drift Tolerance:')
form.children = [driftTol]
display(form)

In [28]:
pdf_pages = PdfPages(folder + '/wells.pdf')
for i in wellinfo.loc[:,'full_file_name']:
    print folder+'/'+i
    inputfile = folder +'/'+i
    g, drift, wellname = svdi.imp_new_well(inputfile, wellinfo, manual, baro)
    quer = "SELECT * FROM groundwater.reading where WellID = " + str(g['WellID'].values[0]) + " and (DateTime >= \'" + str(g.index.values[-1])[0:10] + "\')"

    if abs(float(drift)) < driftTol.value:
        if len(pd.read_sql_query(sql=quer,con=engine))<1:
            g.to_csv(enteredFolder + wellname+".csv", index=False)
            g.to_sql(con=engine, name='reading', if_exists='append', flavor='mysql', index=False)
            print("Added to DB")
        else:
            print("Already Entered")
    else:
        g.to_csv(checkFolder + wellname+".csv", index=False, columns= ["WellID","DateTime","MeasuredLevel","Temp","BaroEfficiencyCorrected","DeltaLevel",
                                             "MeasuredDTW","DriftCorrection","DTWBelowCasing","DTWBelowGroundSurface",
                                             "WaterElevation","Tape","MeasuredBy"])
        print("Check File")
    glist = g.columns.tolist()
    for j in range(len(glist)):
        if 'pw' in glist[j]:
            h = glist[j]
    y1 = g['WaterElevation'].values
    y2 = baro['pw03'].values
    x1 = g.index.values
    x2 = baro.index.values
    wellname, wellid = svdi.getwellid(folder+'\\'+i,wellinfo)
    ylast = wellinfo[wellinfo['WellID']==wellid]['GroundElevation'].values[0] + wellinfo[wellinfo['WellID']==wellid]['Offset'].values[0] - svdi.fcl(manual[manual['WellID']== wellid],max(pd.to_datetime(g.index)))[1]
    yfirst = wellinfo[wellinfo['WellID']==wellid]['GroundElevation'].values[0] + wellinfo[wellinfo['WellID']==wellid]['Offset'].values[0] - svdi.fcl(manual[manual['WellID']== wellid],min(pd.to_datetime(g.index)))[1]
    xlast = pd.to_datetime(svdi.fcl(manual[manual['WellID']== wellid],max(pd.to_datetime(g.index))).name)
    xfirst = pd.to_datetime(svdi.fcl(manual[manual['WellID']== wellid],min(pd.to_datetime(g.index))).name)
    x4 = [xfirst,xlast]
    y4 = [yfirst,ylast]
    fig, ax1 = plt.subplots()
    ax1.scatter(x4,y4,color='purple')
    ax1.plot(x1,y1,color='blue',label='Water Level Elevation')
    ax1.set_ylabel('Water Level Elevation',color='blue')
    y_formatter = tick.ScalarFormatter(useOffset=False)
    ax1.yaxis.set_major_formatter(y_formatter)
    ax2 = ax1.twinx()
    ax2.set_ylabel('Barometric Pressure (ft)', color='red') 
    ax2.plot(x2,y2,color='red',label='Barometric pressure (ft)')
    h1, l1 = ax1.get_legend_handles_labels()
    h2, l2 = ax2.get_legend_handles_labels()
    ax1.legend(h1+h2, l1+l2, loc=3)
    plt.xlim(min(pd.to_datetime(g.index))-timedelta(days=3),max(pd.to_datetime(g.index))+timedelta(days=3))
    plt.title('Well: ' + wellname.title() + '  ' + 'Total Drift = ' + str(g['DriftCorrection'][-1]))
    
    pdf_pages.savefig(fig)
    plt.close()
pdf_pages.close()
print("DONE!")
print("Files in "+ folder+'\\wells.pdf')


M:/PROJECTS/Snake Valley Water/Transducer Data/Raw_data_archive/2016/2016 q2//ag13a 2016-08-02.xle
Well = ag13a
No BP match, using pw03
Efficiency = 0.15
Max Drift = 0.0044
Added to DB
M:/PROJECTS/Snake Valley Water/Transducer Data/Raw_data_archive/2016/2016 q2//ag13b 2016-08-02.xle
Well = ag13b
No BP match, using pw03
Efficiency = 0.3
Max Drift = 0.0478
Added to DB
M:/PROJECTS/Snake Valley Water/Transducer Data/Raw_data_archive/2016/2016 q2//ag13c 2016-08-02.xle
Well = ag13c
No BP match, using pw03
Efficiency = 0.35
Max Drift = 1.0855
Check File
M:/PROJECTS/Snake Valley Water/Transducer Data/Raw_data_archive/2016/2016 q2//ag14a 2016-08-02.csv
Well = ag14a
Efficiency = 0.0
Max Drift = 0.01
Added to DB
M:/PROJECTS/Snake Valley Water/Transducer Data/Raw_data_archive/2016/2016 q2//ag14b 2016-08-02.csv
Well = ag14b
Efficiency = 0.0
Max Drift = 0.02
Added to DB
M:/PROJECTS/Snake Valley Water/Transducer Data/Raw_data_archive/2016/2016 q2//ag14c 2016-08-02.xle
Well = ag14c
No BP match, using pw03
Efficiency = 0.15
Max Drift = 0.0524
Check File
M:/PROJECTS/Snake Valley Water/Transducer Data/Raw_data_archive/2016/2016 q2//ag15 2016-08-02.csv
Well = ag15
Efficiency = 0.0
Max Drift = 0.03
Added to DB
M:/PROJECTS/Snake Valley Water/Transducer Data/Raw_data_archive/2016/2016 q2//ag16a 2016-08-02.xle
Well = ag16a
No BP match, using pw03
Efficiency = 0.1
Max Drift = -0.0016
Added to DB
M:/PROJECTS/Snake Valley Water/Transducer Data/Raw_data_archive/2016/2016 q2//ag16b 2016-08-02.xle
Well = ag16b
No BP match, using pw03
Efficiency = 0.1
Max Drift = 0.2177
Check File
M:/PROJECTS/Snake Valley Water/Transducer Data/Raw_data_archive/2016/2016 q2//central tule mx 2016-08-03.xle
Well = central tule mx
No BP match, using pw03
Efficiency = 0.3
Max Drift = 0.0763
Check File
M:/PROJECTS/Snake Valley Water/Transducer Data/Raw_data_archive/2016/2016 q2//eskdale mx 2016-08-02.csv
Well = eskdale mx
Efficiency = 0.0
Max Drift = -0.41
Check File
M:/PROJECTS/Snake Valley Water/Transducer Data/Raw_data_archive/2016/2016 q2//pw01a 2016-08-02.xle
Well = pw01a
No BP match, using pw03
Efficiency = 0.0
Max Drift = 0.0289
Added to DB
M:/PROJECTS/Snake Valley Water/Transducer Data/Raw_data_archive/2016/2016 q2//pw01b 2016-08-02.xle
Well = pw01b
No BP match, using pw03
Efficiency = 0.0
Max Drift = 0.0384
Added to DB
M:/PROJECTS/Snake Valley Water/Transducer Data/Raw_data_archive/2016/2016 q2//pw01c 2016-08-02.csv
Well = pw01c
Efficiency = 0.0
Max Drift = 0.3967
Check File
M:/PROJECTS/Snake Valley Water/Transducer Data/Raw_data_archive/2016/2016 q2//pw02a 2016-08-01.xle
Well = pw02a
No BP match, using pw03
Efficiency = 0.0
Max Drift = 0.0184
Added to DB
M:/PROJECTS/Snake Valley Water/Transducer Data/Raw_data_archive/2016/2016 q2//pw02b 2016-08-01.xle
Well = pw02b
No BP match, using pw03
Efficiency = 0.2
Max Drift = 0.0268
Added to DB
M:/PROJECTS/Snake Valley Water/Transducer Data/Raw_data_archive/2016/2016 q2//pw03a 2016-08-03.xle
Well = pw03a
No BP match, using pw03
Efficiency = 0.0
Max Drift = 0.0454
Added to DB
M:/PROJECTS/Snake Valley Water/Transducer Data/Raw_data_archive/2016/2016 q2//pw03b 2016-08-03.xle
Well = pw03b
No BP match, using pw03
Efficiency = 0.2
Max Drift = 0.0624
Check File
M:/PROJECTS/Snake Valley Water/Transducer Data/Raw_data_archive/2016/2016 q2//pw03z 2016-08-03.xle
Well = pw03z
No BP match, using pw03
Efficiency = 0.0
Max Drift = 0.061
Check File
M:/PROJECTS/Snake Valley Water/Transducer Data/Raw_data_archive/2016/2016 q2//pw04a 2016-08-02.csv
Well = pw04a
Efficiency = 0.33
Max Drift = 0.0465
Added to DB
M:/PROJECTS/Snake Valley Water/Transducer Data/Raw_data_archive/2016/2016 q2//pw04b 2016-08-02.csv
Well = pw04b
Dropped from beginning to 2
Efficiency = 0.33
Max Drift = 0.0597
Check File
M:/PROJECTS/Snake Valley Water/Transducer Data/Raw_data_archive/2016/2016 q2//pw05a 2016-08-02.xle
Well = pw05a
No BP match, using pw03
Efficiency = 0.1
Max Drift = 0.0459
Added to DB
M:/PROJECTS/Snake Valley Water/Transducer Data/Raw_data_archive/2016/2016 q2//pw05b 2016-08-02.csv
Well = pw05b
Efficiency = 0.25
Max Drift = 0.1383
Check File
M:/PROJECTS/Snake Valley Water/Transducer Data/Raw_data_archive/2016/2016 q2//pw05c 2016-08-02.csv
Well = pw05c
Efficiency = 0.3
Max Drift = 0.0588
Check File
M:/PROJECTS/Snake Valley Water/Transducer Data/Raw_data_archive/2016/2016 q2//pw06a 2016-08-02.csv
Well = pw06a
Efficiency = 0.0
Max Drift = 0.1
Check File
M:/PROJECTS/Snake Valley Water/Transducer Data/Raw_data_archive/2016/2016 q2//pw06b 2016-08-02.xle
Well = pw06b
No BP match, using pw03
Efficiency = 0.1
Max Drift = 0.0165
Added to DB
M:/PROJECTS/Snake Valley Water/Transducer Data/Raw_data_archive/2016/2016 q2//pw06c 2016-08-02.csv
Well = pw06c
Dropped from beginning to 1
Efficiency = 0.1
Max Drift = 0.0506
Check File
M:/PROJECTS/Snake Valley Water/Transducer Data/Raw_data_archive/2016/2016 q2//pw06d 2016-08-02.csv
Well = pw06d
Dropped from end to 2183
Efficiency = 0.1
Max Drift = 0.0832
Check File
M:/PROJECTS/Snake Valley Water/Transducer Data/Raw_data_archive/2016/2016 q2//pw06mx 2016-08-02.xle
Well = pw06mx
No BP match, using pw03
Efficiency = 0.3
Max Drift = -0.2017
Check File
M:/PROJECTS/Snake Valley Water/Transducer Data/Raw_data_archive/2016/2016 q2//pw07a 2016-08-01.xle
Well = pw07a
No BP match, using pw03
Efficiency = 0.35
Max Drift = 0.0636
Check File
M:/PROJECTS/Snake Valley Water/Transducer Data/Raw_data_archive/2016/2016 q2//pw07b 2016-08-01.csv
Well = pw07b
Dropped from beginning to 1
Efficiency = 0.55
Max Drift = -0.1332
Check File
M:/PROJECTS/Snake Valley Water/Transducer Data/Raw_data_archive/2016/2016 q2//pw08a 2016-08-01.xle
Well = pw08a
No BP match, using pw03
Efficiency = 0.2
Max Drift = 0.023
Added to DB
M:/PROJECTS/Snake Valley Water/Transducer Data/Raw_data_archive/2016/2016 q2//pw08b 2016-08-01.xle
Well = pw08b
Dropped from end to 2016-08-01 13:00:00
No BP match, using pw03
Efficiency = 0.2
Max Drift = 0.0941
Check File
M:/PROJECTS/Snake Valley Water/Transducer Data/Raw_data_archive/2016/2016 q2//pw09a 2016-08-02.csv
Well = pw09a
Dropped from beginning to 1
Dropped from end to 1389
Dropped from end to 1391
Efficiency = 0.0
Max Drift = -0.0147
Added to DB
M:/PROJECTS/Snake Valley Water/Transducer Data/Raw_data_archive/2016/2016 q2//pw09b 2016-08-02.csv
Well = pw09b
Efficiency = 0.1
Max Drift = -0.0563
Check File
M:/PROJECTS/Snake Valley Water/Transducer Data/Raw_data_archive/2016/2016 q2//pw10a 2016-08-03.xle
Well = pw10a
No BP match, using pw03
Efficiency = 0.5
Max Drift = -0.0515
Check File
M:/PROJECTS/Snake Valley Water/Transducer Data/Raw_data_archive/2016/2016 q2//pw10b 2016-08-03.csv
Well = pw10b
Dropped from beginning to 3
Efficiency = 0.25
Max Drift = 0.0201
Added to DB
M:/PROJECTS/Snake Valley Water/Transducer Data/Raw_data_archive/2016/2016 q2//pw11b 2016-08-01.csv
Well = pw11b
Efficiency = 0.15
Max Drift = -0.9313
Check File
M:/PROJECTS/Snake Valley Water/Transducer Data/Raw_data_archive/2016/2016 q2//pw11c 2016-08-01.csv
Well = pw11c
Efficiency = 0.15
Max Drift = -0.9119
Check File
M:/PROJECTS/Snake Valley Water/Transducer Data/Raw_data_archive/2016/2016 q2//pw11e 2016-08-01.xle
Well = pw11e
No BP match, using pw03
Efficiency = 0.15
Max Drift = 0.0551
Check File
M:/PROJECTS/Snake Valley Water/Transducer Data/Raw_data_archive/2016/2016 q2//pw17a 2016-08-03.csv
Well = pw17a
Efficiency = 0.15
Max Drift = 0.0055
Added to DB
M:/PROJECTS/Snake Valley Water/Transducer Data/Raw_data_archive/2016/2016 q2//pw17b 2016-08-03.xle
Well = pw17b
No BP match, using pw03
Efficiency = 0.2
Max Drift = 0.1012
Check File
M:/PROJECTS/Snake Valley Water/Transducer Data/Raw_data_archive/2016/2016 q2//pw17c 2016-08-03.csv
Well = pw17c
Efficiency = 0.2
Max Drift = 0.0407
Added to DB
M:/PROJECTS/Snake Valley Water/Transducer Data/Raw_data_archive/2016/2016 q2//pw19b 2016-08-04.csv
Well = pw19b
Efficiency = 0.25
Max Drift = 0.012
Added to DB
M:/PROJECTS/Snake Valley Water/Transducer Data/Raw_data_archive/2016/2016 q2//pw19c 2016-08-04.xle
Well = pw19c
No BP match, using pw03
Efficiency = 0.3
Max Drift = -0.0845
Check File
M:/PROJECTS/Snake Valley Water/Transducer Data/Raw_data_archive/2016/2016 q2//sg21a 2016-08-04.xle
Well = sg21a
No BP match, using pw03
Efficiency = 0.0
Max Drift = -0.0525
Check File
M:/PROJECTS/Snake Valley Water/Transducer Data/Raw_data_archive/2016/2016 q2//sg21b 2016-08-04.xle
Well = sg21b
No BP match, using pw03
Efficiency = 0.0
Max Drift = -0.0116
Added to DB
M:/PROJECTS/Snake Valley Water/Transducer Data/Raw_data_archive/2016/2016 q2//sg21c 2016-08-04.xle
Well = sg21c
No BP match, using pw03
Efficiency = 0.1
Max Drift = -0.0879
Check File
M:/PROJECTS/Snake Valley Water/Transducer Data/Raw_data_archive/2016/2016 q2//sg22a 2016-08-04.xle
Well = sg22a
No BP match, using pw03
Efficiency = 0.0
Max Drift = -0.0397
Added to DB
M:/PROJECTS/Snake Valley Water/Transducer Data/Raw_data_archive/2016/2016 q2//sg22b 2016-08-04.xle
Well = sg22b
No BP match, using pw03
Efficiency = 0.0
Max Drift = 0.7644
Check File
M:/PROJECTS/Snake Valley Water/Transducer Data/Raw_data_archive/2016/2016 q2//sg23b 2016-08-01.xle
Well = sg23b
No BP match, using pw03
Efficiency = 0.1
Max Drift = 0.0101
Added to DB
M:/PROJECTS/Snake Valley Water/Transducer Data/Raw_data_archive/2016/2016 q2//sg24b 2016-08-02.xle
Well = sg24b
No BP match, using pw03
Efficiency = 0.0
Max Drift = 0.0465
Added to DB
M:/PROJECTS/Snake Valley Water/Transducer Data/Raw_data_archive/2016/2016 q2//sg24c 2016-08-02.xle
Well = sg24c
No BP match, using pw03
Efficiency = 0.0
Max Drift = 0.0826
Check File
M:/PROJECTS/Snake Valley Water/Transducer Data/Raw_data_archive/2016/2016 q2//sg25a 2016-08-03.xle
Well = sg25a
No BP match, using pw03
Efficiency = 0.0
Max Drift = 0.088
Check File
M:/PROJECTS/Snake Valley Water/Transducer Data/Raw_data_archive/2016/2016 q2//sg25b 2016-08-03.xle
Well = sg25b
No BP match, using pw03
Efficiency = 0.0
Max Drift = 0.002
Added to DB
M:/PROJECTS/Snake Valley Water/Transducer Data/Raw_data_archive/2016/2016 q2//sg25c 2016-08-03.xle
Well = sg25c
Dropped from beginning to 2016-05-04 10:00:00
No BP match, using pw03
Efficiency = 0.1
Max Drift = 0.0067
Added to DB
M:/PROJECTS/Snake Valley Water/Transducer Data/Raw_data_archive/2016/2016 q2//sg25d 2016-08-03.xle
Well = sg25d
No BP match, using pw03
Efficiency = 0.0
Max Drift = 0.0503
Check File
M:/PROJECTS/Snake Valley Water/Transducer Data/Raw_data_archive/2016/2016 q2//sg26a 2016-08-03.xle
Well = sg26a
No BP match, using pw03
Efficiency = 0.0
Max Drift = 0.2094
Check File
M:/PROJECTS/Snake Valley Water/Transducer Data/Raw_data_archive/2016/2016 q2//snake valley north mx 2016-08-02.xle
Well = snake valley north mx
No BP match, using pw03
Efficiency = 0.0
Max Drift = 0.032
Added to DB
M:/PROJECTS/Snake Valley Water/Transducer Data/Raw_data_archive/2016/2016 q2//snake valley south mx 2016-08-01.xle
Well = snake valley south mx
Dropped from beginning to 2016-05-02 17:00:00
Dropped from end to 2016-08-01 16:00:00
No BP match, using pw03
Efficiency = 0.0
Max Drift = 0.002
Added to DB
M:/PROJECTS/Snake Valley Water/Transducer Data/Raw_data_archive/2016/2016 q2//twin springs mx 2016-08-02.xle
Well = twin springs mx
No BP match, using pw03
Efficiency = 0.0
Max Drift = 0.2386
Check File
M:/PROJECTS/Snake Valley Water/Transducer Data/Raw_data_archive/2016/2016 q2//needle point blm 2016-08-01.xle
Well = needle point blm
No BP match, using pw03
Efficiency = 0.0
Max Drift = 0.1556
Check File
M:/PROJECTS/Snake Valley Water/Transducer Data/Raw_data_archive/2016/2016 q2//coyote knolls mx 2016-08-03.xle
Well = coyote knolls mx
No BP match, using pw03
Efficiency = 0.15
Max Drift = 0.1108
Check File
DONE!
Files in M:/PROJECTS/Snake Valley Water/Transducer Data/Raw_data_archive/2016/2016 q2/\wells.pdf

In [16]:
inputfile = 'M:/PROJECTS/Snake Valley Water/Transducer Data/Raw_data_archive/2016/pw06a 2016-05-03.csv'
dd = pd.read_csv(inputfile, skiprows=1, parse_dates=[[0,1]])
dd.reset_index(inplace=True)
dd.set_index('Date_ Time', inplace=True)

In [23]:
dd['date'] = pd.to_datetime(dd.index).values

In [24]:
dd['datediff'] = dd['date'].diff()

In [ ]:
dd = svdi.hourly_resample(dd)

In [ ]:
dd

Import One File

Combine Output


In [ ]:
q = {}

for i in wellinfo.loc[:,'full_file_name']:
    wellname, wellid = getwellid(folder+'\\'+i)
    q[wellname] = imp_new_well(folder+'\\'+i, wellinfo, manual)

In [ ]:
q.names.to_list()

In [ ]:
alldf = ag13a.append(q)
outpath = pathlist[0] + '\\' + pathlist[1] + '\\' + pathlist[2] + '\\' + pathlist[3] + '\\' + pathlist[4] + '\\' + 'all' + '.csv'
alldf.to_csv(outpath, index=False, columns= ["WellID","DateTime","MeasuredLevel","Temp","BaroEfficiencyCorrected","DeltaLevel",
                                             "MeasuredDTW","DriftCorrection","DTWBelowCasing","DTWBelowGroundSurface",
                                             "WaterElevation","Tape","MeasuredBy"])

In [ ]:
dailyavgfiles = r"U:\GWP\Snake Valley Water\Transducer Data\Individual Sites\Daily Averages"

In [ ]:
well = r"U:\GWP\Snake Valley Water\Transducer Data\Individual Sites\Daily Averages\ag13b.xlsx"

In [ ]:
hourly = pd.read_excel(well,'input',parse_dates=True,index_col='DateTime')
hwl = hourly["WaterElevation"].resample('D',how='mean')
hwl = hwl.interpolate(how='Time')
hwl.plot()

In [ ]: