improver.utilities.cli_utilities module

Provides support utilities for cli scripts.

improver.utilities.cli_utilities.load_json_or_none(file_path)[source]

If there is a path, runs json.load and returns it. Else returns None.

Parameters

file_path (str or None) – File path to the json file to load.

Returns

A dictionary loaded from a json file. or None

Return type

dict or None

improver.utilities.cli_utilities.radius_or_radii_and_lead(radius=None, radii_by_lead_time=None)[source]

Takes either argument and returns radius/radii and lead time.

Parameters
  • radius (float or None) – If it exists it returns it as a radius

  • radii_by_lead_time (list of str or None) – If radius doesn’t exist and this does, it splits by a comma and gives radius_or_radii [0] and lead_times [1].

Returns

tuple containing:
radius_or_radii (float):

Radius or radii.

lead_times (list):

If radii, list of lead times. Else None.

Return type

(tuple)

Raises
  • TypeError – When both radius and radii_by_lead_time are None.

  • TypeError – When both radius and radii_by_lead_time are not None.