pysiral.scripts._argparse_actions

Attributes

__author__

Functions

required_length(→ Type[argparse.Action])

argparse action that defines the required number of arguments for an argument

is_valid_date(→ bool)

Check if a date string is valid in the format YYYY-MM[-DD].

period_conversion(→ Type[argparse.Action])

Argparse action to convert a list of datetime objects into a start and end time coverage.

pysiral_settings_action(→ Type[argparse.Action])

Module Contents

pysiral.scripts._argparse_actions.__author__ = 'Stefan Hendricks <stefan.hendricks@awi.de>'
pysiral.scripts._argparse_actions.required_length(nmin: int, nmax: int) Type[argparse.Action]

argparse action that defines the required number of arguments for an argument with nargs + or *. The action will raise an error if the number of arguments is not within the specified range.

Parameters:
  • nmin – minimum number of arguments required

  • nmax – maximum number of arguments allowed

Returns:

a subclass of argparse.Action that checks the number of arguments

pysiral.scripts._argparse_actions.is_valid_date(date_str: str) bool

Check if a date string is valid in the format YYYY-MM[-DD].

Parameters:

date_str – The string to check, e.g. “2020-01” or “2020-01-15”.

Returns:

Boolean indicating whether the date string is valid.

pysiral.scripts._argparse_actions.period_conversion() Type[argparse.Action]

Argparse action to convert a list of datetime objects into a start and end time coverage.

Returns:

argparse.Action subclass

pysiral.scripts._argparse_actions.pysiral_settings_action(target: Literal['proc', 'output'], level: pysiral.core.flags.PysiralProcessingLevels | pysiral.core.flags.ProductProcessingLevels = None) Type[argparse.Action]