improver.utilities.filename module

Module for generating IMPROVER-compliant file names.

improver.utilities.filename.generate_file_name(cube, parameter=None)[source]

From a forecast cube, generate an IMPROVER-suitable file name using the correct lead time. Based on existing StaGE functionality. Requires a “time” coordinate. If the cube has no “forecast_period” coordinate (for example if the input is a radar composite or other observation), this function creates a dummy string representing a forecast period of zero.

Parameters:cube (iris.cube.Cube) – Cube containing nowcast data
Kwargs:
parameter (str):
Optional parameter name to use in the output filename rather than taking the name of the cube diagnostic.
Returns:File base name to which to write
Return type:filename (str)
Raises:iris.exceptions.CoordinateNotFoundError – If the input cube has no “time” coordinate