wsp-sag / Lasso

Python package of utilities for Network Wrangler
https://wsp-sag.github.io/Lasso/
Apache License 2.0
5 stars 3 forks source link

update documentation #58

Open jhelsel11 opened 4 years ago

jhelsel11 commented 4 years ago

The conda install folium command in the github clone install process doesn't work for me. The folium documentation recommends pip or conda-forge: https://pypi.org/project/folium/

jhelsel11 commented 4 years ago

@e-lo,

I tried to run Lasso Scenario Creation Quickstart, and it fails in the write to shape file command, because of a problem in the parameters file. In my_config.yaml, all of the parameters are commented out. Is that correct? Or should some of that be commented back in? Or is the issue something with the shapefile conversion function?

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-27-ce24e345d83e> in <module>
----> 1 model_road_net.write_roadway_as_shp()

d:\lasso\lasso\roadway.py in write_roadway_as_shp(self, node_output_variables, link_output_variables, data_to_csv, data_to_dbf, output_link_shp, output_node_shp, output_link_csv, output_node_csv)
   1448         WranglerLogger.info("Renaming DBF Node Variables")
   1449         nodes_dbf_df = self.rename_variables_for_dbf(
-> 1450             self.nodes_metcouncil_df, output_variables=node_output_variables
   1451         )
   1452         WranglerLogger.info("Renaming DBF Link Variables")

d:\lasso\lasso\roadway.py in rename_variables_for_dbf(self, input_df, variable_crosswalk, output_variables, convert_geometry_to_xy)
   1307 
   1308         variable_crosswalk = (
-> 1309             variable_crosswalk if variable_crosswalk else self.parameters.net_to_dbf
   1310         )
   1311 

AttributeError: 'Parameters' object has no attribute 'net_to_dbf'
jhelsel11 commented 4 years ago

There's also an issue with trying to run the fixed width printing function:

2020-03-04 14:43:11, DEBUG: Network Link Variables: 
 - A
 - B
 - access
 - bike_access
 - bike_facility
 - bridge
 - distance
 - drive_access
 - egress
 - geometry
 - lanes
 - locationReferences
 - max_speed
 - link_id
 - name
 - osm_link_id
 - price
 - ref
 - roadway
 - shstGeometryId
 - shstReferenceId
 - transit_access
 - trn_priority
 - truck_access
 - ttime_assert
 - tunnel
 - u
 - v
 - walk_access
 - width
 - area_type
 - county
 - centroidconnect
 - mpo
 - assign_group
 - roadway_class
 - AADT
 - HOV
 - trn_priority_AM
 - trn_priority_MD
 - trn_priority_PM
 - trn_priority_NT
 - ttime_assert_AM
 - ttime_assert_MD
 - ttime_assert_PM
 - ttime_assert_NT
 - lanes_AM
 - lanes_MD
 - lanes_PM
 - lanes_NT
 - price_sov_AM
 - price_hov2_AM
 - price_hov3_AM
 - price_truck_AM
 - price_sov_MD
 - price_hov2_MD
 - price_hov3_MD
 - price_truck_MD
 - price_sov_PM
 - price_hov2_PM
 - price_hov3_PM
 - price_truck_PM
 - price_sov_NT
 - price_hov2_NT
 - price_hov3_NT
 - price_truck_NT
 - access_AM
 - access_MD
 - access_PM
 - access_NT
 - count_AM
 - count_MD
 - count_PM
 - count_NT
 - count_daily
 - count_year
2020-03-04 14:43:11, DEBUG: Network Node Variables: 
 - osm_node_id
 - N
 - osm_node_id
 - shstReferenceId
 - transit_node
 - drive_node
 - walk_node
 - bike_node
 - outboundReferenceIds
 - inboundReferenceIds
 - geometry
 - x
 - y
 - X
 - Y
2020-03-04 14:43:11, INFO: Starting fixed width convertion
2020-03-04 14:45:39, INFO: Writing out link database
2020-03-04 14:45:41, INFO: Writing out link header and width ----
2020-03-04 14:45:41, INFO: Starting fixed width convertion
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-20-0e1a36c1ad73> in <module>
----> 1 model_road_net.write_roadway_as_fixedwidth()

d:\lasso\lasso\roadway.py in write_roadway_as_fixedwidth(self, node_output_variables, link_output_variables, output_link_txt, output_node_txt, output_link_header_width_csv, output_node_header_width_csv, output_cube_network_script)
   1621 
   1622         node_ff_df, node_max_width_dict = self.dataframe_to_fixed_with(
-> 1623             self.nodes_metcouncil_df[node_output_variables]
   1624         )
   1625         WranglerLogger.info("Writing out node database")

d:\lasso\lasso\roadway.py in dataframe_to_fixed_with(df)
   1492             [
   1493                 (v, df[v].apply(lambda r: len(str(r)) if r != None else 0).max())
-> 1494                 for v in df.columns.values
   1495                 if v != "geometry"
   1496             ]

d:\lasso\lasso\roadway.py in <listcomp>(.0)
   1493                 (v, df[v].apply(lambda r: len(str(r)) if r != None else 0).max())
   1494                 for v in df.columns.values
-> 1495                 if v != "geometry"
   1496             ]
   1497         )

c:\anaconda3\envs\lasso_env\lib\site-packages\pandas\core\frame.py in apply(self, func, axis, broadcast, raw, reduce, result_type, args, **kwds)
   6926             kwds=kwds,
   6927         )
-> 6928         return op.get_result()
   6929 
   6930     def applymap(self, func):

c:\anaconda3\envs\lasso_env\lib\site-packages\pandas\core\apply.py in get_result(self)
    184             return self.apply_raw()
    185 
--> 186         return self.apply_standard()
    187 
    188     def apply_empty_result(self):

c:\anaconda3\envs\lasso_env\lib\site-packages\pandas\core\apply.py in apply_standard(self)
    290 
    291         # compute the result using the series generator
--> 292         self.apply_series_generator()
    293 
    294         # wrap results

c:\anaconda3\envs\lasso_env\lib\site-packages\pandas\core\apply.py in apply_series_generator(self)
    319             try:
    320                 for i, v in enumerate(series_gen):
--> 321                     results[i] = self.f(v)
    322                     keys.append(v.name)
    323             except Exception as e:

d:\lasso\lasso\roadway.py in <lambda>(r)
   1491         max_width_dict = dict(
   1492             [
-> 1493                 (v, df[v].apply(lambda r: len(str(r)) if r != None else 0).max())
   1494                 for v in df.columns.values
   1495                 if v != "geometry"

c:\anaconda3\envs\lasso_env\lib\site-packages\pandas\core\generic.py in __nonzero__(self)
   1553             "The truth value of a {0} is ambiguous. "
   1554             "Use a.empty, a.bool(), a.item(), a.any() or a.all().".format(
-> 1555                 self.__class__.__name__
   1556             )
   1557         )

ValueError: ('The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().', 'occurred at index osm_node_id')

i-am-sijia commented 4 years ago

@jhelsel11, try rerun those two commands now?

jhelsel11 commented 4 years ago

Yes, that solved it.

jhelsel11 commented 4 years ago

Back to documentation. I don't think there's a my_scenario.projects that is discussed in the lasso quick start https://github.com/wsp-sag/Lasso/blob/master/notebooks/Lasso%20Scenario%20Creation%20Quickstart.ipynb

e-lo commented 4 years ago

I don't think there's a my_scenario.projects

Hmm, could you clarify?

jhelsel11 commented 4 years ago

The quickstart guide makes reference to it.

"my_scenario.projects += my_project\n",

I don't think there's a my_scenario.projects

Hmm, could you clarify?