load: load datagrams and tables
Code author: Ueli Sauter, Peter Kraus
The function dgpost.utils.load.load()
processes the below specification
in order to load the datagram json file:
- pydantic model dgbowl_schemas.dgpost.recipe.Load
Select external files (
NetCDF
orjson
datagrams,pkl
tables) 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
- 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
NetCDF
file created e.g. usingyadg~5.0
, adatagram
file in JSON format created usingyadg~4.0
, or atable
stored in apkl
file as created by Pandas.- Validated by:
- model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
Note
The key as
is not processed by load()
, it should be used by its caller
to store the returned datagram or pd.DataFrame
into the correct variable.
- dgpost.utils.load.load(path, check=None, type='netcdf')
- Return type:
Union
[dict
,DataFrame
]