utils module

Generic utility functions

gridtools.utils.checkArgument(vDict, vKey, vVal)

This checks to see if there is a key in the passed dictionary. If the key does not exist, create the key with the specified value. No logging of any kind is performed. Any errors are silently ignored.

Parameters
  • vDict (dict) – python dictionary; typically kwargs

  • vKey (string) – dictionary key to check

  • vVal (value) – value to use for dictionary key if it does not exist

Returns

none

Return type

none

gridtools.utils.get_architecture()

Returns the executable architecture.

gridtools.utils.get_git_repo_version_info(grd=None)

Describe the current version of this script as known by Git.

This function is based on code from [IAH20].

gridtools.utils.get_history_entry(argv)

Construct an entry for the global ‘history’ attribute of a NetCDF file, which is a date and the command used.

This function is copied from [IAH20].

gridtools.utils.get_machine()

Returns the machine type: i386, x86_64, etc.

gridtools.utils.get_processor()

Returns the real processor name.

gridtools.utils.get_python_version()

Returns the python version.

gridtools.utils.get_release()

Returns the system’ release version.

gridtools.utils.get_system()

Returns the system/OS name: Linux, Darwin, etc.

gridtools.utils.runningHow()

Utility function to determine how a python script is being run.

Detected Value

Returned Value

ZMQInteractiveShell

jupyter

TerminalInteractiveShell

ipython

<other>

<other>

on error/exception

python

gridtools.utils.sha256sum(xrData)

Utility function that returns a hash of the data provided.