import pandas as pd
import geopandas as gpd
import larch
larch.__version__

"""
Explanation: 200: Exampville Simulated Data
End of explanation
"""


import larch.exampville

"""
Explanation: Welcome to Exampville, the best simulated town in this here part of the internet!
Exampville is provided with Larch to illustrate the
kind of data that a transportation planner might have available when building
a travel model.  This data is almost entirely fictional.
End of explanation
"""


larch.exampville.files.shapefile

"""
Explanation: TAZ Shapefile
The shapefile that includes a map of the travel analysis zones
in Exampville is stored in a zip file.
End of explanation
"""


taz_shape = gpd.read_file("zip://"+larch.exampville.files.shapefile)

taz_shape.plot(edgecolor='k');

"""
Explanation: Geopandas can open and read this data directly with unzipping it on
disk first, by including the "zip://" protocol in front of the filename.
End of explanation
"""


larch.exampville.files.employment

emp = pd.read_csv(larch.exampville.files.employment, index_col='TAZ')

emp.info()

emp.head()

"""
Explanation: TAZ Employment Data
End of explanation
"""


larch.exampville.files.skims

skims = larch.OMX( larch.exampville.files.skims, mode='r' )
skims

"""
Explanation: Skims
The network skims for Exampville are stored in open matrix format.
Larch includes a OMX reader, which also embeds a number of handy
tools for processing OMX data into formats useful for discrete choice
analysis.
End of explanation
"""


larch.exampville.files.hh

hh = pd.read_csv( larch.exampville.files.hh )

hh.info()

hh.head()

"""
Explanation: Households
End of explanation
"""


larch.exampville.files.person

pp = pd.read_csv( larch.exampville.files.person )

pp.info()

pp.head()

"""
Explanation: Persons
End of explanation
"""


larch.exampville.files.tour

tour = pd.read_csv( larch.exampville.files.tour )

tour.info()

tour.head()

"""
Explanation: Tours
End of explanation
"""


