Skip to main content

Repository for model formulation of Grid Optimization Competition #3

Project description

GO-3-data-model

PyPI

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:

  1. Create a new folder named YYYYMMDD (with today's current date) under GO-3-data-model/input
  2. Copy and paste the .tex files of the new version into the folder
  3. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

GO-3-data-model-1.0.2.tar.gz (22.2 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page