Skip to main content

A package for conversion of EnergyPlus IDF files to YAML format (with useful annotation), and back.

Project description

codecov PyPI License

idf2yaml is a package that converts IDF files for the EnergyPlus simulation software to YAML format and vice versa. This package allows users to easily convert between these two formats, enabling to work with EnergyPlus models with yaml tooling.

idf2yaml is built upon the libraries eppy🔗 and ruamel.yaml🔗.

The package consists of two functions, idf2yaml and yaml2idf, which convert IDF files to YAML format and YAML files (if, of course, appropriately populated) to IDF format, respectively.

The following quickstart script shows how to use the package:

from idf2yaml import idf2yaml, yaml2idf, DEFAULT_IDD

# Convert IDF to YAML
yaml_string = idf2yaml(
    "example.idf",              # path to the IDF file
    idd=DEFAULT_IDD,            # path to the IDD file
    skip_empty=True,            # if True, attributes not explicitly set in the IDF will not appear
    output_path="output.yaml"   # can be None if only the string is needed
)

# Convert YAML file back to IDF
idf_string_file = yaml2idf(
    "output.yaml",              # path to the yaml file
    idd=DEFAULT_IDD,            # path to the IDD file
    output_path="output.idf",   # can be None if only the string is needed
)

# Convert YAML string back to IDF
idf_string_string = yaml2idf(
    yaml_string,                # string representing the yaml content
    idd=DEFAULT_IDD,            # path to the IDD file
    output_path="output.idf",   # can be None if only the string is needed
)

# The result is the same
assert idf_string_file == idf_string_string

The conversion from IDF to YAML includes useful annotations for the attributes, such as

  • Physical units
  • Default values
  • Numeric range (min->max)
  • Set of possible choices for categoricals [opt1|opt2|opt3]

These are derived from the EnergyPlus IDD (Input Data Dictionary) file, which works as a specification of the IDF file format and is used throughout the package for decoding and emission.

[!NOTE]
The parsing and emission performed by this package is always just as good as the IDD file. DEFAULT_IDD is directly derived from the official EnergyPlus repo and should work fine for the most recent versions of EnergyPlus.

[!TIP] For advanced users: you can customize the yaml annotation by monkey patching the make_help_string function, which is exposed as well.

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

idf2yaml-0.1.0.tar.gz (9.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

idf2yaml-0.1.0-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

Details for the file idf2yaml-0.1.0.tar.gz.

File metadata

  • Download URL: idf2yaml-0.1.0.tar.gz
  • Upload date:
  • Size: 9.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.3

File hashes

Hashes for idf2yaml-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d5bb1c576fe77ae3d275bfa71da622763add1e4e8b6e4de372c0cef4d50c6f37
MD5 50adc7109287af1ec3531bfd338d90fa
BLAKE2b-256 0d80b8bcf04f0104b4fdeacde09648ca45f059528d3cf1225a7ff9584a9e79db

See more details on using hashes here.

File details

Details for the file idf2yaml-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: idf2yaml-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.3

File hashes

Hashes for idf2yaml-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 37d49dd01a6db3e0fb1bc2568da58a061619c96e0f7a60b55aacf3490b7c304f
MD5 1e1327c3aae14032bf844cebd0cb14ef
BLAKE2b-256 ffbefb557ae6f6c8b6c5e66b886a75faa984af617416219522661c42430c795a

See more details on using hashes here.

Supported by

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