# Welcome to Graph Dataset Repo
## Installation
Use following commands to install
```bash title="Installation Steps"
pip install gridai
```
## Available commands
Use following command to see available commands.
```bash
gridai --help
```
You will see something like this.
```bash
Usage: gridai [OPTIONS] COMMAND [ARGS]...
Entry point
Options:
--help Show this message and exit.
Commands:
generate-dataset Command line function to generate geojsons from...
generate-stats Function to dump stats around the dataset.
```
## How to create a dataset ?
The command `generate-dataset` can convert all opendss models available in the parent folder by recursively searching for all valid opendss models.
```bash
gridai generate-dataset -j <system-json-path>
```
This will create a sqlite db file stroing all training data in `pytorch.data.Data` format.
## How to use the dataset ?
```python
>>> from torch_geometric.data import SQLiteDatabase
>>> db = SQLiteDatabase(path="dataset.sqlite",name="data_table")
>>> len(db)
51
>>> db[0]
Data(x=[3], edge_index=[2, 2], edge_attr=[2])
```
## Getting NodeObject and EdgeObject
You can use following snippet to convert node attributes back to an instance of
`DistNodeAttrs` and edge attributes back to an `DistEdgeAttrs`.
```python
>>> from torch_geometric.data import SQLiteDatabase
>>> from gridai.interfaces import DistNodeAttrs, DistEdgeAttrs
>>> from rich import print
>>> db = SQLiteDatabase(path="dataset.sqlite",name="data_table")
>>> print(DistNodeAttrs.from_array(db[0].x[0]))
DistNodeAttrs(
node_type=<NodeType.LOAD: 2>,
active_demand_kw=5.726587772369385,
reactive_demand_kw=1.691259503364563,
active_generation_kw=0.0,
reactive_generation_kw=0.0,
phase_type=<PhaseType.NS1S2: 11>,
kv_level=0.1200888529419899
)
>>> print(DistEdgeAttrs.from_array(db[0].edge_attr[0]))
DistEdgeAttrs(
capacity_kva=25.0,
edge_type=<DistEdgeType.TRANSFORMER: 1>,
length_miles=0.0
)
```
## Plotting the dataset
You can use following command to plot the dataset.
```python
>>> from gridai.plot_dataset import plot_dataset
>>> from torch_geometric.data import SQLiteDatabase
>>> db = SQLiteDatabase(path="dataset.sqlite",name="data_table")
>>> plot_dataset(db[0])
```
Raw data
{
"_id": null,
"home_page": null,
"name": "gridai",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.11",
"maintainer_email": null,
"keywords": "distribution system, grid-data-models, python, pytorch_geometric",
"author": null,
"author_email": "Kapil Duwadi <Kapil.Duwadi@nrel.gov>, Aadil Latif <Aadil.Latif@nrel.gov>, Andrew Glaws <Andrew.Glaws@nrel.gov>",
"download_url": "https://files.pythonhosted.org/packages/ba/79/227f8b5068a55b989ea4c0ad133cd23f15ae4f359e26ab2793b63b6f6a8c/gridai-1.1.0.tar.gz",
"platform": null,
"description": "\n# Welcome to Graph Dataset Repo\n\n## Installation\n\nUse following commands to install\n```bash title=\"Installation Steps\"\npip install gridai\n```\n\n## Available commands\n\nUse following command to see available commands.\n\n```bash\ngridai --help\n```\n\nYou will see something like this.\n```bash\nUsage: gridai [OPTIONS] COMMAND [ARGS]...\n\n Entry point\n\nOptions:\n --help Show this message and exit.\n\nCommands:\n generate-dataset Command line function to generate geojsons from...\n generate-stats Function to dump stats around the dataset.\n```\n\n## How to create a dataset ?\n\nThe command `generate-dataset` can convert all opendss models available in the parent folder by recursively searching for all valid opendss models.\n\n```bash\ngridai generate-dataset -j <system-json-path>\n```\n\nThis will create a sqlite db file stroing all training data in `pytorch.data.Data` format.\n\n## How to use the dataset ?\n\n```python\n>>> from torch_geometric.data import SQLiteDatabase\n>>> db = SQLiteDatabase(path=\"dataset.sqlite\",name=\"data_table\")\n>>> len(db)\n51\n>>> db[0]\nData(x=[3], edge_index=[2, 2], edge_attr=[2])\n```\n\n## Getting NodeObject and EdgeObject\n\nYou can use following snippet to convert node attributes back to an instance of \n`DistNodeAttrs` and edge attributes back to an `DistEdgeAttrs`.\n\n```python\n>>> from torch_geometric.data import SQLiteDatabase\n>>> from gridai.interfaces import DistNodeAttrs, DistEdgeAttrs\n>>> from rich import print\n>>> db = SQLiteDatabase(path=\"dataset.sqlite\",name=\"data_table\")\n>>> print(DistNodeAttrs.from_array(db[0].x[0]))\nDistNodeAttrs(\n node_type=<NodeType.LOAD: 2>,\n active_demand_kw=5.726587772369385,\n reactive_demand_kw=1.691259503364563,\n active_generation_kw=0.0,\n reactive_generation_kw=0.0,\n phase_type=<PhaseType.NS1S2: 11>,\n kv_level=0.1200888529419899\n)\n>>> print(DistEdgeAttrs.from_array(db[0].edge_attr[0]))\nDistEdgeAttrs(\n capacity_kva=25.0,\n edge_type=<DistEdgeType.TRANSFORMER: 1>,\n length_miles=0.0\n)\n```\n\n## Plotting the dataset\n\nYou can use following command to plot the dataset.\n\n```python\n>>> from gridai.plot_dataset import plot_dataset\n>>> from torch_geometric.data import SQLiteDatabase\n>>> db = SQLiteDatabase(path=\"dataset.sqlite\",name=\"data_table\")\n>>> plot_dataset(db[0])\n```",
"bugtrack_url": null,
"license": "BSD-3-Clause",
"summary": "Python package for building graph dataset from GDM system.",
"version": "1.1.0",
"project_urls": {
"Documentation": "https://github.nrel.gov/GATES-TLDRD/graph-dataset#readme",
"Issues": "https://github.nrel.gov/GATES-TLDRD/graph-dataset/issues",
"Source": "https://github.nrel.gov/GATES-TLDRD/graph-dataset"
},
"split_keywords": [
"distribution system",
" grid-data-models",
" python",
" pytorch_geometric"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "7c03807b91922814a17d2fff856884dfbc9ed5f20bb42028b1a27a3e3165f751",
"md5": "2b2415dd56e2f33944cfb4b6ea2d3ddd",
"sha256": "c6d3305a67a61fd681d8bb451add88c5cc5aeb50a2f05476d45bef17d8cf3b94"
},
"downloads": -1,
"filename": "gridai-1.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "2b2415dd56e2f33944cfb4b6ea2d3ddd",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.11",
"size": 13446,
"upload_time": "2024-11-22T21:33:20",
"upload_time_iso_8601": "2024-11-22T21:33:20.374787Z",
"url": "https://files.pythonhosted.org/packages/7c/03/807b91922814a17d2fff856884dfbc9ed5f20bb42028b1a27a3e3165f751/gridai-1.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "ba79227f8b5068a55b989ea4c0ad133cd23f15ae4f359e26ab2793b63b6f6a8c",
"md5": "a7805a73547135b6ccdebc7794509c87",
"sha256": "6dd8767435d4e30b2d36b706fd41ad8d6c6881a0c40ce8275bf02a97ee94e35e"
},
"downloads": -1,
"filename": "gridai-1.1.0.tar.gz",
"has_sig": false,
"md5_digest": "a7805a73547135b6ccdebc7794509c87",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.11",
"size": 347237,
"upload_time": "2024-11-22T21:33:22",
"upload_time_iso_8601": "2024-11-22T21:33:22.108774Z",
"url": "https://files.pythonhosted.org/packages/ba/79/227f8b5068a55b989ea4c0ad133cd23f15ae4f359e26ab2793b63b6f6a8c/gridai-1.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-22 21:33:22",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "gridai"
}