Skip to main content

Python package for building graph dataset from GDM system.

Project description

Welcome to Graph Dataset Repo

Installation

Use following commands to install

pip install gridai

Available commands

Use following command to see available commands.

gridai --help

You will see something like this.

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.

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 ?

>>> from torch_geometric.data import SQLiteDatabase
>>> db = SQLiteDatabase(path="dataset.sqlite",name="data_table")
>>> len(db)
51
>>> db[0]
Data(x=[22, 21], edge_index=[2, 21], edge_attr=[21, 4])

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.

>>> 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.

>>> 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])

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

gridai-1.0.0.tar.gz (347.8 kB view details)

Uploaded Source

Built Distribution

gridai-1.0.0-py3-none-any.whl (14.0 kB view details)

Uploaded Python 3

File details

Details for the file gridai-1.0.0.tar.gz.

File metadata

  • Download URL: gridai-1.0.0.tar.gz
  • Upload date:
  • Size: 347.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for gridai-1.0.0.tar.gz
Algorithm Hash digest
SHA256 ef26b85bc42e86871512877f1850f944e3065a727ac3c9134db9749befe77506
MD5 725eaeb496bbeb267f884bf61215e9bb
BLAKE2b-256 59dfbdfc9600c3727d0379b545d6ef7f1bd87a6ea8a58caf3c6722b960ec320f

See more details on using hashes here.

File details

Details for the file gridai-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: gridai-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 14.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for gridai-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6953714a0948b82e4dbc39a9e6401134fa0cc0a1b903bd2be55e2e5c15637f3a
MD5 8a9bbe386853f63bf021559cbe499dc6
BLAKE2b-256 9e2e85f5fed14dd074a37af9d78f61b0236509883dee467891a33fea23845f49

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page