reV.losses.utils.convert_to_full_month_names

convert_to_full_month_names(month_names)[source]

Format an iterable of month names to match those in calendar.

This function will format each input name to match the formatting in calendar.month_name (upper case, no extra whitespace), and it will convert all abbreviations to full month names. No other assumptions are made about the inputs, so an input string “ abc ” will get formatted and passed though as “Abc”.

Parameters:

month_names (iter) – An iterable of strings representing the input month names. Month names can be unformatted and contain 3-letter month abbreviations.

Returns:

list – A list of month names matching the formatting of calendar.month_name (upper case, no extra whitespace). Abbreviations are also converted to a full month name.

Examples

>>> input_names = ['March', ' aprIl  ', 'Jun', 'jul', '  abc ']
>>> convert_to_full_month_names(input_names)
['March', 'April', 'June', 'July', 'Abc']