revrt.routing.cli.finalize.RoutePostProcessor#
- class RoutePostProcessor(collect_pattern, project_dir, job_name, out_dir=None, min_line_length=0, length_mult_kind=None, simplify_geo_tolerance=None, cost_fpath=None, features_fpath=None, transmission_feature_id_col='trans_gid', purge_chunks=False, chunk_size=10000)[source]#
Bases:
objectClass to finalize routing outputs
- Parameters:
collect_pattern (
str) – Unix-style/filepath/pattern*.gpkgrepresenting the file(s) to be collected into a single output file. Can also just be a path to a single file if data is already in one place.project_dir (path-like) – Path to project directory. This path is used to resolve the out filepath input from the user.
job_name (
str) – Label used to name the generated output file.out_dir (path-like, optional) – Directory where finalized routing file should be written. If not given, defaults to
project_dir. By default,None.min_line_length (
intorfloat, default0) – Minimum line length in km. If a line length is below this value, its length and cost are adjust to meet this minimum. Costs are scaled up linearly. By default,0.length_mult_kind (
{None, "step", "linear"}, optional) – Type of length multiplier calculation to apply. Length multipliers can be used to increase the cost of short lines (similar to an economies-of-scale adjustment). Note that your input files must contain alength_kmcolumn for this to work. The valid options for this input are:"step", which computes length multipliers using a step function,"linear", which computes the length multiplier using a linear interpolation between 0 and 10 mile spur-line lengths, orNone, which indicates no length multipliers should be applied. The default for reV runs prior to 2024 was"step", after which it was updated to default to"linear". Length multiplier data source: https://www.wecc.org/Administrative/TEPPC_TransCapCostCalculator_E3_2019_Update.xlsx By default,None.simplify_geo_tolerance (
float, optional) – Option to simplify geometries before saving to output. Note that this changes the path geometry and therefore create a mismatch between the geometry and any associated attributes (e.g., length, cost, etc). This also means the paths should not be used for characterization. If provided, this value will be used as the tolerance parameter in the geopandas.GeoSeries.simplify method. Specifically, all parts of a simplified geometry will be no more than tolerance distance from the original. This value has the same units as the coordinate reference system of the GeoSeries. Only works for GeoPackage outputs (errors otherwise). By default,None.cost_fpath (path-like, optional) – Filepath to cost layer used for routing. If provided along with features_fpath, the routes will be merged with the transmission features that they connected to. To skip this functionality, leave out both cost_fpath and features_fpath. This is used to obtain profile information for the cost raster layer in order to compute transmission feature row/column indices. By default,
None.features_fpath (path-like, optional) – Filepath to transmission features GeoPackage. If provided along with cost_fpath, the routes will be merged with the transmission features that they connected to. The features in this file must contain a column matching transmission_feature_id_col that uniquely identifies each transmission feature. These features will be merged into the routes based on which features the routes connected to. To skip this functionality, leave out both cost_fpath and features_fpath. By default,
None.transmission_feature_id_col (
str, default"trans_gid") – Name of column in features file uniquely identifying each transmission feature. This is only used if both cost_fpath and features_fpath are provided. By default,"trans_gid".purge_chunks (
bool, defaultFalse) – Option to delete single-node input files after the collection step. By default,False.chunk_size (
int, default10_000) – Number of features to read into memory at a time when merging files. This helps limit memory usage when merging large files. By default,10_000.
Methods
process()Merge and post-process routes files into a single file
Attributes
Directory for chunk files
Output file suffix
List of files to collect
Output filepath
Shared route-to-feature mapper obj
Output writer
- process()[source]#
Merge and post-process routes files into a single file
- Raises:
revrtFileNotFoundError – Raised when no files are found matching the provided pattern.
revrtValueError – Raised when multiple file types are found matching the pattern or if the length multiplier kind is invalid.