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

>>> 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.1.0.tar.gz (347.2 kB view details)

Uploaded Source

Built Distribution

gridai-1.1.0-py3-none-any.whl (13.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for gridai-1.1.0.tar.gz
Algorithm Hash digest
SHA256 6dd8767435d4e30b2d36b706fd41ad8d6c6881a0c40ce8275bf02a97ee94e35e
MD5 a7805a73547135b6ccdebc7794509c87
BLAKE2b-256 ba79227f8b5068a55b989ea4c0ad133cd23f15ae4f359e26ab2793b63b6f6a8c

See more details on using hashes here.

Provenance

The following attestation bundles were made for gridai-1.1.0.tar.gz:

Publisher: publish.yml on NREL-Distribution-Suites/gridai

Attestations:

File details

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

File metadata

  • Download URL: gridai-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 13.4 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.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c6d3305a67a61fd681d8bb451add88c5cc5aeb50a2f05476d45bef17d8cf3b94
MD5 2b2415dd56e2f33944cfb4b6ea2d3ddd
BLAKE2b-256 7c03807b91922814a17d2fff856884dfbc9ed5f20bb42028b1a27a3e3165f751

See more details on using hashes here.

Provenance

The following attestation bundles were made for gridai-1.1.0-py3-none-any.whl:

Publisher: publish.yml on NREL-Distribution-Suites/gridai

Attestations:

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