@decorator
def with_output(wrapped, *args, output=None, compression_level=1, least_significant_digit: int=None, **kwargs):
    'Add `output` keyword only argument.\n    Add `compression_level` option.\n    Add `least_significant_digit` option.\n\n    This is used to add extra `output`, `compression_level` and `least_significant_digit` CLI\n    options. If `output` is provided, it saves the result of calling `wrapped` to file and returns\n    None, otherwise it returns the result. If `compression_level` is provided, it compresses the\n    data with the provided compression level (or not, if `compression_level` 0). If\n    `least_significant_digit` provided, it will quantize the data to a certain number of\n    significant figures.\n\n    Args:\n        wrapped (obj):\n            The function to be wrapped.\n        output (str, optional):\n            Output file name. If not supplied, the output object will be\n            printed instead.\n        compression_level (int):\n            Will set the compression level (1 to 9), or disable compression (0).\n        least_significant_digit (int):\n            If specified will truncate the data to a precision given by\n            10**(-least_significant_digit), e.g. if least_significant_digit=2, then the data will\n            be quantized to a precision of 0.01 (10**(-2)). See\n            http://www.esrl.noaa.gov/psd/data/gridded/conventions/cdc_netcdf_standard.shtml\n            for details. When used with `compression level`, this will result in lossy\n            compression.\n    Returns:\n        Result of calling `wrapped` or None if `output` is given.\n    '
    from improver.utilities.save import save_netcdf
    result = wrapped(*args, **kwargs)
    if (output and result):
        save_netcdf(result, output, compression_level, least_significant_digit)
        return
    return result
Add `output` keyword only argument.
Add `compression_level` option.
Add `least_significant_digit` option.

This is used to add extra `output`, `compression_level` and `least_significant_digit` CLI
options. If `output` is provided, it saves the result of calling `wrapped` to file and returns
None, otherwise it returns the result. If `compression_level` is provided, it compresses the
data with the provided compression level (or not, if `compression_level` 0). If
`least_significant_digit` provided, it will quantize the data to a certain number of
significant figures.

Args:
    wrapped (obj):
        The function to be wrapped.
    output (str, optional):
        Output file name. If not supplied, the output object will be
        printed instead.
    compression_level (int):
        Will set the compression level (1 to 9), or disable compression (0).
    least_significant_digit (int):
        If specified will truncate the data to a precision given by
        10**(-least_significant_digit), e.g. if least_significant_digit=2, then the data will
        be quantized to a precision of 0.01 (10**(-2)). See
        http://www.esrl.noaa.gov/psd/data/gridded/conventions/cdc_netcdf_standard.shtml
        for details. When used with `compression level`, this will result in lossy
        compression.
Returns:
    Result of calling `wrapped` or None if `output` is given.
@decorator
def with_output(wrapped, *args, output=None, compression_level=1, least_significant_digit: int=None, **kwargs):
    'Add `output` keyword only argument.\n    Add `compression_level` option.\n    Add `least_significant_digit` option.\n\n    This is used to add extra `output`, `compression_level` and `least_significant_digit` CLI\n    options. If `output` is provided, it saves the result of calling `wrapped` to file and returns\n    None, otherwise it returns the result. If `compression_level` is provided, it compresses the\n    data with the provided compression level (or not, if `compression_level` 0). If\n    `least_significant_digit` provided, it will quantize the data to a certain number of\n    significant figures.\n\n    Args:\n        wrapped (obj):\n            The function to be wrapped.\n        output (str, optional):\n            Output file name. If not supplied, the output object will be\n            printed instead.\n        compression_level (int):\n            Will set the compression level (1 to 9), or disable compression (0).\n        least_significant_digit (int):\n            If specified will truncate the data to a precision given by\n            10**(-least_significant_digit), e.g. if least_significant_digit=2, then the data will\n            be quantized to a precision of 0.01 (10**(-2)). See\n            http://www.esrl.noaa.gov/psd/data/gridded/conventions/cdc_netcdf_standard.shtml\n            for details. When used with `compression level`, this will result in lossy\n            compression.\n    Returns:\n        Result of calling `wrapped` or None if `output` is given.\n    '
    from improver.utilities.save import save_netcdf
    result = wrapped(*args, **kwargs)
    if (output and result):
        save_netcdf(result, output, compression_level, least_significant_digit)
        return
    return result