Skip to main content

Bifrost BSX Tools

Extract time series from Bifrost BSX files as pandas DataFrame.

Compatible with Bifrost v6 "Sindri".

Installation

pip install bifrost_bsx_tools

Usage

Load a BSX file and get the settlement ID

from bifrost_bsx_tools import BsxArchive

bsx = BsxArchive('scenario_a.bsx')
bsx.get_settlement_id()

Output:

'MyFancySettlement'

List the runs in the archive

Optinally, add the keyword argument named_runs_only=True to get only runs with names.

bsx.get_runs_metadata()

Output:

{
  'RUN:10601920-ac83-11ed-b4f1-0bee431b5633': {
    'startTime': 5097600,
    'timeHorizon': 7948800,
    'prefetchStep': 900,
    'description': 'run #1', # <- this is the name
    'timestamp': 1676391443,
    'tags': [],
    'scenarioHash': 'e2889fdc93ffba3511598322cc13252f3e768c4826f31c400e739ee62a66475d',
    'complete': True,
    'persisted': True,
    'historic': False
  },
  ...
}

Get the metadata of dynamics present in a run

run_id = 'RUN:10601920-ac83-11ed-b4f1-0bee431b5633'
bsx.get_dynamics_metadata(run_id)

Output:

[
  {
    'id': 'SUN-ALTITUDE:0f2bf2d1-ac6b-11ed-9a57-2d85e0d4252e',
    'cardinality': 1,
    'type': 'number'
  },
  ...
]

Does a timeseries exist for a dynamic?

Checks if a file with the name SUN-ALTITUDE_0f2bf2d1-ac6b-11ed-9a57-2d85e0d4252e.csv exists in the run folder. Bifrost sometimes does not create a file for every dynamic when it has not been stored in the InfluxDB.

dynamic_id = 'SUN-ALTITUDE:0f2bf2d1-ac6b-11ed-9a57-2d85e0d4252e'
bsx.dynamic_timeseries_exists(run_id, dynamic_id)

Output:

True

Get the time series for a run

Returns a pandas DataFrame with the time series for the dynamic.

bsx.get_dynamic_timeseries(run_id, dynamic_id)

Output:

Time Timestep 0
1970-03-01 00:00:00 5097600 138
1970-03-01 00:15:00 5098500 137
1970-03-01 00:30:00 5099400 135
1970-03-01 00:45:00 5100300 134
1970-03-01 01:00:00 5101200 132
... ... ...
1970-05-31 23:00:00 13042800 109
1970-05-31 23:15:00 13043700 109
1970-05-31 23:30:00 13044600 109
1970-05-31 23:45:00 13045500 108
1970-06-01 00:00:00 13046400 108

Release files for bifrost-bsx-tools 0.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bifrost-bsx-tools 0.0.4
File Size Uploaded
bifrost_bsx_tools-0.0.4.tar.gz 6.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for bifrost-bsx-tools 0.0.4
File Interpreter ABI Platform
bifrost_bsx_tools-0.0.4-py3-none-any.whl Python 3 none any Details

Total release size: 13.7 kB

Release files / bifrost_bsx_tools-0.0.4.tar.gz

Download URL bifrost_bsx_tools-0.0.4.tar.gz
Size 6.8 kB
Tags Source
SHA-256 checksum
How to use checksums
37d86b0864abdd79d655f0271039c7de928a23d1eb119842f128fb7019f5e4c0
BLAKE2b-256 checksum
How to use checksums
426c575e6525ec6f1c31f074ec7cb9cff8d44a2cec2798eec9ee5187061ade83
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.10

Release files / bifrost_bsx_tools-0.0.4-py3-none-any.whl

Download URL bifrost_bsx_tools-0.0.4-py3-none-any.whl
Size 6.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
15a88975657e72b0c4c79b047da5239dbc4f27e9dc434b8e89b63afd5201d861
BLAKE2b-256 checksum
How to use checksums
bbd828ca069ed2d4e13e0d01385de0a89e80844536bfbe7546077bc4cfb07f14
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.10

Release history Release notifications | RSS feed

This release

0.0.4 This release

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page