Skip to content

Commit

Permalink
Merge pull request #11 from phobson/misc-cleanup
Browse files Browse the repository at this point in the history
misc cleanup
  • Loading branch information
phobson committed Feb 3, 2016
2 parents 02ca00d + 01a6e06 commit 4bbbd57
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 29 deletions.
34 changes: 11 additions & 23 deletions pybmpdb/dataAccess.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,49 +87,37 @@ def __init__(self, filename, dbtable=None, sqlquery=None, catanalysis=False):
Parameters
----------
filename : string
CSV file or MS Access database containing the data.
dbtable : optional string (defaults to the bundled data')
Table in the MS Access database storing the data for analysis.
Only used if `usingdb` is True.
catanalysis : optional bool (default = False)
Toggles the filtering for data that have been approved for BMP
Category-level analysis
Attributes
----------
self.dbfile : string
dbfile : string
Full path to the database file.
self.driver : string
driver : string
ODBC-compliant Microsoft Access driver string.
self.category_type : string
category_type : string
See Input section.
self.usingdb : bool
usingdb : bool
See Input section.
self.excluded_parameters : list of string or None
excluded_parameters : list of string or None
See `parametersToExclude` in Input section.
self.data : pandas DataFrame
data : pandas DataFrame
DataFrame of all of the data found in the DB or CSV file.
Methods
-------
(see individual docstrings for more info):
- self.connect
- self.redefineBMPCategory
- self.convertTablesToCSV
- self.getAllData
- self.getGroupData
connect
redefineBMPCategory
convertTablesToCSV
getAllData
getGroupData
'''
self.file = filename
Expand Down
12 changes: 6 additions & 6 deletions pybmpdb/summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,8 @@ def getSummaryData(dbpath=None, catanalysis=False, astable=False,
minstorms=3, minbmps=3, name=None, useTex=False,
excludedbmps=None, excludedparams=None,
**selection):
'''Select offical data from database.
"""
Select offical data from database.
Parameters
----------
Expand Down Expand Up @@ -177,7 +178,7 @@ def getSummaryData(dbpath=None, catanalysis=False, astable=False,
-------
subset : pandas.DataFrame or bmpTable
'''
"""

# main dataset
if dbpath is None:
Expand Down Expand Up @@ -216,10 +217,9 @@ def getSummaryData(dbpath=None, catanalysis=False, astable=False,
# retention ponds and wetland basins. Samples of an unknown
# type are excluded
querytxt = (
"(sampletype == 'composite') | ("
"(category in {}) | "
"(paramgroup == 'Biological') "
") & (sampletype != 'unknown')"
"(sampletype == 'composite') | "
"((category in {}) | (paramgroup == 'Biological')) & "
"(sampletype != 'unknown')"
).format(grab_BMPs)
subset = table.data.query(querytxt)

Expand Down

0 comments on commit 4bbbd57

Please sign in to comment.