… change the package settings?

… change the package settings?#

Here are all settings:

import h5rdmtoolbox as h5tbx

h5tbx.get_config()
{'return_xarray': True,
 'advanced_shape_repr': True,
 'natural_naming': True,
 'hdf_compression': 'gzip',
 'hdf_compression_opts': 5,
 'adjusting_plotting_labels': True,
 'xarray_unit_repr_in_plots': 'in',
 'plotting_name_order': ('plot_name', 'long_name', 'standard_name'),
 'require_unit': True,
 'ureg_format': 'C~',
 'init_logger_level': 'ERROR',
 'dtime_fmt': '%Y%m%d%H%M%S%f',
 'expose_user_prop_to_attrs': True,
 'scale_attribute_name': 'scale',
 'offset_attribute_name': 'offset',
 'add_provenance': False,
 'ignore_standard_attribute_errors': False,
 'allow_deleting_standard_attributes': False,
 'parallel_find': True}

Set a setting with context manager only for a block of code:

print('berfore: ', h5tbx.get_config('ureg_format'))

with h5tbx.set_config(ureg_format='L~'):
    pass
    print('during: ', h5tbx.get_config('ureg_format'))

print('after: ', h5tbx.get_config('ureg_format'))
berfore:  C~
during:  L~
after:  C~

Set it for the session:

h5tbx.set_config(ureg_format='C~')
<h5rdmtoolbox._cfg.set_config at 0x1e68c2139d0>