Global settings

NCToolkit lets you set global settings using options() — per session, or once per project with a configuration file.

Setting the number of cores in use

If you're working with ensembles, you'll probably want to change the number of cores used for processing multiple files:

python
nc.options(cores=6)

Setting the temporary directory to use

By default NCToolkit uses the OS's temporary directory, which is usually fastest. If you don't have enough space there, point it elsewhere:

python
nc.options(temp_dir="/foo")

Turning progress bars on or off

By default, a progress bar appears when NCToolkit expects a multi-file operation to take a while. Force it on or off:

python
nc.options(progress="on")
nc.options(progress="off")

Switching off lazy evaluation

By default, evaluation in NCToolkit is lazy (see Lazy evaluation & chaining). To evaluate every method as it's called instead:

python
nc.options(lazy=False)

Setting global settings using a configuration file

To set some global settings permanently, or per-project, create a plain-text file called .nctoolkitrc or nctoolkitrc in your working directory or home directory. NCToolkit checks the working directory first, then the home directory, and uses the first one it finds — falling back to its defaults if neither exists.

The format follows Python dictionary syntax loosely, with setting and value separated by a colon:

.nctoolkitrc
lazy : True
cores : 6

Any setting not specified in the file falls back to its default.