hmp.export()#

export(
variable: str | list[str] | None = None,
*,
deliver: Literal[False] = False,
**options: Any,
) → list[Path][source]#
export(
variable: None = None,
*,
deliver: Literal[True],
**options: Any,
) → tuple[PublishedLine, ...]

Export data of a run to files, or deliver what its [[export]] blocks name.

The words of an [[export]] block and of hmp export: variable says what (a name, a list, or "all"), time or period when, folder or file where. The format follows the data unless format or the extension of file names one. Files land in runs/<run>/exports/ and are recorded in exports/index.json.

Parameters:
  • ref (Ref) – The run: its directory, its name in workspace, or the run.

  • variable (str | list[str] | None) – What to export.

  • deliver (bool) – Send what the [[export]] blocks of the run name, and take no other word.

  • workspace (PathLike | None) – The project directory, or a folder inside it.

  • environment (Environment | None) – A folder or file must sit under the roots its bounds allow. None keeps the default of the machine, which checks nothing.

Returns:

list of pathlib.Path or tuple of PublishedLine – The files written, or with deliver the delivery lines.

Raises:

hydromodpy.core.exceptions.ExportError – If variable is missing, or deliver comes with another word.

Return type:

list[Path] | tuple[PublishedLine, …]

Examples

>>> import hydromodpy as hmp
>>> hmp.export("runs/transient_nwt", "all", workspace="~/ws/p")
>>> hmp.export(run, deliver=True)

Keyword arguments and command-line flags#

The twin command is hmp export.

KeywordDefaultCommand-line flagAccepted by
timeNone--timeevery form
periodNone--periodevery form
formatNone--asevery form
folderNone--toevery form
fileNone--toevery form
crsNone--crsevery form
resolutionNone--resolutionevery form
layerNone--layerevery form
nodata-9999.0--nodataevery form
deliverFalse--deliverevery form
workspaceNone-w --workspaceevery form
environmentNoneno flagevery form

Flags of hmp export with no keyword: --list, --regen. To get their effect from Python, build the configuration object with the values you want, or write them in the TOML file.