### XML Schema Example for Global Quantities Node
Source: https://github.com/iterorganization/imas-data-dictionary/blob/develop/docs/dd_developer_guide.rst
An example of a simple structure node declaration in XML Schema, named 'global_quantities', which references the 'core_profiles_global_quantities' complex type and includes documentation.
```xml
Various global quantities derived from the profiles
```
--------------------------------
### Install and open legacy local documentation
Source: https://github.com/iterorganization/imas-data-dictionary/blob/develop/README.md
This process involves installing the IMAS Data Dictionary with documentation generation enabled, then using the `dd_doc` command with the `--legacy` or `-l` flag to open the locally installed HTML documentation in the browser.
```bash
IMAS_BUILD_DOCS=1 pip install .
dd_doc --legacy
# or
dd_doc -l
```
--------------------------------
### IDS Path Syntax Examples (Python)
Source: https://context7.com/iterorganization/imas-data-dictionary/llms.txt
Python examples illustrating the IDS Path syntax used for data access within the IMAS Data Dictionary. These examples cover basic navigation, array indexing (1-based and negative), range specification, multi-dimensional arrays, set indexing, and stride specification, which are applicable to Access Layer's `partial_get` operations and URI fragments.
```python
# IDS Path syntax examples (for use with Access Layer):
# Basic path - navigate structure hierarchy
path = "/equilibrium/time_slice/profiles_1d/psi"
# Array indexing (1-based, Fortran-style)
path = "/core_profiles/profiles_1d(3)/electrons/temperature" # 3rd time slice
# Range specification
path = "/equilibrium/time_slice(1:5)" # Time slices 1 through 5
path = "/core_profiles/profiles_1d(:)/grid/rho_tor_norm" # All time slices
# Negative indexing (from end)
path = "/equilibrium/time_slice(-1)" # Last time slice
# Multi-dimensional arrays
path = "/equilibrium/time_slice(1)/profiles_2d(1,1:10)" # First 10 cols of first row
# Set indexing
path = "/core_profiles/profiles_1d({1,3,5})" # Slices 1, 3, and 5
# Stride specification
path = "/summary/time(::10)" # Every 10th time point
```
--------------------------------
### Install IMAS Data Dictionary using pip
Source: https://github.com/iterorganization/imas-data-dictionary/blob/develop/README.md
This command clones the repository and installs the IMAS Data Dictionary package within a Python environment. The `--user` flag can be used for user-specific installation.
```shell
git clone git@github.com:iterorganization/IMAS-Data-Dictionary.git
cd IMAS-Data-Dictionary
pip install . [--user]
```
--------------------------------
### Applying XSL Transforms with Make
Source: https://github.com/iterorganization/imas-data-dictionary/blob/develop/docs/dd_developer_guide.rst
Demonstrates the command-line usage of the 'make' command to apply XSL transforms for generating DD artifacts.
```bash
make
```
--------------------------------
### Example IDS Element in XML
Source: https://github.com/iterorganization/imas-data-dictionary/blob/develop/docs/dd_developer_guide.rst
This XML snippet provides an example of an '' element, representing an Interface Data Structure. It includes attributes like name, maxoccur, documentation, lifecycle_status, and lifecycle_version.
```xml
```
--------------------------------
### Define Ion State Label
Source: https://github.com/iterorganization/imas-data-dictionary/blob/develop/docs/ggd_guide/examples.rst
Defines the label for an ion state. This specifies the charge state of the ion, for example, 'Ne+2' for doubly ionized Neon.
```text
ggd(1).ion(1).label = "Ne+2"
```
--------------------------------
### XML Field Element Example
Source: https://github.com/iterorganization/imas-data-dictionary/blob/develop/docs/dd_developer_guide.rst
An example of a field element within the IMAS Data Dictionary XML, showcasing various attributes used to define data properties.
```xml
```
--------------------------------
### Define Grid Identifier
Source: https://github.com/iterorganization/imas-data-dictionary/blob/develop/docs/ggd_guide/examples.rst
Sets the name, index, and description for a grid. This is a fundamental step in defining a new grid within the system.
```python
grid_ggd(1).identifier.name = "grid_example_4"
grid_ggd(1).identifier.index = 1
grid_ggd(1).identifier.description = "Grid - example 4"
```
--------------------------------
### Define Space Identifier
Source: https://github.com/iterorganization/imas-data-dictionary/blob/develop/docs/ggd_guide/examples.rst
Configures the name, index, and description for a space within a grid. This step is crucial for organizing spatial data.
```python
grid_ggd(1).space(1).identifier.name = "space_example_4"
grid_ggd(1).space(1).identifier.index = 1
grid_ggd(1).space(1).identifier.description = "Space - example 4"
```
--------------------------------
### Define Ion Specie Label
Source: https://github.com/iterorganization/imas-data-dictionary/blob/develop/docs/ggd_guide/examples.rst
Defines the label for an ion specie. This is used to identify the specific ion being described, such as 'Ne+' for Neon.
```text
ggd(1).ion(1).label = "Ne+"
```
--------------------------------
### Define Cells Grid Subset
Source: https://github.com/iterorganization/imas-data-dictionary/blob/develop/docs/ggd_guide/examples.rst
Establishes the 'cells' grid subset, which includes all 0D objects. The configuration includes dimension, name, index, and a descriptive text.
```text
grid_ggd(1).grid_subset(3).dimension = 3
grid_ggd(1).grid_subset(3).identifier.name = "cells"
grid_ggd(1).grid_subset(3).identifier.index = 3
grid_ggd(1).grid_subset(3).identifier.description = "All 2D cells in the domain"
```
--------------------------------
### URI Fragment Format Examples
Source: https://context7.com/iterorganization/imas-data-dictionary/llms.txt
Examples demonstrating the format of URI fragments used for referencing specific elements within Iterative Management and Archiving System (IMAS) Data Structures (IDSs). These URIs are used to pinpoint particular data fields or profiles within the data dictionary.
```python
uri = "#equilibrium/time_slice(1)/profiles_1d/psi"
uri = "#core_profiles:2/profiles_1d(1)" # Occurrence 2 of core_profiles
```
--------------------------------
### Multiple Renaming Operations Metadata (XML)
Source: https://github.com/iterorganization/imas-data-dictionary/blob/develop/docs/dd_developer_guide.rst
Handles multiple renaming operations by listing comma-separated versions, descriptions, and previous names.
```xml
3.26.0,3.40.0
aos_renamed
antenna,launcher
```
--------------------------------
### XML Alias Attribute for Backward Compatibility
Source: https://github.com/iterorganization/imas-data-dictionary/blob/develop/docs/dd_developer_guide.rst
Demonstrates the use of the 'alias' attribute in XML to provide backward compatibility for node names. Multiple aliases can be specified, separated by commas.
```xml
30
```
--------------------------------
### Specify Time Slices for GGD
Source: https://github.com/iterorganization/imas-data-dictionary/blob/develop/docs/ggd_guide/examples.rst
Allocates GGD (General Grid Description) structures for different time slices and assigns specific time values to them. This is crucial for time-dependent data.
```text
ggd(1).time = 1.0
ggd(2).time = 2.0
```
--------------------------------
### Example Field Element in XML
Source: https://github.com/iterorganization/imas-data-dictionary/blob/develop/docs/dd_developer_guide.rst
This XML snippet demonstrates a '' element within an '', representing a node in the Data Dictionary. It includes attributes such as name, path, documentation, data_type, type, and lifecycle information.
```xml
```
--------------------------------
### Define Ion Density for Nodes
Source: https://github.com/iterorganization/imas-data-dictionary/blob/develop/docs/ggd_guide/examples.rst
Defines the density of a specific ion specie and state for the 'nodes' grid subset. It links the density data to the 'nodes' subset and provides the density values.
```text
ggd(1).ion(1).state(1).density(1).grid_index = 1
ggd(1).ion(1).state(1).density(1).grid_subset_index = 1
ggd(1).ion(1).state(1).density(1).values = e.g. [0.1, 0.2, 0.3, 0.4]
```
--------------------------------
### Add Node Introduction Metadata in XML
Source: https://github.com/iterorganization/imas-data-dictionary/blob/develop/docs/dd_developer_guide.rst
This XML snippet shows how to add metadata to indicate the version after which a node was introduced into the Data Dictionary. This metadata should be placed within the '' tag of the node.
```xml
LAST TAG BEFORE THE INTRODUCTION OF THE NODE
```
--------------------------------
### Define 2D Cell Points using 1D Spaces
Source: https://github.com/iterorganization/imas-data-dictionary/blob/develop/docs/ggd_guide/examples.rst
This section illustrates how to define the points of a 2D cell within a grid subset. It shows how to navigate through the grid structure using space, dimension, and index to assign coordinates for each of the four points defining the cell.
```python
grid_ggd(1).grid_subset(4).element(1).object(1).space = 1
grid_ggd(1).grid_subset(4).element(1).object(1).dimension = 1
grid_ggd(1).grid_subset(4).element(1).object(1).index = 4
grid_ggd(1).grid_subset(4).element(1).object(2).space = 2
grid_ggd(1).grid_subset(4).element(1).object(2).dimension = 1
grid_ggd(1).grid_subset(4).element(1).object(2).index = 1
grid_ggd(1).grid_subset(4).element(1).object(3).space = 1
grid_ggd(1).grid_subset(4).element(1).object(3).dimension = 1
grid_ggd(1).grid_subset(4).element(1).object(3).index = 5
grid_ggd(1).grid_subset(4).element(1).object(4).space = 2
grid_ggd(1).grid_subset(4).element(1).object(4).dimension = 1
grid_ggd(1).grid_subset(4).element(1).object(4).index = 1
grid_ggd(1).grid_subset(4).element(1).object(5).space = 1
grid_ggd(1).grid_subset(4).element(1).object(5).dimension = 1
grid_ggd(1).grid_subset(4).element(1).object(5).index = 5
grid_ggd(1).grid_subset(4).element(1).object(6).space = 2
grid_ggd(1).grid_subset(4).element(1).object(6).dimension = 1
grid_ggd(1).grid_subset(4).element(1).object(6).index = 2
grid_ggd(1).grid_subset(4).element(1).object(7).space = 1
grid_ggd(1).grid_subset(4).element(1).object(7).dimension = 1
grid_ggd(1).grid_subset(4).element(1).object(7).index = 4
grid_ggd(1).grid_subset(4).element(1).object(8).space = 2
grid_ggd(1).grid_subset(4).element(1).object(8).dimension = 1
grid_ggd(1).grid_subset(4).element(1).object(8).index = 2
```
--------------------------------
### Assign Electron Temperature Data (Time Slice 1)
Source: https://github.com/iterorganization/imas-data-dictionary/blob/develop/docs/ggd_guide/examples.rst
Defines and assigns electron temperature data for the first time slice. It links the data to a specific grid subset using grid_index and grid_subset_index, and provides the actual values.
```text
ggd(1).electrons.temperature(1).grid_index = 1
ggd(1).electrons.temperature(1).grid_subset_index = 1
ggd(1).electrons.temperature(1).values = e.g. [1.1, 2.2, ..., 15.15]
```
--------------------------------
### Renaming Simple Structure Metadata (XML)
Source: https://github.com/iterorganization/imas-data-dictionary/blob/develop/docs/dd_developer_guide.rst
Marks a simple structure for renaming. The description is 'structure_renamed', and the previous name is provided.
```xml
3.26.0
structure_renamed
launching_angle_pol
```
--------------------------------
### Assign Electron Temperature Data (Time Slice 2)
Source: https://github.com/iterorganization/imas-data-dictionary/blob/develop/docs/ggd_guide/examples.rst
Assigns electron temperature data for the second time slice. Similar to the first time slice, it specifies the grid linkage and the corresponding data values.
```text
ggd(2).electrons.temperature(1).grid_index = 1
ggd(2).electrons.temperature(1).grid_subset_index = 1
ggd(2).electrons.temperature(1).values = e.g. [2.2, 3.3, ..., 16.16]
```
--------------------------------
### Navigate Grid Structure using Indices
Source: https://github.com/iterorganization/imas-data-dictionary/blob/develop/docs/ggd_guide/examples.rst
This snippet shows the general syntax for navigating the grid structure to access objects within specific spaces, dimensions, and indices. It is used to locate and manipulate individual components of the grid.
```python
grid_ggd(1).space(space_index).objects_per_dimension(dimension_index).object(index)
```
--------------------------------
### Define Electron Temperature for Nodes
Source: https://github.com/iterorganization/imas-data-dictionary/blob/develop/docs/ggd_guide/examples.rst
Defines electron temperature for the 'nodes' grid subset. It links the temperature data to the 'nodes' subset using grid_index and grid_subset_index, and provides the actual temperature values.
```text
ggd(1).electrons.temperature(1).grid_index = 1
ggd(1).electrons.temperature(1).grid_subset_index = 1
ggd(1).electrons.temperature(1).values = e.g. [1.1, 2.2, 3.3, 4.4]
```
--------------------------------
### Define Points in GGD
Source: https://github.com/iterorganization/imas-data-dictionary/blob/develop/docs/ggd_guide/examples.rst
Defines the geometry of points (0D objects) within a GGD grid space. Each point is defined by its coordinates.
```plaintext
...objects_per_dimension(1).object(1).geometry = [0.0, 0.0]
...objects_per_dimension(1).object(2).geometry = [1.0, 0.0]
...objects_per_dimension(1).object(3).geometry = [1.0, 1.0]
...objects_per_dimension(1).object(4).geometry = [0.0, 1.0]
```
--------------------------------
### JOREK Fourier Mode Representation
Source: https://github.com/iterorganization/imas-data-dictionary/blob/develop/docs/ggd_guide/examples.rst
Illustrates the mapping between Fourier mode indices (l) and their corresponding mathematical representations, such as cosine and sine functions of toroidal angles. This is crucial for understanding how periodic phenomena are handled in simulations.
```mathematics
Z_l(\varphi) = \sum_{n=-N_{tor}}^{N_{tor}} Z_l^n e^{in\varphi}
```
```mathematics
l=1: Z_l(\varphi) = 1 (constant mode)
l=2: Z_l(\varphi) = \cos(n_p\varphi_p)
l=3: Z_l(\ varphi) = \sin(n_p\varphi_p)
l=4: Z_l(\varphi) = \cos(2n_p\varphi)
l=5: Z_l(\varphi) = \sin(2n_p\varphi)
```
--------------------------------
### Open online documentation with dd_doc command
Source: https://github.com/iterorganization/imas-data-dictionary/blob/develop/README.md
This command-line utility opens the online documentation for the IMAS Data Dictionary in the default web browser.
```bash
dd_doc
```
--------------------------------
### Define Nodes Grid Subset
Source: https://github.com/iterorganization/imas-data-dictionary/blob/develop/docs/ggd_guide/examples.rst
Sets up the 'nodes' grid subset within the GGD structure. It specifies the name, index, and a description for this subset, which represents all 0D objects in the domain.
```text
grid_ggd(1).grid_subset(1).identifier.name = "nodes"
grid_ggd(1).grid_subset(1).identifier.index = 1
grid_ggd(1).grid_subset(1).identifier.description = "All nodes in the domain"
```
--------------------------------
### XML Metadata for Data Item Static/Dynamic/Constant
Source: https://github.com/iterorganization/imas-data-dictionary/blob/develop/docs/dm_rules_guidelines.rst
Shows the XML syntax for specifying the static, constant, or dynamic nature of a data item using the '' metadata tag. This classification helps in understanding data variability within pulses or simulations.
```xml
static|dynamic|constant
```
--------------------------------
### Define 0D Objects (Points) Geometry
Source: https://github.com/iterorganization/imas-data-dictionary/blob/develop/docs/ggd_guide/examples.rst
Defines the geometry of 0D objects (points) by specifying their coordinates. This is used for defining the nodes of a grid.
```python
...objects_per_dimension(1).object(1).geometry = [r_1, z_1]
...objects_per_dimension(1).object(2).geometry = [r_2, z_2]
...objects_per_dimension(1).object(3).geometry = [r_3, z_3]
...
...objects_per_dimension(1).object(20).geometry = [r_20, z_20]
```
--------------------------------
### Define Grid Identifier in GGD
Source: https://github.com/iterorganization/imas-data-dictionary/blob/develop/docs/ggd_guide/examples.rst
Sets the name, index, and description for a GGD grid. This is a fundamental step in defining a new grid structure.
```plaintext
grid_ggd(1).identifier.name = "grid_example_1"
grid_ggd(1).identifier.index = 1
grid_ggd(1).identifier.description = "Grid - example 1"
```
--------------------------------
### Renaming IDS Metadata (XML)
Source: https://github.com/iterorganization/imas-data-dictionary/blob/develop/docs/dd_developer_guide.rst
Marks an IDS (Integrated Data System) for renaming. The description is 'ids_renamed', and the previous IDS name is specified.
```xml
3.40.0
ids_renamed
gyrokinetics
```
--------------------------------
### idsinfo CLI Commands (Bash)
Source: https://context7.com/iterorganization/imas-data-dictionary/llms.txt
A collection of bash commands for the `idsinfo` CLI tool, demonstrating how to retrieve metadata, list IDS names, find the data dictionary path, query specific field information, search for fields, and list fields within an IDS. These commands provide quick access to Data Dictionary information from the terminal.
```bash
# Show DD metadata (version and COCOS)
idsinfo metadata
# Output: This is Data Dictionary version = 4.1.1, following COCOS = 17
# List all IDS names
idsinfo idsnames
# Output:
# amns_data
# b_field_non_axisymmetric
# balance_of_plant
# ...
# Get path to data_dictionary.xml
idsinfo idspath
# Output: /path/to/imas_data_dictionary/resources/schemas/data_dictionary.xml
# Query info about a specific field
idsinfo info equilibrium time_slice/profiles_1d/psi
# Output: Poloidal magnetic flux [Wb]
# Get all attributes for a field
idsinfo info equilibrium time_slice/profiles_1d/psi -a
# Output:
# name: psi
# path: time_slice/profiles_1d/psi
# documentation: Poloidal magnetic flux
# data_type: FLT_1D
# units: Wb
# coordinate1: time_slice/profiles_1d/rho_tor_norm
# Select specific attribute
idsinfo info core_profiles profiles_1d/electrons/temperature -s units
# Output: eV
# Search for fields across all IDSs
idsinfo search temperature
# Output:
# core_profiles:
# profiles_1d/electrons/temperature
# profiles_1d/ions/temperature
# edge_profiles:
# ggd/electrons/temperature
# ...
# Search with verbose output (includes units and docs)
idsinfo search density -v
# Output:
# core_profiles:
# profiles_1d/electrons/density
# Description: Electron density
# Unit: m^-3
# Strict search (exact match)
idsinfo search value -s
# List all fields in an IDS
idsinfo idsfields summary
idsinfo idsfields equilibrium -v
```
--------------------------------
### Renaming Array of Structure Metadata (XML)
Source: https://github.com/iterorganization/imas-data-dictionary/blob/develop/docs/dd_developer_guide.rst
Marks an array of structures for renaming. Uses 'aos_renamed' as the description and specifies the previous name of the array.
```xml
3.26.0
aos_renamed
antenna
```
--------------------------------
### Define Space Geometry and Coordinates
Source: https://github.com/iterorganization/imas-data-dictionary/blob/develop/docs/ggd_guide/examples.rst
Specifies the geometry type (e.g., standard geometry index 0) and coordinate types (e.g., R and Z for 2D space) for a given space. This defines the dimensionality and nature of the spatial domain.
```python
grid_ggd(1).space(1).geometry_type.index = 0
grid_ggd(1).space(1).coordinate_types = [4, 3]
```
--------------------------------
### Define Nodes Grid Subset in GGD
Source: https://github.com/iterorganization/imas-data-dictionary/blob/develop/docs/ggd_guide/examples.rst
Defines a grid subset for nodes (0D objects) in GGD. This subset is composed of all defined points in the domain.
```plaintext
grid_ggd(1).grid_subset(1).dimension = 1
grid_ggd(1).grid_subset(1).identifier.name = "nodes"
grid_ggd(1).grid_subset(1).identifier.index = 1
grid_ggd(1).grid_subset(1).identifier.description = "All nodes in the domain"
```
--------------------------------
### Attaching a URL to a Data Dictionary Node
Source: https://github.com/iterorganization/imas-data-dictionary/blob/develop/docs/dd_developer_guide.rst
Demonstrates how to attach an optional URL to a Data Dictionary node within the `` tag. This URL can point to external websites or local documents within the DD repository, which will be rendered as links in the generated HTML documentation.
```xml
static
1...N
1...N
pf_active/PFConnections.html
```