original_docstring: Takes the locations dataframe convert into a geodataframe
      than calculate the tower vornois around tower coordinates and cut out tuscany with a buffer 
docstring: Takes the locations dataframe convert into a geodataframe
  than calculate the tower vornois around tower coordinates and cut out tuscany with a buffer
docstring_tokens: Takes the locations dataframe convert into a geodataframe than calculate the tower vornois around tower coordinates and cut out tuscany with a buffer
code: def towers_vornois_in_tuscany(cdr_geo, crs, path_shapefiles, regions):
      """Takes the locations dataframe convert into a geodataframe
      than calculate the tower vornois around tower coordinates and cut out tuscany with a buffer """
      
      tower_points = np.array(cdr_geo.geometry)
      towers = [np.array([point.x, point.y]) for point in tower_points]
      
      #create vornois
      vor = Voronoi(towers)
      lines = [
          sp.geometry.LineString(vor.vertices[line])
          for line in vor.ridge_vertices
          if -1 not in line
      ]
  
      voronoi_polys = sp.ops.polygonize(lines)
      voronoi_geo = gpd.GeoDataFrame(crs=crs, geometry=list(voronoi_polys)).to_crs(epsg=4326)
      
      #add tuscany shapefile
      df_reg_tusc = read_shapefiles_in(True, path_shapefiles, regions, crs)
      voronoi_geo_in_tusc = voronoi_geo[voronoi_geo.within(df_reg_tusc.unary_union.buffer(0.091))]
      # visualize
      visualize_vornois(voronoi_geo_in_tusc, 'voronoi_tusc.png', pathout, municipalities, crs)
  
      return voronoi_geo_in_tusc
code_tokens: def towers_vornois_in_tuscany ( cdr_geo , crs , path_shapefiles , regions ) : tower_points = np . array ( cdr_geo . geometry ) towers = [ np . array ( [ point . x , point . y ] ) for point in tower_points ] vor = Voronoi ( towers ) lines = [ sp . geometry . LineString ( vor . vertices [ line ] ) for line in vor . ridge_vertices if - 1 not in line ] voronoi_polys = sp . ops . polygonize ( lines ) voronoi_geo = gpd . GeoDataFrame ( crs = crs , geometry = list ( voronoi_polys ) ) . to_crs ( epsg = 4326 ) df_reg_tusc = read_shapefiles_in ( True , path_shapefiles , regions , crs ) voronoi_geo_in_tusc = voronoi_geo [ voronoi_geo . within ( df_reg_tusc . unary_union . buffer ( 0.091 ) ) ] visualize_vornois ( voronoi_geo_in_tusc , 'voronoi_tusc.png' , pathout , municipalities , crs ) return voronoi_geo_in_tusc
short_docstring: Takes the locations dataframe convert into a geodataframe
  than calculate the tower vornois around tower coordinates and cut out tuscany with a buffer
short_docstring_tokens: Takes the locations dataframe convert into a geodataframe than calculate the tower vornois around tower coordinates and cut out tuscany with a buffer
comment: """Takes the locations dataframe convert into a geodataframe
      than calculate the tower vornois around tower coordinates and cut out tuscany with a buffer """$SEP$#create vornois$SEP$#add tuscany shapefile$SEP$# visualize