Skip to main content

Quickstart

Step 1: Install the data package in your DISPATCHES environment using pip

conda activate dispatches-dev  # or the name of your DISPATCHES dev environment
pip install git+https://github.com/gmlc-dispatches/synthetic-price-data

Step 2: Access the contents of the data package in your code using dispatches_data.api

Using dispatches_data.api.path():

from dispatches_data.api import path

# path_to_data_package is a standard pathlib.Path object
path_to_data_package = path("synthetic_price")

# subdirectories and files can be accessed using the pathlib.Path API
path_to_xml = path_to_data_package / "ARMA_train.xml"
assert path_to_xml.is_file()

# alternatively, if the file is located directly under the data package directory (i.e. not in a subdirectory):
# this will raise an exception if the file does not exist so we don't need to check explicitly
path_to_xml = path("synthetic_price", "ARMA_train.xml")

# if the path must be passed to a function that only accepts `str` objects, it can be converted using `str()`
path_to_xml_as_str = str(path_to_xml)

Using dispatches_data.api.files():

from dispatches_data.api import files

# `all_price_files` will be a list of pathlib.Path objects for each file matching the specified `pattern`
all_price_files = files("synthetic_price", pattern="Price_20*.csv")
# check that the list of found files is not empty
assert all_price_files

# `dispatches_data.api.files()` always returns a list, even if only one file matches
price_for_21 = files("synthetic_price", pattern="Price_*21.csv")[0]

Using the CLI interface:

NOTE this example uses UNIX shell syntax. It will not work on Windows unless adapted to the specific shell (e.g. Powershell) being used.

# calling `dispatches-data-packages` on the command line with the name of the data package
# will output the absolute path to the data package, which can then be saved as a shell variable
# and used to generate paths to files in the data package
path_to_data_package="$(dispatches-data-packages synthetic_price)"
path_to_xml_file="$path_to_data_package/ARMA_train.xml"
ls -lh "$path_to_data_package"
cp "$path_to_xml_file" .

# the entire contents of the data package can be copied to the current working directory
# if this is required by the client application
cp -r "$path_to_data_package"/* .
ls -lh .

Examples

Using the data package with the RAVEN CLI

NOTE this example uses UNIX shell syntax. It will not work on Windows unless adapted to the specific shell (e.g. Powershell) being used. TODO: must be tested

path_to_data_package="$(dispatches-data-packages synthetic_price)"
# copy contents to local directory
cp -r "$path_to_data_package"/* .
raven_framework ARMA_train.xml

Using the data package with shell commands in IPython/Jupyter notebooks

Both the IPython shell and Jupyter notebooks allow running arbitrary shell commands within a Python code shell by prefixing the command with !. Refer to the IPython documentation for details.

NOTE The command (minus the ! prefix) is passed verbatim to the system shell. Therefore, the exact syntax used in these examples may or may not work depending on the operating system (more specifically, on which shell is configured as the default).

Within a !-prefixed line, the use of Python variables is supported by prefixing the variable name with $ or wrapping it between {}. The value of the Python variable will be converted to a string automatically before the command is passed to the shell.

Therefore, the following syntax can be used to use data packages within a IPython/Jupyter shell command:

from dispatches_data.api import path

xml_path = path("synthetic_price", "ARMA_train.xml)

# the $ syntax only supports simple variable names
!raven_framework $xml_path

# the {} syntax supports arbitrary Python expressions
!raven_framework {path("synthetic_price", "ARMA_train.xml")}

Metadata

Release files for dispatches-synthetic-price-data 23.4.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 dispatches-synthetic-price-data 23.4.4
File Size Uploaded
dispatches-synthetic-price-data-23.4.4.tar.gz 291.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for dispatches-synthetic-price-data 23.4.4
File Interpreter ABI Platform
dispatches_synthetic_price_data-23.4.4-py3-none-any.whl Python 3 none any Details

Total release size: 581.8 kB

Release files / dispatches-synthetic-price-data-23.4.4.tar.gz

Download URL dispatches-synthetic-price-data-23.4.4.tar.gz
Size 291.0 kB
Tags Source
SHA-256 checksum
How to use checksums
d3cbef7888a27a60eb6d9d903376e6fb894b5138068d720c9bddbbb5cbf1e07d
BLAKE2b-256 checksum
How to use checksums
0905c477e2e255e59acef51b31dac0fc3a9df3929fc0638dc0b5135c1af3630a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.16

Release files / dispatches_synthetic_price_data-23.4.4-py3-none-any.whl

Download URL dispatches_synthetic_price_data-23.4.4-py3-none-any.whl
Size 290.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
39cf663e7ebd9221111afca0dac4c5f7e50486010110e491560a3bd64e4c9ad7
BLAKE2b-256 checksum
How to use checksums
526be56e6e841ff8c5abc00f4b3477ef65f9d8ad25cf574202351e2b7ba3dcd9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.16

Release history Release notifications | RSS feed

This release

23.4.4 This release

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