Skip to main content

symbolx

Dealling with multiple scenarios data? This tool helps collecting several scenarios data such as multidimentional variables and parameters for reporting and visualization

Initial setting to be able to collect scenarios info. The following example uses parser and loader for GAMS-dieterpy output. For CSV and Arrow file formats see the test folder in https://gitlab.com/diw-evu/symbolx/-/tree/main/test

import os
import symbolx as syx
from symbolx import DataCollection, SymbolsHandler, Symbol
import karray as ka


folder = "project_files/data_output"
# Next two lines allows to compress or unzip the current scenarios folders
# syx.compress_subdirs(folder=folder, zip_extension='7z', delete=True)
# syx.unzip_all(folder=folder, zip_extension='7z', delete=True)

# This example is for dieterpy users as this considers gams path, GDX parser and loader
DC = DataCollection()
DC.add_collector(collector_name='gdx_collector', parser=syx.symbol_parser_gdx, loader=syx.load_gdx)
DC.add_folder('gdx_collector', folder)
# These atrributes are arguments of the loader function. It may vary depending on the loader we use. This exmaple is for syx.load_gdx
DC.add_custom_attr(collector_name='gdx_collector', inf_to_zero=True, verbose=False)
# Use zip_extension='7z', if we consider scenario folders compresed with '.7z'. 
# Use serializer='yml' if using scenario folders created with dieterpy.__version__ < (1.6.0)
DC.adquire(id_integer=False, serializer='json', gams_dir=None, zip_extension=None)

SH = SymbolsHandler(method='object', obj=DC)
ka.settings.order = ['id','n','g','s','l','h']
# Resulting symbols will follow this order. This should be addapted to the actual dimension names of your variables

You can create the symbols and make operations.

Z = Symbol("Z", symbol_handler=SH)

PRICE = Symbol("eq_nodalbalance", "m", symbol_handler=SH)*-1

G_L = Symbol("G_L", symbol_handler=SH)

STO_OUT = Symbol("STO_OUT", symbol_handler=SH)

# Some relevant methods
Z.df

Z.dfc

Z.dfm

G_L.items

G_L.array # this shows the karray attribute of symbolx

STO_OUT.rename_dim(**{'s':'g'})

G_L.dimreduc('h')

Z.add_dim('n','DE')

G_L.shrink(g=['wind','pv'])

# Symbols operations
BILL = G_L*PRICE

Release files for symbolx 0.4.3

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

Source distribution (sdist)

Source distribution for symbolx 0.4.3
File Size Uploaded
symbolx-0.4.3.tar.gz 27.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for symbolx 0.4.3
File Interpreter ABI Platform
symbolx-0.4.3-py3-none-any.whl Python 3 none any Details

Total release size: 56.7 kB

Release files / symbolx-0.4.3.tar.gz

Download URL symbolx-0.4.3.tar.gz
Size 27.7 kB
Tags Source
SHA-256 checksum
How to use checksums
b27d7c302fc2f93bd2e54fe4e55d5ee4e3b52b1ac6b0f92d18f4f28e0af46494
BLAKE2b-256 checksum
How to use checksums
8239ef6b0cef59b5c235175eb1ab971f1e55a3b09e412657f3beb8e149d70697
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.11.8

Release files / symbolx-0.4.3-py3-none-any.whl

Download URL symbolx-0.4.3-py3-none-any.whl
Size 29.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bccd0ef4f914585826799383bf55931fb05e7cb6624ffd69bd4fa066e9f8d31c
BLAKE2b-256 checksum
How to use checksums
65f99808bd693f51636952380a3411fbfc1d97643f8daad850772eeb158e70d4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.11.8

Release history Release notifications | RSS feed

This release

0.4.3 This release

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

1 release file

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