No project description provided
Project description
GMNSpy
Python tool for General Modeling Network Specification (GMNS) developed by Zephyr Foundation for Travel Analysis.
Installation
git clone https://github.com/e-lo/GMNSpy.git
cd GMNSpy
pip install .
Usage
Read a single file
Returns a dataframe that conforms to the specified schema and have been validated.
df = gmnspy.in_out.read_gmns_csv(data_filename, schema_file=schemafilename)
Read a network
Returns a dictionary of dataframes that conform to the specified schema and have been validated.
Checks foreign keys between files.
net = gmnspy.in_out.read_gmns_network(data_directory, config: "gmns.spec.json")
GMNS specification
A copy of the GMNS specification is kept in the /spec
sub-directory as a
series of JSON tables.
Data Table schemas
Data table schemas are specified in JSON and are compatible with the frictionless data table schema standards.
Example:
{
"primaryKey": "segment_id",
"missingValues": ["NaN",""],
"fields": [
{
"name": "segment_id",
"type": "any",
"description": "Primary key.",
"constraints": {
"required": true,
"unique": true
}
},
{
"name": "road_link_id",
"type": "any",
"description": "Required. Foreign key to road_links. The link that the segment is located on.",
"foreign_key": "link.link_id",
"constraints": {
"required": true
}
},
{
"name": "ref_node_id",
"type": "any",
"description": "Required. Foreign key to node.",
"foreign_key": "node.node_id",
"constraints": {
"required": true
}
},
{
"name": "start_lr",
"type": "number",
"description": "Required. Distance from ref_node_id.",
"constraints": {
"required": true,
"minimum": 0
}
},
{
"name": "end_lr",
"type": "number",
"description": "Required. Distance from ref_node_id.",
"constraints": {
"required": true,
"minimum": 0
}
}
]
}
Network Data Config
Network data schemas are specified in JSON and are compatible with the frictionless data data package standards.
Example:
{
"profile": "gmns-data-package",
"profile_version":0.0,
"name": "my-dataset",
"resources": [
{
"name":"link",
"path": "link.csv",
"schema": "link.schema.json",
"required": true
},
{
"name":"node",
"path": "node.csv",
"schema": "node.schema.json",
"required": true
}
]
}
Issues
Please add issues, bugs, and feature requests to Github.
Roadmap
Current feature roadmap includes:
- conversion tools from open street map
- network connectivity checks
- auto documentation of schema to markdown files
- tests tests tests
Feel free to submit pull requests for consideration. See CONTRIBUTING
for more detailed instructions.
Credits
Primary Author: Elizabeth Sall, UrbanLabs LLC
Contributing authors and code maintainers:
- Pedro Carmago, OuterLoop Consulting
- Ian Berg, Volpe Center
See all in CONTRIBUTORS.md
License to Use
The code herein is licensed under the Apache License 2.0 as defined in file.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file gmnspy-0.3.4.tar.gz
.
File metadata
- Download URL: gmnspy-0.3.4.tar.gz
- Upload date:
- Size: 28.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f17415631e3728772909905eabf20c3be34141c7028c3de0f2c1b5185c024397 |
|
MD5 | 290b9fa883f9732ee0e27e84d8f040f1 |
|
BLAKE2b-256 | e9d6d433c6c4d69777eef0a95b0839b90b42902b478613b332edea74afa730e6 |
File details
Details for the file gmnspy-0.3.4-py3-none-any.whl
.
File metadata
- Download URL: gmnspy-0.3.4-py3-none-any.whl
- Upload date:
- Size: 40.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6d777a627b5f78a6ba842fb7ab2caa73a63e71e5a2d85e5834e6beaae8d271f6 |
|
MD5 | 60339767081f59b8963571178e341d5b |
|
BLAKE2b-256 | 903e245e19fd56f5705dc967f018b580d2204c2dbc944db049fde1e0a8c07e8f |