EcohydroLib  1.29
Namespaces | Variables
NHDPlusV2Setup.py File Reference

Namespaces

 NHDPlusV2Setup
 Builds SQLite3 databases from NHDPlus V2 data archives downloaded from http://www.horizon-systems.com/NHDPlus/NHDPlusV2_home.php.
 

Variables

tuple NHDPlusV2Setup.parser = argparse.ArgumentParser(description='Assemble regional NHDPLus V2 data into a national dataset')
 
string NHDPlusV2Setup.help = 'The configuration file'
 
 NHDPlusV2Setup.required = True,
 
 NHDPlusV2Setup.default = False,
 
tuple NHDPlusV2Setup.args = parser.parse_args()
 
tuple NHDPlusV2Setup.config = ConfigParser.RawConfigParser()
 
tuple NHDPlusV2Setup.pathOfOgr = config.get('GDAL/OGR', 'PATH_OF_OGR2OGR')
 
tuple NHDPlusV2Setup.pathOfFind = config.get('UTIL', 'PATH_OF_FIND')
 
tuple NHDPlusV2Setup.pathOfSevenZip = config.get('UTIL', 'PATH_OF_SEVEN_ZIP')
 
tuple NHDPlusV2Setup.pathOfSqlite = config.get('UTIL', 'PATH_OF_SQLITE')
 
tuple NHDPlusV2Setup.nhdPlusDB = os.path.join(args.outputDir, "NHDPlusDB.sqlite")
 
tuple NHDPlusV2Setup.zipFiles = subprocess.check_output("%s %s -type f -name *.7z -print" % (pathOfFind, args.archiveDir,), shell=True)
 
string NHDPlusV2Setup.sevenZCommand = "%s x -y -o%s %s"
 
tuple NHDPlusV2Setup.returnCode = os.system(sevenZCommand)
 
tuple NHDPlusV2Setup.gageLocDB = os.path.join(args.outputDir, "GageLoc.sqlite")
 
tuple NHDPlusV2Setup.gageLoc = subprocess.check_output("%s %s -type f -iname GageLoc.shp -print" % (pathOfFind, args.outputDir,), shell=True)
 
list NHDPlusV2Setup.gageLocShp = gageLoc[0]
 
string NHDPlusV2Setup.ogrCommand = '%s -gt 65536 -f "SQLite" -t_srs "EPSG:4326" %s %s'
 
string NHDPlusV2Setup.sqliteCommand = "%s %s 'CREATE INDEX IF NOT EXISTS reachcode_measure_idx on GageLoc (reachcode,measure)'"
 
tuple NHDPlusV2Setup.conusCatchment = os.path.join(args.outputDir, "Catchment.sqlite")
 
tuple NHDPlusV2Setup.shapefiles = subprocess.check_output("%s %s -type f -iname Catchment.shp -print" % (pathOfFind, args.outputDir,), shell=True)
 
tuple NHDPlusV2Setup.numFiles = len(shapefiles)
 
int NHDPlusV2Setup.currFile = 0
 
tuple NHDPlusV2Setup.pctComplete = (float(currFile) / float(numFiles))
 
tuple NHDPlusV2Setup.conn = sqlite3.connect(nhdPlusDB)
 
tuple NHDPlusV2Setup.cursor = conn.cursor()
 
tuple NHDPlusV2Setup.dbfs = subprocess.check_output("%s %s -type f -iname PlusFlowlineVAA.dbf -print" % (pathOfFind, args.outputDir,), shell=True)
 
tuple NHDPlusV2Setup.f = open(file, 'rb')
 
tuple NHDPlusV2Setup.db = list(dbfreader(f))
 
list NHDPlusV2Setup.records = db[2:]
 
list NHDPlusV2Setup.GNIS_NBR = record[13]
 
tuple NHDPlusV2Setup.dbf = subprocess.check_output("%s %s -type f -iname GageLoc.dbf -print" % (pathOfFind, args.outputDir,), shell=True)