Downloads EPA Stream Cat data for North Carolina from
ftp://newftp.epa.gov/EPADataCommons/ORD/NHDPlusLandscapeAttributes/StreamCat/WelcomePage.html
In [1]:
#Import modules
import os
from ftplib import FTP
In [2]:
#Set the ftp address and folder
ftpServer = 'newftp.epa.gov'
ftpFolder = '/EPADataCommons/ORD/NHDPlusLandscapeAttributes/StreamCat/States/'
In [3]:
#Connect to the ftp server
ftp = FTP(ftpServer)
ftp.login(user='anonymous', passwd = 'user@duke.edu')
ftp.cwd(ftpFolder);
In [6]:
#Fetch the NLCD2006 file
filename = 'NLCD2006_NC.zip'
with open('../Data/Streamcat/'+ filename, 'wb') as localfile:
ftp.retrbinary('RETR ' + filename, localfile.write)
In [ ]:
#Fetch the NLCD2011 file
filename = 'NLCD2011_NC.zip'
with open('../Data/Streamcat/'+ filename, 'wb') as localfile:
ftp.retrbinary('RETR ' + filename, localfile.write)
In [ ]:
ftp.quit();