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
Metadata
Release files for opdm-api 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| opdm-api-0.1.3.tar.gz | 26.5 kB | Without provenance | Details for opdm-api-0.1.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| opdm_api-0.1.3-py3-none-any.whl | Python 3 | none | any | Details for opdm_api-0.1.3-py3-none-any.whl |
Total release size: 38.0 kB
Release files / opdm-api-0.1.3.tar.gz
| Download URL | opdm-api-0.1.3.tar.gz |
|---|---|
| Size | 26.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e5e1884d848190232ec62b7467e80451286a0c3c845faa87fbbf68837cc12c35
|
|
BLAKE2b-256 checksum How to use checksums |
552beef02b44c13013e66873094cf0da98731f34448c6628907d65669407cb9e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.17
|
Release files / opdm_api-0.1.3-py3-none-any.whl
| Download URL | opdm_api-0.1.3-py3-none-any.whl |
|---|---|
| Size | 11.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
91913afc4a74e5fdeea5ba4c3442382342e0031b6384dbb05568691ff9495ef2
|
|
BLAKE2b-256 checksum How to use checksums |
c99515a9378972a1ac1a4ee2a7fee0fbb59ed443e72323c0cb7616ed539f52f2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.17
|
Security for opdm-api 0.1.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.