While using/modifying the TCSI_Demo.ipynb, I encountered four errors.
-
I changed
!pip install py3dep ==0.17.1
to
!pip install py3dep
-
This code here:
rds.data['speed'].where(rds.data['maxspeed'].isna(),rds.data['maxspeed'].str.slice(0,2).astype(float))
does not do anything because it's not being saved to a variable. The output is only in memory. When I changed this to save to a variable, it threw an error because the maxspeed field had a value of "default". I did the following code:
roads_vec = features.features_from_polygon(bounding_box_4326,osm_rds)
roads_vec = roads_vec.to_crs(study_area_crs).reset_index()
roads_vec = dgpd.from_geopandas(roads_vec,chunksize=_TARGET_CHUNK_SIZE)
# assigns the speeds in miles per hour to the "speed" attribute
roads_vec = roads_vec.assign(maxspeed=roads_vec['maxspeed'].where(roads_vec['maxspeed'] != 'default', np.nan))
roads_vec['speed'] = roads_vec['highway'].map(h_speed, meta = pandas.Series(dtype = 'float32'))
roads_vec['speed'] = roads_vec['speed'].where(roads_vec['maxspeed'].isna(),roads_vec['maxspeed'].str.slice(0,2))
roads_vec['speed'] = roads_vec['speed'].astype(float)
-
This has been deprecated:
import osmnx as ox
use
from osmnx import features
I changed the code from this:
out_gdf=ox.geometries_from_polygon(sgeo,osm_dic)
if(not out_crs is None):
out_gdf=out_gdf.to_crs(out_crs)
return out_gdf
to this:
out_gdf=features.features_from_polygon(sgeo,osm_dic)
if(not out_crs is None):
out_gdf=out_gdf.to_crs(out_crs)
return out_gdf
-
This code:
rd_dist=distance.cda_cost_distance(c_rs,(rds_rs>0).astype(int),elv)
has problems because (rds_rs>0) returns a raster with infinite values.
I did this:
rds.data['gt0'] = rds.data['conv'].where(rds.data['conv'] == 0, 1)
rds.data['gt0'] = rds.data['gt0'].astype(int)
rds_rs_gt0 = (rds.to_raster(elv,'gt0').set_null_value(0)).eval() #source surface with all non-road cells (value of zero) set to null
rd_dist=distance.cda_cost_distance(c_rs,rds_rs_gt0,elv)
While using/modifying the TCSI_Demo.ipynb, I encountered four errors.
I changed
!pip install py3dep ==0.17.1to
!pip install py3depThis code here:
does not do anything because it's not being saved to a variable. The output is only in memory. When I changed this to save to a variable, it threw an error because the maxspeed field had a value of "default". I did the following code:
This has been deprecated:
import osmnx as oxuse
from osmnx import featuresI changed the code from this:
to this:
This code:
has problems because (rds_rs>0) returns a raster with infinite values.
I did this: