cape.pykes.options: Options interface for pyKes/Kestrel

cape.pykes.options: Options interface for cape,pykes

This is the Kestrel-specific implementation of the CAPE options package, based on

class cape.pykes.options.Options(*args, **kw)

Options interface for cape.pykes

Call:
>>> opts = Options(fname=None, **kw)
Inputs:
fname: str

File to be read as a JSON file with comments

kw: dict

Additional manual options

Versions:
  • 2021-10-18 @ddalle: Version 1.0

  • 2022-11-03 @ddalle: Version 2.0; OptionsDict

get_JobXML(j=None, i=None, **kw)

Get Template XML file for Kestrel cases

Call:
>>> JobXML = opts.get_JobXML(j=None, i=None, **kw)
Inputs:
opts: Options

options interface

j: {None} | int

Phase index; use None to just return v

i: {None} | int | np.ndarray

opts.x index(es) to use with @expr, @map, etc.

vdef: {None} | object

Manual default

mode: {None} | 0 | 1 | 2 | 3

Warning mode code

0:

no checks

1:

validate silently

2:

validate and show warnings

3:

raise an exception if invalid

ring: {opts._optring[key]} | True | False

Override option to loop through phase inputs

listdepth: {0} | int > 0

Depth of list to treat as a scalar

x: {None} | dict

Ref conditions to use with @expr, @map, etc.; often a run matrix; used in combination with i

sample: {True} | False

Apply j, i, and other settings recursively if output is a list or dict

Outputs:
JobXML: {'kestrel.xml'} | str

Template XML file for Kestrel cases

get_MeshCopyFiles(j=None, i=None, **kw)

Get list of files to copy into case folder

Call:
>>> CopyFiles = opts.get_MeshCopyFiles(j=None, i=None, **kw)
Inputs:
opts: MeshOpts

options interface

j: {None} | int

Phase index; use None to just return v

i: {None} | int | np.ndarray

opts.x index(es) to use with @expr, @map, etc.

vdef: {None} | object

Manual default

mode: {None} | 0 | 1 | 2 | 3

Warning mode code

0:

no checks

1:

validate silently

2:

validate and show warnings

3:

raise an exception if invalid

ring: {opts._optring[key]} | True | False

Override option to loop through phase inputs

listdepth: {0} | int > 0

Depth of list to treat as a scalar

x: {None} | dict

Ref conditions to use with @expr, @map, etc.; often a run matrix; used in combination with i

sample: {True} | False

Apply j, i, and other settings recursively if output is a list or dict

Outputs:
CopyFiles: {[]} | list[str]

list of files to copy into case folder

get_MeshFiles(**kw)

Return full list of mesh file names

Call:
>>> fnames = opts.get_MeshFiles(**kw)
Inputs:
opts: cape.pyover.options.Options

Options interface

Outputs:
fnames: list[str]

List of mesh file names

Versions:
  • 2015-12-29 @ddalle: v1.0

  • 2023-03-17 @ddalle: v2.0; use OptionsDict

get_MeshLinkFiles(j=None, i=None, **kw)

Get list of files to link into case folder

Call:
>>> LinkFiles = opts.get_MeshLinkFiles(j=None, i=None, **kw)
Inputs:
opts: MeshOpts

options interface

j: {None} | int

Phase index; use None to just return v

i: {None} | int | np.ndarray

opts.x index(es) to use with @expr, @map, etc.

vdef: {None} | object

Manual default

mode: {None} | 0 | 1 | 2 | 3

Warning mode code

0:

no checks

1:

validate silently

2:

validate and show warnings

3:

raise an exception if invalid

ring: {opts._optring[key]} | True | False

Override option to loop through phase inputs

listdepth: {0} | int > 0

Depth of list to treat as a scalar

x: {None} | dict

Ref conditions to use with @expr, @map, etc.; often a run matrix; used in combination with i

sample: {True} | False

Apply j, i, and other settings recursively if output is a list or dict

Outputs:
LinkFiles: {[]} | list[str]

list of files to link into case folder

get_ProjectName(j=None, i=None, **kw)

Get project root name, or file prefix

Call:
>>> ProjectName = opts.get_ProjectName(j=None, i=None, **kw)
Inputs:
opts: RunControlOpts

options interface

j: {None} | int

Phase index; use None to just return v

i: {None} | int | np.ndarray

opts.x index(es) to use with @expr, @map, etc.

vdef: {None} | object

Manual default

mode: {None} | 0 | 1 | 2 | 3

Warning mode code

0:

no checks

1:

validate silently

2:

validate and show warnings

3:

raise an exception if invalid

ring: {opts._optring[key]} | True | False

Override option to loop through phase inputs

listdepth: {0} | int > 0

Depth of list to treat as a scalar

x: {None} | dict

Ref conditions to use with @expr, @map, etc.; often a run matrix; used in combination with i

sample: {True} | False

Apply j, i, and other settings recursively if output is a list or dict

Outputs:
ProjectName: {'pykes'} | str

project root name, or file prefix

get_XMLPrefix(j=None, i=None, **kw)

Get base name for Kestrel project XML files

Call:
>>> XMLPrefix = opts.get_XMLPrefix(j=None, i=None, **kw)
Inputs:
opts: RunControlOpts

options interface

j: {None} | int

Phase index; use None to just return v

i: {None} | int | np.ndarray

opts.x index(es) to use with @expr, @map, etc.

vdef: {None} | object

Manual default

mode: {None} | 0 | 1 | 2 | 3

Warning mode code

0:

no checks

1:

validate silently

2:

validate and show warnings

3:

raise an exception if invalid

ring: {opts._optring[key]} | True | False

Override option to loop through phase inputs

listdepth: {0} | int > 0

Depth of list to treat as a scalar

x: {None} | dict

Ref conditions to use with @expr, @map, etc.; often a run matrix; used in combination with i

sample: {True} | False

Apply j, i, and other settings recursively if output is a list or dict

Outputs:
XMLPrefix: {'kestrel'} | str

base name for Kestrel project XML files

init_post()

Initialization hook for Options

Call:
>>> opts.init_post()
Inputs:
opts: Options

Options interface

Versions:
  • 2022-10-23 @ddalle: Version 1.0

select_xml_phase(j=None, **kw)

Get all items from the XML section for phase j

Call:
>>> xmlitems = opts.select_xml_phase(j=None)
Inputs:
opts: Options

Options interface

j: {None} | int

Phase number

Outputs:
xmlitems: list[dict]

List of XML element descriptors

Versions:
  • 2021-10-26 @ddalle: Version 1.0

set_JobXML(v, j=None, mode=None)

Get Template XML file for Kestrel cases

Call:
>>> opts.set_JobXML(JobXML, j=None, i=None, **kw)
Inputs:
opts: Options

options interface

JobXML: {'kestrel.xml'} | str

Template XML file for Kestrel cases

j: {None} | int

Phase index; use None to just return v

mode: {None} | 0 | 1 | 2 | 3

Warning mode code

0:

no checks

1:

validate silently

2:

validate and show warnings

3:

raise an exception if invalid

listdepth: {0} | int > 0

Depth of list to treat as a scalar

set_MeshCopyFiles(v, j=None, mode=None)

Get list of files to copy into case folder

Call:
>>> opts.set_MeshCopyFiles(CopyFiles, j=None, i=None, **kw)
Inputs:
opts: MeshOpts

options interface

CopyFiles: {[]} | list[str]

list of files to copy into case folder

j: {None} | int

Phase index; use None to just return v

mode: {None} | 0 | 1 | 2 | 3

Warning mode code

0:

no checks

1:

validate silently

2:

validate and show warnings

3:

raise an exception if invalid

listdepth: {0} | int > 0

Depth of list to treat as a scalar

set_MeshLinkFiles(v, j=None, mode=None)

Get list of files to link into case folder

Call:
>>> opts.set_MeshLinkFiles(LinkFiles, j=None, i=None, **kw)
Inputs:
opts: MeshOpts

options interface

LinkFiles: {[]} | list[str]

list of files to link into case folder

j: {None} | int

Phase index; use None to just return v

mode: {None} | 0 | 1 | 2 | 3

Warning mode code

0:

no checks

1:

validate silently

2:

validate and show warnings

3:

raise an exception if invalid

listdepth: {0} | int > 0

Depth of list to treat as a scalar

set_ProjectName(v, j=None, mode=None)

Get project root name, or file prefix

Call:
>>> opts.set_ProjectName(ProjectName, j=None, i=None, **kw)
Inputs:
opts: RunControlOpts

options interface

ProjectName: {'pykes'} | str

project root name, or file prefix

j: {None} | int

Phase index; use None to just return v

mode: {None} | 0 | 1 | 2 | 3

Warning mode code

0:

no checks

1:

validate silently

2:

validate and show warnings

3:

raise an exception if invalid

listdepth: {0} | int > 0

Depth of list to treat as a scalar

set_XMLPrefix(v, j=None, mode=None)

Get base name for Kestrel project XML files

Call:
>>> opts.set_XMLPrefix(XMLPrefix, j=None, i=None, **kw)
Inputs:
opts: RunControlOpts

options interface

XMLPrefix: {'kestrel'} | str

base name for Kestrel project XML files

j: {None} | int

Phase index; use None to just return v

mode: {None} | 0 | 1 | 2 | 3

Warning mode code

0:

no checks

1:

validate silently

2:

validate and show warnings

3:

raise an exception if invalid

listdepth: {0} | int > 0

Depth of list to treat as a scalar