Repository for model formulation of Grid Optimization Competition #3
Project description
GO-3-data-model
Pydantic models for the GO Competition Challenge 3 json format. Support for loading, validation, editing, saving.
Should often be used in conjunction with C3DataUtilities.
Install
pip install GO-3-data-model
Use
To load GO-3 input data files:
from datamodel.input.data import InputDataFile
problem_data = InputDataFile.load(problem_data_file_name)
If no errors are raised, then validation succeeded and problem_data is a Pydantic model containing the problem data. All fields may be edited, and the resulting modified model can be saved:
problem_data.save(filename)
The output data structure is encoded in datamodel.input.data.OutputDataFile
, and json schemas are available in datamodel/schemas
.
Developer Instructions
If the json format changes, please:
- Create a new folder named YYYYMMDD (with today's current date) under GO-3-data-model/input
- Copy and paste the .tex files of the new version into the folder
- Commit and push
If you want to work on automatically generating the Pydantic model, you'll first want to create a conda/Python environment and install this package in developer mode:
conda activate YOUR_ENV_NAME
cd GO-3-data-model
pip install -e .
Then you'll want to modify code in GO-3-data-model/datamodel/create.py
and run it from the command line as in:
cd GO-3-data-model
python datamodel/create.py 20220128
If any of the files prefixed with __
change, you might need to hand-port those changes into the files with the same names but not prefixed with __
. (The latter sometimes contain hand-written validators and therefore are not overwritten by create.py
.)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file GO-3-data-model-1.0.2.tar.gz
.
File metadata
- Download URL: GO-3-data-model-1.0.2.tar.gz
- Upload date:
- Size: 22.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e36370302a6a19ecc8e1943c2f8ae2d73e24cbd99dc472232579ec0e80be4737 |
|
MD5 | 747d9001b2b5163b66763d1f13d69490 |
|
BLAKE2b-256 | 9d0e2fa2956715935ec1f3e06f684289ba3a206379c4aa4396d287bcaa90fa45 |