Search is not available for this dataset
text stringlengths 75 104k |
|---|
def execute(
mp,
resampling="nearest",
scale_method=None,
scales_minmax=None
):
"""
Read, stretch and return raster data.
Inputs:
-------
raster
raster file
Parameters:
-----------
resampling : str
rasterio.Resampling method
scale_method : str
... |
def read(self, output_tile, **kwargs):
"""
Read existing process output.
Parameters
----------
output_tile : ``BufferedTile``
must be member of output ``TilePyramid``
Returns
-------
NumPy array
"""
try:
return rea... |
def write(self, process_tile, data):
"""
Write data from process tiles into GeoTIFF file(s).
Parameters
----------
process_tile : ``BufferedTile``
must be member of process ``TilePyramid``
data : ``np.ndarray``
"""
if (
isinstance(... |
def profile(self, tile=None):
"""
Create a metadata dictionary for rasterio.
Parameters
----------
tile : ``BufferedTile``
Returns
-------
metadata : dictionary
output profile dictionary used for rasterio.
"""
dst_metadata = G... |
def empty(self, process_tile):
"""
Return empty data.
Parameters
----------
process_tile : ``BufferedTile``
must be member of process ``TilePyramid``
Returns
-------
empty data : array
empty array with data type provided in output... |
def for_web(self, data):
"""
Convert data to web output (raster only).
Parameters
----------
data : array
Returns
-------
web data : array
"""
return memory_file(
prepare_array(
data, masked=True, nodata=self.n... |
def open(self, tile, process, **kwargs):
"""
Open process output as input for other process.
Parameters
----------
tile : ``Tile``
process : ``MapcheteProcess``
kwargs : keyword arguments
"""
return InputTile(tile, process, kwargs.get("resampling"... |
def read(self, indexes=None, **kwargs):
"""
Read reprojected & resampled input data.
Parameters
----------
indexes : integer or list
band number or list of band numbers
Returns
-------
data : array
"""
band_indexes = self._get... |
def is_empty(self, indexes=None):
"""
Check if there is data within this tile.
Returns
-------
is empty : bool
"""
# empty if tile does not intersect with file bounding box
return not self.tile.bbox.intersects(self.process.config.area_at_zoom()) |
def _get_band_indexes(self, indexes=None):
"""Return valid band indexes."""
if indexes:
if isinstance(indexes, list):
return indexes
else:
return [indexes]
else:
return range(1, self.process.config.output.profile(self.tile)["cou... |
def profile(self, tile=None):
"""
Create a metadata dictionary for rasterio.
Parameters
----------
tile : ``BufferedTile``
Returns
-------
metadata : dictionary
output profile dictionary used for rasterio.
"""
dst_metadata = P... |
def for_web(self, data):
"""
Convert data to web output.
Parameters
----------
data : array
Returns
-------
web data : array
"""
rgba = self._prepare_array_for_png(data)
data = ma.masked_where(rgba == self.nodata, rgba)
re... |
def empty(self, process_tile):
"""
Return empty data.
Parameters
----------
process_tile : ``BufferedTile``
must be member of process ``TilePyramid``
Returns
-------
empty data : array
empty array with data type given in output pa... |
def serve(
mapchete_file,
port=None,
internal_cache=None,
zoom=None,
bounds=None,
overwrite=False,
readonly=False,
memory=False,
input_file=None,
debug=False,
logfile=None
):
"""
Serve a Mapchete process.
Creates the Mapchete host and serves both web page with Op... |
def create_app(
mapchete_files=None, zoom=None, bounds=None, single_input_file=None,
mode="continue", debug=None
):
"""Configure and create Flask app."""
from flask import Flask, render_template_string
app = Flask(__name__)
mapchete_processes = {
os.path.splitext(os.path.basename(mapchet... |
def read_raster_window(
input_files,
tile,
indexes=None,
resampling="nearest",
src_nodata=None,
dst_nodata=None,
gdal_opts=None
):
"""
Return NumPy arrays from an input raster.
NumPy arrays are reprojected and resampled to tile properties from input
raster. If tile boundarie... |
def _get_warped_array(
input_file=None,
indexes=None,
dst_bounds=None,
dst_shape=None,
dst_crs=None,
resampling=None,
src_nodata=None,
dst_nodata=None
):
"""Extract a numpy array from a raster file."""
try:
return _rasterio_read(
input_file=input_file,
... |
def read_raster_no_crs(input_file, indexes=None, gdal_opts=None):
"""
Wrapper function around rasterio.open().read().
Parameters
----------
input_file : str
Path to file
indexes : int or list
Band index or list of band indexes to be read.
Returns
-------
MaskedArray... |
def write_raster_window(
in_tile=None, in_data=None, out_profile=None, out_tile=None, out_path=None,
tags=None, bucket_resource=None
):
"""
Write a window from a numpy array to an output file.
Parameters
----------
in_tile : ``BufferedTile``
``BufferedTile`` with a data attribute ho... |
def extract_from_array(in_raster=None, in_affine=None, out_tile=None):
"""
Extract raster data window array.
Parameters
----------
in_raster : array or ReferencedRaster
in_affine : ``Affine`` required if in_raster is an array
out_tile : ``BufferedTile``
Returns
-------
extracte... |
def resample_from_array(
in_raster=None,
in_affine=None,
out_tile=None,
in_crs=None,
resampling="nearest",
nodataval=0
):
"""
Extract and resample from array to target tile.
Parameters
----------
in_raster : array
in_affine : ``Affine``
out_tile : ``BufferedTile``
... |
def create_mosaic(tiles, nodata=0):
"""
Create a mosaic from tiles. Tiles must be connected (also possible over Antimeridian),
otherwise strange things can happen!
Parameters
----------
tiles : iterable
an iterable containing tuples of a BufferedTile and an array
nodata : integer or... |
def bounds_to_ranges(out_bounds=None, in_affine=None, in_shape=None):
"""
Return bounds range values from geolocated input.
Parameters
----------
out_bounds : tuple
left, bottom, right, top
in_affine : Affine
input geolocation
in_shape : tuple
input shape
Return... |
def tiles_to_affine_shape(tiles):
"""
Return Affine and shape of combined tiles.
Parameters
----------
tiles : iterable
an iterable containing BufferedTiles
Returns
-------
Affine, Shape
"""
if not tiles:
raise TypeError("no tiles provided")
pixel_size = til... |
def _shift_required(tiles):
"""Determine if distance over antimeridian is shorter than normal distance."""
if tiles[0][0].tile_pyramid.is_global:
# get set of tile columns
tile_cols = sorted(list(set([t[0].col for t in tiles])))
# if tile columns are an unbroken sequence, tiles are conne... |
def memory_file(data=None, profile=None):
"""
Return a rasterio.io.MemoryFile instance from input.
Parameters
----------
data : array
array to be written
profile : dict
rasterio profile for MemoryFile
"""
memfile = MemoryFile()
profile.update(width=data.shape[-2], he... |
def prepare_array(data, masked=True, nodata=0, dtype="int16"):
"""
Turn input data into a proper array for further usage.
Outut array is always 3-dimensional with the given data type. If the output
is masked, the fill_value corresponds to the given nodata value and the
nodata value will be burned i... |
def bbox(self, out_crs=None):
"""
Return data bounding box.
Parameters
----------
out_crs : ``rasterio.crs.CRS``
rasterio CRS object (default: CRS of process pyramid)
Returns
-------
bounding box : geometry
Shapely geometry object... |
def read(self, validity_check=True, **kwargs):
"""
Read reprojected & resampled input data.
Parameters
----------
validity_check : bool
also run checks if reprojected geometry is valid, otherwise throw
RuntimeError (default: True)
Returns
... |
def is_empty(self):
"""
Check if there is data within this tile.
Returns
-------
is empty : bool
"""
if not self.tile.bbox.intersects(self.vector_file.bbox()):
return True
return len(self._read_from_cache(True)) == 0 |
def reproject_geometry(
geometry, src_crs=None, dst_crs=None, error_on_clip=False, validity_check=True,
antimeridian_cutting=False
):
"""
Reproject a geometry to target CRS.
Also, clips geometry if it lies outside the destination CRS boundary.
Supported destination CRSes for clipping: 4326 (WGS... |
def segmentize_geometry(geometry, segmentize_value):
"""
Segmentize Polygon outer ring by segmentize value.
Just Polygon geometry type supported.
Parameters
----------
geometry : ``shapely.geometry``
segmentize_value: float
Returns
-------
geometry : ``shapely.geometry``
"... |
def read_vector_window(input_files, tile, validity_check=True):
"""
Read a window of an input vector dataset.
Also clips geometry.
Parameters:
-----------
input_file : string
path to vector file
tile : ``Tile``
tile extent to read data from
validity_check : bool
... |
def write_vector_window(
in_data=None, out_schema=None, out_tile=None, out_path=None, bucket_resource=None
):
"""
Write features to GeoJSON file.
Parameters
----------
in_data : features
out_schema : dictionary
output schema for fiona
out_tile : ``BufferedTile``
tile use... |
def clean_geometry_type(geometry, target_type, allow_multipart=True):
"""
Return geometry of a specific type if possible.
Filters and splits up GeometryCollection into target types. This is
necessary when after clipping and/or reprojecting the geometry types from
source geometries change (i.e. a Po... |
def multipart_to_singleparts(geom):
"""
Yield single part geometries if geom is multipart, otherwise yield geom.
Parameters:
-----------
geom : shapely geometry
Returns:
--------
shapely single part geometries
"""
if isinstance(geom, base.BaseGeometry):
if hasattr(geom,... |
def execute(
mp,
td_resampling="nearest",
td_matching_method="gdal",
td_matching_max_zoom=None,
td_matching_precision=8,
td_fallback_to_higher_zoom=False,
clip_pixelbuffer=0,
**kwargs
):
"""
Convert and optionally clip input raster data.
Inputs:
-------
raster
... |
def get_best_zoom_level(input_file, tile_pyramid_type):
"""
Determine the best base zoom level for a raster.
"Best" means the maximum zoom level where no oversampling has to be done.
Parameters
----------
input_file : path to raster file
tile_pyramid_type : ``TilePyramid`` projection (``ge... |
def get_segmentize_value(input_file=None, tile_pyramid=None):
"""
Return the recommended segmentation value in input file units.
It is calculated by multiplyling raster pixel size with tile shape in
pixels.
Parameters
----------
input_file : str
location of a file readable by raste... |
def tile_to_zoom_level(tile, dst_pyramid=None, matching_method="gdal", precision=8):
"""
Determine the best zoom level in target TilePyramid from given Tile.
Parameters
----------
tile : BufferedTile
dst_pyramid : BufferedTilePyramid
matching_method : str ('gdal' or 'min')
gdal: Us... |
def path_is_remote(path, s3=True):
"""
Determine whether file path is remote or local.
Parameters
----------
path : path to file
Returns
-------
is_remote : bool
"""
prefixes = ("http://", "https://", "/vsicurl/")
if s3:
prefixes += ("s3://", "/vsis3/")
return p... |
def path_exists(path):
"""
Check if file exists either remote or local.
Parameters:
-----------
path : path to file
Returns:
--------
exists : bool
"""
if path.startswith(("http://", "https://")):
try:
urlopen(path).info()
return True
exc... |
def absolute_path(path=None, base_dir=None):
"""
Return absolute path if path is local.
Parameters:
-----------
path : path to file
base_dir : base directory used for absolute path
Returns:
--------
absolute path
"""
if path_is_remote(path):
return path
else:
... |
def relative_path(path=None, base_dir=None):
"""
Return relative path if path is local.
Parameters:
-----------
path : path to file
base_dir : directory where path sould be relative to
Returns:
--------
relative path
"""
if path_is_remote(path) or not os.path.isabs(path):
... |
def write_json(path, params):
"""Write local or remote."""
logger.debug("write %s to %s", params, path)
if path.startswith("s3://"):
bucket = get_boto3_bucket(path.split("/")[2])
key = "/".join(path.split("/")[3:])
logger.debug("upload %s", key)
bucket.put_object(
... |
def read_json(path):
"""Read local or remote."""
if path.startswith(("http://", "https://")):
try:
return json.loads(urlopen(path).read().decode())
except HTTPError:
raise FileNotFoundError("%s not found", path)
elif path.startswith("s3://"):
bucket = get_boto... |
def get_gdal_options(opts, is_remote=False):
"""
Return a merged set of custom and default GDAL/rasterio Env options.
If is_remote is set to True, the default GDAL_HTTP_OPTS are appended.
Parameters
----------
opts : dict or None
Explicit GDAL options.
is_remote : bool
Indi... |
def open(self, tile, **kwargs):
"""
Return InputTile object.
Parameters
----------
tile : ``Tile``
Returns
-------
input tile : ``InputTile``
tile view of input data
"""
return self.process.config.output.open(tile, self.proces... |
def bbox(self, out_crs=None):
"""
Return data bounding box.
Parameters
----------
out_crs : ``rasterio.crs.CRS``
rasterio CRS object (default: CRS of process pyramid)
Returns
-------
bounding box : geometry
Shapely geometry object... |
def win_activate(title, **kwargs):
"""
Activates (gives focus to) a window.
:param title:
:param text:
:return:
"""
text = kwargs.get("text", "")
ret = AUTO_IT.AU3_WinActivate(LPCWSTR(title), LPCWSTR(text))
return ret |
def win_exists(title, **kwargs):
"""
Checks to see if a specified window exists.
:param title: The title of the window to check.
:param text: The text of the window to check.
:return: Returns 1 if the window exists, otherwise returns 0.
"""
text = kwargs.get("text", "")
ret = AUTO_IT.AU3... |
def win_get_caret_pos():
"""
Returns the coordinates of the caret in the foreground window
:return:
"""
p = POINT()
AUTO_IT.AU3_WinGetCaretPos(byref(p))
return p.x, p.y |
def win_get_state(title, **kwargs):
"""
Retrieves the state of a given window.
:param title:
:param text:
:return:
1 = Window exists
2 = Window is visible
4 = Windows is enabled
8 = Window is active
16 = Window is minimized
32 = Windows is maximized
"""
text = kwargs.... |
def win_menu_select_item(title, *items, **kwargs):
"""
Usage:
win_menu_select_item("[CLASS:Notepad]", "", u"文件(&F)", u"退出(&X)")
:param title:
:param text:
:param items:
:return:
"""
text = kwargs.get("text", "")
if not (0 < len(items) < 8):
raise ValueError("accepted ... |
def win_set_trans(title, trans, **kwargs):
"""
Sets the transparency of a window.
:param title:
:param trans: A number in the range 0 - 255. The larger the number,
the more transparent the window will become.
:param kwargs:
:return:
"""
text = kwargs.get("text", "")
ret = AU... |
def auto_it_set_option(option, param):
"""
Changes the operation of various AutoIt functions/parameters
:param option: The option to change
:param param: The parameter (varies by option).
:return:
"""
pre_value = AUTO_IT.AU3_AutoItSetOption(LPCWSTR(option), INT(param))
return pre_value |
def check(self, mark=0, err_msg="", **kwds):
"""
:param mark:
0 - do not need check return value or error()
1 - check error()
2 - check return value
"""
unexpected_ret = kwds.get("unexpected_ret", (0,))
def _check(fn):
@wraps(fn)
... |
def process_set_priority(process, priority):
"""
Changes the priority of a process
:param process: The name or PID of the process to check.
:param priority:A flag which determines what priority to set
0 - Idle/Low
1 - Below Normal (Not supported on Windows 95/98/ME)
2 - Normal
... |
def process_wait(process, timeout=0):
"""
Pauses script execution until a given process exists.
:param process:
:param timeout:
:return:
"""
ret = AUTO_IT.AU3_ProcessWait(LPCWSTR(process), INT(timeout))
return ret |
def process_wait_close(process, timeout=0):
"""
Pauses script execution until a given process does not exist.
:param process:
:param timeout:
:return:
"""
ret = AUTO_IT.AU3_ProcessWaitClose(LPCWSTR(process), INT(timeout))
return ret |
def run_as(user, domain, password, filename, logon_flag=1, work_dir="",
show_flag=Properties.SW_SHOWNORMAL):
"""
Runs an external program.
:param user: username The user name to use.
:param domain: The domain name to use.
:param password: The password to use.
:param logon_flag: 0 = do... |
def run_as_wait(user, domain, password, filename, logon_flag=1, work_dir="",
show_flag=Properties.SW_SHOWNORMAL):
"""
Runs an external program.
:param user: username The user name to use.
:param domain: The domain name to use.
:param password: The password to use.
:param logon_fl... |
def hook(self, event_type='push'):
"""
Registers a function as a hook. Multiple hooks can be registered for a given type, but the
order in which they are invoke is unspecified.
:param event_type: The event type this hook will be invoked for.
"""
def decorator(func):
... |
def _get_digest(self):
"""Return message digest if a secret key was provided"""
return hmac.new(
self._secret, request.data, hashlib.sha1).hexdigest() if self._secret else None |
def _postreceive(self):
"""Callback from Flask"""
digest = self._get_digest()
if digest is not None:
sig_parts = _get_header('X-Hub-Signature').split('=', 1)
if not isinstance(digest, six.text_type):
digest = six.text_type(digest)
if (len(si... |
def long_description():
"""Generate .rst document for PyPi."""
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('--doc', dest="doc",
action="store_true", default=False)
args, sys.argv = parser.parse_known_args(sys.argv)
if args.doc:
import doc2md, pypand... |
def unindent(lines):
"""
Remove common indentation from string.
Unlike doctrim there is no special treatment of the first line.
"""
try:
# Determine minimum indentation:
indent = min(len(line) - len(line.lstrip())
for line in lines if line)
except ValueErro... |
def find_sections(lines):
"""
Find all section names and return a list with their names.
"""
sections = []
for line in lines:
if is_heading(line):
sections.append(get_heading(line))
return sections |
def make_toc(sections, maxdepth=0):
"""
Generate table of contents for array of section names.
"""
if not sections:
return []
outer = min(n for n,t in sections)
refs = []
for ind,sec in sections:
if maxdepth and ind-outer+1 > maxdepth:
continue
ref = sec.l... |
def doc2md(docstr, title, min_level=1, more_info=False, toc=True, maxdepth=0):
"""
Convert a docstring to a markdown text.
"""
text = doctrim(docstr)
lines = text.split('\n')
sections = find_sections(lines)
if sections:
level = min(n for n,t in sections) - 1
else:
level ... |
def mod2md(module, title, title_api_section, toc=True, maxdepth=0):
"""
Generate markdown document from module, including API section.
"""
docstr = module.__doc__
text = doctrim(docstr)
lines = text.split('\n')
sections = find_sections(lines)
if sections:
level = min(n for n,t ... |
def largest_finite_distance(self):
"""
Compute the maximum temporal distance.
Returns
-------
max_temporal_distance : float
"""
block_start_distances = [block.distance_start for block in self._profile_blocks if
block.distance_star... |
def _temporal_distance_cdf(self):
"""
Temporal distance cumulative density function.
Returns
-------
x_values: numpy.array
values for the x-axis
cdf: numpy.array
cdf values
"""
distance_split_points = set()
for block in sel... |
def _temporal_distance_pdf(self):
"""
Temporal distance probability density function.
Returns
-------
non_delta_peak_split_points: numpy.array
non_delta_peak_densities: numpy.array
len(density) == len(temporal_distance_split_points_ordered) -1
delta_p... |
def remove_all_trips_fully_outside_buffer(db_conn, center_lat, center_lon, buffer_km, update_secondary_data=True):
"""
Not used in the regular filter process for the time being.
Parameters
----------
db_conn: sqlite3.Connection
connection to the GTFS object
center_lat: float
center_... |
def remove_dangling_shapes(db_conn):
"""
Remove dangling entries from the shapes directory.
Parameters
----------
db_conn: sqlite3.Connection
connection to the GTFS object
"""
db_conn.execute(DELETE_SHAPES_NOT_REFERENCED_IN_TRIPS_SQL)
SELECT_MIN_MAX_SHAPE_BREAKS_BY_TRIP_I_SQL = ... |
def _delete_rows_by_start_and_end_date(self):
"""
Removes rows from the sqlite database copy that are out of the time span defined by start_date and end_date
:param gtfs: GTFS object
:param copy_db_conn: sqlite database connection
:param start_date:
:param end_date:
... |
def _filter_by_calendar(self):
"""
update calendar table's services
:param copy_db_conn:
:param start_date:
:param end_date:
:return:
"""
if (self.start_date is not None) and (self.end_date is not None):
logging.info("Making date extract")
... |
def _filter_by_agency(self):
"""
filter by agency ids
:param copy_db_conn:
:param agency_ids_to_preserve:
:return:
"""
if self.agency_ids_to_preserve is not None:
logging.info("Filtering based on agency_ids")
agency_ids_to_preserve = list(s... |
def _filter_spatially(self):
"""
Filter the feed based on self.buffer_distance_km from self.buffer_lon and self.buffer_lat.
1. First include all stops that are within self.buffer_distance_km from self.buffer_lon and self.buffer_lat.
2. Then include all intermediate stops that are betwee... |
def compute_pseudo_connections(transit_connections, start_time_dep,
end_time_dep, transfer_margin,
walk_network, walk_speed):
"""
Given a set of transit events and the static walk network,
"transform" the static walking network into a set of "pse... |
def get_min_visit_time(self):
"""
Get the earliest visit time of the stop.
"""
if not self.visit_events:
return float('inf')
else:
return min(self.visit_events, key=lambda event: event.arr_time_ut).arr_time_ut |
def visit(self, event):
"""
Visit the stop if it has not been visited already by an event with
earlier arr_time_ut (or with other trip that does not require a transfer)
Parameters
----------
event : Event
an instance of the Event (namedtuple)
Returns... |
def can_infect(self, event):
"""
Whether the spreading stop can infect using this event.
"""
if event.from_stop_I != self.stop_I:
return False
if not self.has_been_visited():
return False
else:
time_sep = event.dep_time_ut-self.get_min... |
def get_transit_connections(gtfs, start_time_ut, end_time_ut):
"""
Parameters
----------
gtfs: gtfspy.GTFS
end_time_ut: int
start_time_ut: int
Returns
-------
list[Connection]
"""
if start_time_ut + 20 * 3600 < end_time_ut:
warn("Note that it is possible that same tr... |
def get_walk_network(gtfs, max_link_distance_m=1000):
"""
Parameters
----------
gtfs: gtfspy.GTFS
Returns
-------
walk_network: networkx.Graph:
"""
assert (isinstance(gtfs, GTFS))
return walk_transfer_stop_to_stop_network(gtfs, max_link_distance=max_link_distance_m) |
def calculate_trip_shape_breakpoints(conn):
"""Pre-compute the shape points corresponding to each trip's stop.
Depends: shapes"""
from gtfspy import shapes
cur = conn.cursor()
breakpoints_cache = {}
# Counters for problems - don't print every problem.
count_bad_shape_ordering = 0
coun... |
def import_journey_data_for_target_stop(self, target_stop_I, origin_stop_I_to_journey_labels, enforce_synchronous_writes=False):
"""
Parameters
----------
origin_stop_I_to_journey_labels: dict
key: origin_stop_Is
value: list of labels
target_stop_I: int
... |
def _insert_journeys_into_db_no_route(self, stop_profiles, target_stop=None):
# TODO: Change the insertion so that the check last journey id and insertions are in the same transaction block
"""
con.isolation_level = 'EXCLUSIVE'
con.execute('BEGIN EXCLUSIVE')
#exclusive access sta... |
def _journey_label_generator(self, destination_stop_Is=None, origin_stop_Is=None):
"""
Parameters
----------
destination_stop_Is: list-like
origin_stop_Is: list-like
Yields
------
(origin_stop_I, destination_stop_I, journey_labels) : tuple
"""
... |
def _insert_travel_impedance_data_to_db(self, travel_impedance_measure_name, data):
"""
Parameters
----------
travel_impedance_measure_name: str
data: list[dict]
Each list element must contain keys:
"from_stop_I", "to_stop_I", "min", "max", "median" and "m... |
def plot_trip_counts_per_day(G, ax=None, highlight_dates=None, highlight_date_labels=None, show=False):
"""
Parameters
----------
G: gtfspy.GTFS
ax: maptlotlib.Axes, optional
highlight_dates: list[str|datetime.datetime]
The values of highlight dates should represent dates, and or dateti... |
def make_views(cls, conn):
"""Create day_trips and day_stop_times views.
day_trips: day_trips2 x trips = days x trips
day_stop_times: day_trips2 x trips x stop_times = days x trips x stop_times
"""
conn.execute('DROP VIEW IF EXISTS main.day_trips')
conn.execute('CREATE... |
def createcolorbar(cmap, norm):
"""Create a colourbar with limits of lwr and upr"""
cax, kw = matplotlib.colorbar.make_axes(matplotlib.pyplot.gca())
c = matplotlib.colorbar.ColorbarBase(cax, cmap=cmap, norm=norm)
return c |
def write_walk_transfer_edges(gtfs, output_file_name):
"""
Parameters
----------
gtfs: gtfspy.GTFS
output_file_name: str
"""
transfers = gtfs.get_table("stop_distances")
transfers.drop([u"min_transfer_time", u"timed_transfer"], 1, inplace=True)
with util.create_file(output_file_name,... |
def write_nodes(gtfs, output, fields=None):
"""
Parameters
----------
gtfs: gtfspy.GTFS
output: str
Path to the output file
fields: list, optional
which pieces of information to provide
"""
nodes = gtfs.get_table("stops")
if fields is not None:
nodes = nodes[f... |
def write_stops_geojson(gtfs, out_file, fields=None):
"""
Parameters
----------
gtfs: gtfspy.GTFS
out_file: file-like or path to file
fields: dict
simultaneously map each original_name to the new_name
Returns
-------
"""
geojson = create_stops_geojson_dict(gtfs, fields)
... |
def write_combined_transit_stop_to_stop_network(gtfs, output_path, fmt=None):
"""
Parameters
----------
gtfs : gtfspy.GTFS
output_path : str
fmt: None, optional
defaulting to "edg" and writing results as ".edg" files
If "csv" csv files are produced instead """
if fmt is N... |
def write_static_networks(gtfs, output_dir, fmt=None):
"""
Parameters
----------
gtfs: gtfspy.GTFS
output_dir: (str, unicode)
a path where to write
fmt: None, optional
defaulting to "edg" and writing results as ".edg" files
If "csv" csv files are produced instead
"""... |
def write_temporal_networks_by_route_type(gtfs, extract_output_dir):
"""
Write temporal networks by route type to disk.
Parameters
----------
gtfs: gtfspy.GTFS
extract_output_dir: str
"""
util.makedirs(extract_output_dir)
for route_type in route_types.TRANSIT_ROUTE_TYPES:
pa... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.