Skip to main content

ENTSO-E OPDM client SOAP API implementation in python

Project description

OPDM

Python implementation of OPDM SOAP API. OPDM is used to exchange Electrical Grid Models between ENTSO-E TSO-s and RSC-s

Other relevant API-s:

Installation

pip install opdm-api

or

pip install --user opdm-api

or

python -m pip install --user opdm-api

Usage

Initialise

import OPDM

service = OPDM.Client("https://opdm.elering.sise:8443", username="user", password="pass")

Upload File

Upload a file

response = service.publication_request(file_path_or_objet)

Upload all files in a directory

import glob
imort os

for file_name in glob.glob1(directory_path, "*.zip"):
    service.publication_request(os.path.join(directory_path, file_name))

Get File Upload/Publication Report

publication_report = service.get_profile_publication_report(model_ID)

or

publication_report = service.get_profile_publication_report(filename="uploaded_file_name.zip")

Subscribe for Model publications

Get available Publications

available_publications = service.publication_list()

Subscribe for BDS

available publications: BDS, IGM, CGM

response = service.publication_subscribe("BDS")

Subscribe for all IGM-s except RT

time_horizons = [f"{item:02d}" for item in list(range(1,32))] + ["ID", "1D", "2D", "YR"]
for time_horizon in time_horizons:
    print(f"Adding subscription for {time_horizon}")
    response = service.publication_subscribe("IGM", subscription_id=f"IGM-{time_horizon}", metadata_dict={'pmd:timeHorizon': time_horizon})
    print(response)

Cancel Subscription

response = service.publication_cancel_subscription(subscription_id)

Query Data

Model

Model consists of multiple files

response = service.query_object(object_type = "IGM", metadata_dict = {'pmd:scenarioDate': '2019-07-28T00:30:00', 'pmd:timeHorizon': '1D'})

File

response = service.query_profile('pmd:timeHorizon': '1D', 'pmd:cgmesProfile': 'SV'})

Create nice table of returned Query responses

import pandas

pandas.set_option("display.max_rows", 12)
pandas.set_option("display.max_columns", 10)
pandas.set_option("display.width", 1500)
pandas.set_option('display.max_colwidth', -1)

print(pandas.DataFrame(response['sm:QueryResult']['sm:part'][1:]))

Download a File

Download to OPDM Client and return local path to the file

response = service.get_content(file_UUID)
print(response['sm:GetContentResult']['sm:part'][1]['opdm:Profile']['opde:Content'])

Download and Save file

import base64
response = service.get_content(file_UUID, return_payload=True)
with open(f"{file_UUID}.zip", 'wb') as cgmes_file:
    report_file.write(base64.b64decode(response['sm:GetContentResult']['sm:part'][1]['opdm:Profile']['opde:Content'].encode()))

Manage Rulesets

List available Ruleset

service.list_available_rulesets()

Install Ruleset

service.install_rulesets(version="2.0.122")

Get installed Ruleset version

service.get_installed_ruleset_version()

Reset Ruleset

service.reset_ruleset()

Examples

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

opdm-api-0.1.1.tar.gz (25.7 kB view details)

Uploaded Source

Built Distribution

opdm_api-0.1.1-py3-none-any.whl (11.5 kB view details)

Uploaded Python 3

File details

Details for the file opdm-api-0.1.1.tar.gz.

File metadata

  • Download URL: opdm-api-0.1.1.tar.gz
  • Upload date:
  • Size: 25.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.7.17

File hashes

Hashes for opdm-api-0.1.1.tar.gz
Algorithm Hash digest
SHA256 0b56b9c4bf6d2cd71a20b5571579bcf8125d3321b92bb3ad5a032ea4cf1e923a
MD5 38732f43f67e9e614216009650f751aa
BLAKE2b-256 ac3a53fb6626b335a5d44aeb5be67c11c650446350f79f2e3fa6e058c488bf8c

See more details on using hashes here.

File details

Details for the file opdm_api-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: opdm_api-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 11.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.7.17

File hashes

Hashes for opdm_api-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 177233ef1161c01b7f793bad73f4edbf732f79a5efad3a445324a782e86062c3
MD5 a15ed54c1991e4771637cc72afc49098
BLAKE2b-256 7f205adcc8708ef2a2b046a4d81afe87a100215c0fe50353deefd8d25e1c2c14

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