dgbowl_schemas.dgpost.recipe package
- pydantic model dgbowl_schemas.dgpost.recipe.Recipe
Bases:
BaseModelA
pydantic.BaseModelimplementingRecipe-2.1model fordgpost.Show JSON schema
{ "title": "Recipe", "description": "A :class:`pydantic.BaseModel` implementing ``Recipe-2.1`` model for :mod:`dgpost`.", "type": "object", "properties": { "version": { "const": "2.1", "title": "Version", "type": "string" }, "load": { "anyOf": [ { "items": { "$ref": "#/$defs/Load" }, "type": "array" }, { "type": "null" } ], "default": null, "title": "Load" }, "extract": { "anyOf": [ { "items": { "$ref": "#/$defs/Extract" }, "type": "array" }, { "type": "null" } ], "default": null, "title": "Extract" }, "pivot": { "anyOf": [ { "items": { "$ref": "#/$defs/Pivot" }, "type": "array" }, { "type": "null" } ], "default": null, "title": "Pivot" }, "transform": { "anyOf": [ { "items": { "$ref": "#/$defs/Transform" }, "type": "array" }, { "type": "null" } ], "default": null, "title": "Transform" }, "plot": { "anyOf": [ { "items": { "$ref": "#/$defs/Plot" }, "type": "array" }, { "type": "null" } ], "default": null, "title": "Plot" }, "save": { "anyOf": [ { "items": { "$ref": "#/$defs/Save" }, "type": "array" }, { "type": "null" } ], "default": null, "title": "Save" } }, "$defs": { "At": { "additionalProperties": false, "properties": { "steps": { "default": null, "items": { "type": "string" }, "title": "Steps", "type": "array" }, "indices": { "default": null, "items": { "type": "integer" }, "title": "Indices", "type": "array" }, "timestamps": { "default": null, "items": { "type": "number" }, "title": "Timestamps", "type": "array" } }, "title": "At", "type": "object" }, "AxArgs": { "additionalProperties": true, "properties": { "cols": { "anyOf": [ { "maxItems": 2, "minItems": 2, "prefixItems": [ { "type": "integer" }, { "type": "integer" } ], "type": "array" }, { "type": "null" } ], "default": null, "title": "Cols" }, "rows": { "anyOf": [ { "maxItems": 2, "minItems": 2, "prefixItems": [ { "type": "integer" }, { "type": "integer" } ], "type": "array" }, { "type": "null" } ], "default": null, "title": "Rows" }, "series": { "items": { "$ref": "#/$defs/Series" }, "title": "Series", "type": "array" }, "methods": { "anyOf": [ { "additionalProperties": true, "type": "object" }, { "type": "null" } ], "default": null, "title": "Methods" }, "legend": { "default": false, "title": "Legend", "type": "boolean" } }, "required": [ "series" ], "title": "AxArgs", "type": "object" }, "Column": { "additionalProperties": false, "properties": { "key": { "title": "Key", "type": "string" }, "as": { "title": "As", "type": "string" } }, "required": [ "key", "as" ], "title": "Column", "type": "object" }, "Constant": { "additionalProperties": false, "properties": { "value": { "title": "Value" }, "as": { "title": "As", "type": "string" }, "units": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Units" } }, "required": [ "value", "as" ], "title": "Constant", "type": "object" }, "Extract": { "additionalProperties": false, "description": "Extract columns from loaded files into tables, interpolate as necessary.", "properties": { "into": { "title": "Into", "type": "string" }, "from": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "From" }, "at": { "anyOf": [ { "$ref": "#/$defs/At" }, { "type": "null" } ], "default": null }, "columns": { "anyOf": [ { "items": { "$ref": "#/$defs/Column" }, "type": "array" }, { "type": "null" } ], "default": null, "title": "Columns" }, "constants": { "anyOf": [ { "items": { "$ref": "#/$defs/Constant" }, "type": "array" }, { "type": "null" } ], "default": null, "title": "Constants" } }, "required": [ "into" ], "title": "Extract", "type": "object" }, "Load": { "additionalProperties": false, "description": "Select external files (``NetCDF`` or ``json`` datagrams, ``pkl`` tables) to load.", "properties": { "as": { "title": "As", "type": "string" }, "path": { "title": "Path", "type": "string" }, "type": { "default": "datagram", "enum": [ "netcdf", "datagram", "table" ], "title": "Type", "type": "string" }, "check": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "default": null, "title": "Check" } }, "required": [ "as", "path" ], "title": "Load", "type": "object" }, "Pivot": { "additionalProperties": false, "description": "Reorder tables by grouping rows into arrays using columns as indices.", "properties": { "table": { "title": "Table", "type": "string" }, "as": { "title": "As", "type": "string" }, "using": { "anyOf": [ { "type": "string" }, { "items": { "type": "string" }, "type": "array" } ], "title": "Using" }, "columns": { "anyOf": [ { "items": { "type": "string" }, "type": "array" }, { "type": "null" } ], "default": null, "title": "Columns" }, "timestamp": { "default": "first", "enum": [ "first", "last", "mean" ], "title": "Timestamp", "type": "string" }, "timedelta": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Timedelta" } }, "required": [ "table", "as", "using" ], "title": "Pivot", "type": "object" }, "Plot": { "additionalProperties": false, "description": "Plot data from a single table.", "properties": { "table": { "title": "Table", "type": "string" }, "nrows": { "default": 1, "title": "Nrows", "type": "integer" }, "ncols": { "default": 1, "title": "Ncols", "type": "integer" }, "fig_args": { "anyOf": [ { "additionalProperties": true, "type": "object" }, { "type": "null" } ], "default": null, "title": "Fig Args" }, "ax_args": { "items": { "$ref": "#/$defs/AxArgs" }, "title": "Ax Args", "type": "array" }, "style": { "anyOf": [ { "additionalProperties": true, "type": "object" }, { "type": "null" } ], "default": null, "title": "Style" }, "save": { "anyOf": [ { "$ref": "#/$defs/PlotSave" }, { "type": "null" } ], "default": null } }, "required": [ "table", "ax_args" ], "title": "Plot", "type": "object" }, "PlotSave": { "additionalProperties": true, "properties": { "as": { "title": "As", "type": "string" }, "tight_layout": { "anyOf": [ { "additionalProperties": true, "type": "object" }, { "type": "null" } ], "default": null, "title": "Tight Layout" } }, "required": [ "as" ], "title": "PlotSave", "type": "object" }, "Save": { "additionalProperties": false, "description": "Save a table into an external (``pkl``, ``xlsx``) file.", "properties": { "table": { "title": "Table", "type": "string" }, "as": { "title": "As", "type": "string" }, "type": { "anyOf": [ { "enum": [ "pkl", "json", "xlsx", "csv", "nc" ], "type": "string" }, { "type": "null" } ], "default": null, "title": "Type" }, "columns": { "anyOf": [ { "items": { "type": "string" }, "type": "array" }, { "type": "null" } ], "default": null, "title": "Columns" }, "sigma": { "default": true, "title": "Sigma", "type": "boolean" } }, "required": [ "table", "as" ], "title": "Save", "type": "object" }, "Series": { "additionalProperties": true, "properties": { "y": { "title": "Y", "type": "string" }, "x": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "X" }, "kind": { "default": "scatter", "enum": [ "scatter", "line", "errorbar" ], "title": "Kind", "type": "string" }, "index": { "anyOf": [ { "$ref": "#/$defs/SeriesIndex" }, { "type": "null" } ], "default": { "from_zero": true, "to_units": null } } }, "required": [ "y" ], "title": "Series", "type": "object" }, "SeriesIndex": { "additionalProperties": false, "properties": { "from_zero": { "default": true, "title": "From Zero", "type": "boolean" }, "to_units": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "To Units" } }, "title": "SeriesIndex", "type": "object" }, "Transform": { "additionalProperties": false, "description": "Calculate and otherwise transform the data in the tables.", "properties": { "table": { "title": "Table", "type": "string" }, "with": { "title": "With", "type": "string" }, "using": { "items": { "additionalProperties": true, "type": "object" }, "title": "Using", "type": "array" } }, "required": [ "table", "with", "using" ], "title": "Transform", "type": "object" } }, "additionalProperties": false, "required": [ "version" ] }
- Config:
extra: str = forbid
- field version: Literal['2.1'] [Required]
- field load: Sequence[Load] | None = None
Select external files (
NetCDForjsondatagrams,pkltables) to load.
- field extract: Sequence[Extract] | None = None
Extract columns from loaded files into tables, interpolate as necessary.
- field pivot: Sequence[Pivot] | None = None
Reorder tables by grouping rows into arrays using columns as indices.
- pydantic model dgbowl_schemas.dgpost.recipe.Load
Bases:
BaseModelSelect external files (
NetCDForjsondatagrams,pkltables) to load.Show JSON schema
{ "title": "Load", "description": "Select external files (``NetCDF`` or ``json`` datagrams, ``pkl`` tables) to load.", "type": "object", "properties": { "as": { "title": "As", "type": "string" }, "path": { "title": "Path", "type": "string" }, "type": { "default": "datagram", "enum": [ "netcdf", "datagram", "table" ], "title": "Type", "type": "string" }, "check": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "default": null, "title": "Check" } }, "additionalProperties": false, "required": [ "as", "path" ] }
- Config:
extra: str = forbid
populate_by_name: bool = True
validate_by_alias: bool = True
validate_by_name: bool = True
- Validators:
- field as_: str [Required] (alias 'as')
Name under which the loaded object will be stored in memory.
- field path: str [Required]
Path to the file containing the object to be loaded.
- field type: Literal['netcdf', 'datagram', 'table'] = 'datagram'
Type of the loaded object. Can be either a
NetCDFfile created e.g. usingyadg~5.0, adatagramfile in JSON format created usingyadg~4.0, or atablestored in apklfile as created by Pandas.- Validated by:
- pydantic model dgbowl_schemas.dgpost.recipe.Extract
Bases:
BaseModelExtract columns from loaded files into tables, interpolate as necessary.
Show JSON schema
{ "title": "Extract", "description": "Extract columns from loaded files into tables, interpolate as necessary.", "type": "object", "properties": { "into": { "title": "Into", "type": "string" }, "from": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "From" }, "at": { "anyOf": [ { "$ref": "#/$defs/At" }, { "type": "null" } ], "default": null }, "columns": { "anyOf": [ { "items": { "$ref": "#/$defs/Column" }, "type": "array" }, { "type": "null" } ], "default": null, "title": "Columns" }, "constants": { "anyOf": [ { "items": { "$ref": "#/$defs/Constant" }, "type": "array" }, { "type": "null" } ], "default": null, "title": "Constants" } }, "$defs": { "At": { "additionalProperties": false, "properties": { "steps": { "default": null, "items": { "type": "string" }, "title": "Steps", "type": "array" }, "indices": { "default": null, "items": { "type": "integer" }, "title": "Indices", "type": "array" }, "timestamps": { "default": null, "items": { "type": "number" }, "title": "Timestamps", "type": "array" } }, "title": "At", "type": "object" }, "Column": { "additionalProperties": false, "properties": { "key": { "title": "Key", "type": "string" }, "as": { "title": "As", "type": "string" } }, "required": [ "key", "as" ], "title": "Column", "type": "object" }, "Constant": { "additionalProperties": false, "properties": { "value": { "title": "Value" }, "as": { "title": "As", "type": "string" }, "units": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Units" } }, "required": [ "value", "as" ], "title": "Constant", "type": "object" } }, "additionalProperties": false, "required": [ "into" ] }
- Config:
extra: str = forbid
- Validators:
check_one_input»all fields
- field into: str [Required]
Name of a new, or existing / loaded table into which the extraction happens.
- Validated by:
- field from_: str | None = None (alias 'from')
Name of the source object for the extracted data.
- Validated by:
- field at: At | None = None
Specification of the steps (or data indices) from which data is to be extracted.
- Validated by:
- field columns: Sequence[Column] | None = None
Specifications for the columns to be extracted, including new headers.
- Validated by:
- field constants: Sequence[Constant] | None = None
Specifications for additional columns containing data constants, including units.
- Validated by:
- validator check_one_input » all fields
- pydantic model dgbowl_schemas.dgpost.recipe.Pivot
Bases:
BaseModelReorder tables by grouping rows into arrays using columns as indices.
Show JSON schema
{ "title": "Pivot", "description": "Reorder tables by grouping rows into arrays using columns as indices.", "type": "object", "properties": { "table": { "title": "Table", "type": "string" }, "as": { "title": "As", "type": "string" }, "using": { "anyOf": [ { "type": "string" }, { "items": { "type": "string" }, "type": "array" } ], "title": "Using" }, "columns": { "anyOf": [ { "items": { "type": "string" }, "type": "array" }, { "type": "null" } ], "default": null, "title": "Columns" }, "timestamp": { "default": "first", "enum": [ "first", "last", "mean" ], "title": "Timestamp", "type": "string" }, "timedelta": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Timedelta" } }, "additionalProperties": false, "required": [ "table", "as", "using" ] }
- Config:
extra: str = forbid
populate_by_name: bool = True
validate_by_alias: bool = True
validate_by_name: bool = True
- field table: str [Required]
The name of the table loaded in memory to be pivoted.
- field as_: str [Required] (alias 'as')
The name for the resulting table for in memory storage.
- field using: str | Sequence[str] [Required]
A column name (or their sequence) by which the pivoting is performed.
- field columns: Sequence[str] | None = None
A sequence of column names which are to be pivoted.
- field timestamp: Literal['first', 'last', 'mean'] = 'first'
Specification of the resulting timestamp for the pivoted data. For each pivoted row, the
firstorlasttimestamp can be used as index. Alternatively, themeancan be calculated and used as index.
- field timedelta: str | None = None
If provided, the corresponding time deltas for the pivoted data is computed and stored under the provided column name. By default, this data is not computed.
- pydantic model dgbowl_schemas.dgpost.recipe.Transform
Bases:
BaseModelCalculate and otherwise transform the data in the tables.
Show JSON schema
{ "title": "Transform", "description": "Calculate and otherwise transform the data in the tables.", "type": "object", "properties": { "table": { "title": "Table", "type": "string" }, "with": { "title": "With", "type": "string" }, "using": { "items": { "additionalProperties": true, "type": "object" }, "title": "Using", "type": "array" } }, "additionalProperties": false, "required": [ "table", "with", "using" ] }
- Config:
extra: str = forbid
populate_by_name: bool = True
validate_by_alias: bool = True
validate_by_name: bool = True
- field table: str [Required]
The name of the table loaded in memory to be transformed.
- field with_: str [Required] (alias 'with')
The name of the transform function from dgpost’s transform library.
- field using: Sequence[Dict[str, Any]] [Required]
Specification of any parameters required by the transform function.
- pydantic model dgbowl_schemas.dgpost.recipe.Plot
Bases:
BaseModelPlot data from a single table.
Show JSON schema
{ "title": "Plot", "description": "Plot data from a single table.", "type": "object", "properties": { "table": { "title": "Table", "type": "string" }, "nrows": { "default": 1, "title": "Nrows", "type": "integer" }, "ncols": { "default": 1, "title": "Ncols", "type": "integer" }, "fig_args": { "anyOf": [ { "additionalProperties": true, "type": "object" }, { "type": "null" } ], "default": null, "title": "Fig Args" }, "ax_args": { "items": { "$ref": "#/$defs/AxArgs" }, "title": "Ax Args", "type": "array" }, "style": { "anyOf": [ { "additionalProperties": true, "type": "object" }, { "type": "null" } ], "default": null, "title": "Style" }, "save": { "anyOf": [ { "$ref": "#/$defs/PlotSave" }, { "type": "null" } ], "default": null } }, "$defs": { "AxArgs": { "additionalProperties": true, "properties": { "cols": { "anyOf": [ { "maxItems": 2, "minItems": 2, "prefixItems": [ { "type": "integer" }, { "type": "integer" } ], "type": "array" }, { "type": "null" } ], "default": null, "title": "Cols" }, "rows": { "anyOf": [ { "maxItems": 2, "minItems": 2, "prefixItems": [ { "type": "integer" }, { "type": "integer" } ], "type": "array" }, { "type": "null" } ], "default": null, "title": "Rows" }, "series": { "items": { "$ref": "#/$defs/Series" }, "title": "Series", "type": "array" }, "methods": { "anyOf": [ { "additionalProperties": true, "type": "object" }, { "type": "null" } ], "default": null, "title": "Methods" }, "legend": { "default": false, "title": "Legend", "type": "boolean" } }, "required": [ "series" ], "title": "AxArgs", "type": "object" }, "PlotSave": { "additionalProperties": true, "properties": { "as": { "title": "As", "type": "string" }, "tight_layout": { "anyOf": [ { "additionalProperties": true, "type": "object" }, { "type": "null" } ], "default": null, "title": "Tight Layout" } }, "required": [ "as" ], "title": "PlotSave", "type": "object" }, "Series": { "additionalProperties": true, "properties": { "y": { "title": "Y", "type": "string" }, "x": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "X" }, "kind": { "default": "scatter", "enum": [ "scatter", "line", "errorbar" ], "title": "Kind", "type": "string" }, "index": { "anyOf": [ { "$ref": "#/$defs/SeriesIndex" }, { "type": "null" } ], "default": { "from_zero": true, "to_units": null } } }, "required": [ "y" ], "title": "Series", "type": "object" }, "SeriesIndex": { "additionalProperties": false, "properties": { "from_zero": { "default": true, "title": "From Zero", "type": "boolean" }, "to_units": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "To Units" } }, "title": "SeriesIndex", "type": "object" } }, "additionalProperties": false, "required": [ "table", "ax_args" ] }
- Config:
extra: str = forbid
- field table: str [Required]
The name of the table loaded in memory to be plotted.
- field nrows: int = 1
Number of rows in the figure grid.
- field ncols: int = 1
Number of columns in the figure grid.
- field fig_args: Dict[str, Any] | None = None
Any optional method calls for the figure; passed to
matplotlib.
- field ax_args: Sequence[AxArgs] [Required]
Specifications of the figure axes, including selection of data for the plots.
- field style: Dict[str, Any] | None = None
Specification of overall
matplotlibstyle.
- pydantic model dgbowl_schemas.dgpost.recipe.Save
Bases:
BaseModelSave a table into an external (
pkl,xlsx) file.Show JSON schema
{ "title": "Save", "description": "Save a table into an external (``pkl``, ``xlsx``) file.", "type": "object", "properties": { "table": { "title": "Table", "type": "string" }, "as": { "title": "As", "type": "string" }, "type": { "anyOf": [ { "enum": [ "pkl", "json", "xlsx", "csv", "nc" ], "type": "string" }, { "type": "null" } ], "default": null, "title": "Type" }, "columns": { "anyOf": [ { "items": { "type": "string" }, "type": "array" }, { "type": "null" } ], "default": null, "title": "Columns" }, "sigma": { "default": true, "title": "Sigma", "type": "boolean" } }, "additionalProperties": false, "required": [ "table", "as" ] }
- Config:
extra: str = forbid
populate_by_name: bool = True
validate_by_alias: bool = True
validate_by_name: bool = True
- field table: str [Required]
The name of the table loaded in memory to be stored.
- field as_: str [Required] (alias 'as')
Path to which the table is stored.
- field type: Literal['pkl', 'json', 'xlsx', 'csv', 'nc'] | None = None
Type of the output file.
- field columns: Sequence[str] | None = None
Columns to be exported. By default (
None), all columns from the specifiedtablewill be exported.Note
If any of the columns supplied is not present in the table, a warning will be printed by
dgpost.
- field sigma: bool = True
Whether uncertainties/error estimates in the data should be stripped. Particularly useful when exporting into
xlsxorcsv.