NHD Network Analysis


In [12]:
import os
import pandas as pd

In [11]:
#Import NetworkX package; install, if necessary
try:
    import networkx as nx
except:
    import pip
    pip.main(['install','networkx'])
    import networkx as nx

In [17]:
#Import simpledbf package; install, if necessary **https://pypi.python.org/pypi/simpledbf**
try:
    from simpledbf import Dbf5
except:
    import pip
    pip.main(['install','simpledbf'])
    from simpledbf import Dbf5

In [27]:
#Read the NHDFlowlineVAA file as a dbf object, then a dataframe
vaaFilename = 'NHD_H_Maryland_Shape/Shape/NHDFlowlineVAA.dbf'
dbfVAA = Dbf5(vaaFilename)


Out[27]:
22

In [19]:
#Convert to dataframe
df = dbfVAA.to_dataframe()

In [30]:
dfX = df.dropna()

In [34]:
dfX[dfX.FROMNODE > 0]


Out[34]:
PERMANENT_ FDATE STREAMLEVE STREAMORDE FROMNODE TONODE HYDROSEQ LEVELPATHI PATHLENGTH TERMINALPA ... STARTFLAG TERMINALFL DNLEVEL THINNERCOD UPLEVELPAT UPHYDROSEQ UPMINHYDRO DNLEVELPAT DNMINHYDRO DNDRAINCOU

0 rows × 22 columns


In [ ]: