pysiral.scripts.parser_items

This module defines default command line arguments for pysiral scripts.

Attributes

__author__

Classes

ArgparseArgumentsArgs

PlatformID

ProcessingPeriod

Hemisphere

Duration

ProductProcessingLevel

DataRecord

ExcludeMonths

InputVersion

SourceDatasetID

L1PFile

L1PSettings

L2Settings

L3Settings

L2Outputs

L2POutputs

L3Outputs

MultiProcesssingNumCores

UseMultiProcesssing

ForceL2DefRecordType

L1PFiles

L2iDirectory

L3Directory

L3Grid

DOI

DefaultCommandLineArguments

Module Contents

pysiral.scripts.parser_items.__author__ = 'Stefan Hendricks <stefan.hendricks@awi.de>'
class pysiral.scripts.parser_items.ArgparseArgumentsArgs
name_or_flags: ClassVar[list[str]] = []
action: str | Callable | None = None
nargs: str | None = None
const: str | int | None = None
default: Any = None
type: Callable | None = None
choices: List[Any] | None = None
required: bool | None = None
help: str = None
metavar: str | None = None
dest: str = None
get() Tuple[List[str], dict[str, Any]]

Returns the input arguments and keyword arguments to parser.add_argument()

Returns:

A tuple containing a list of argument names or flags and a ictionary of keyword arguments

as_positional(argument_name: str) ArgparseArgumentsArgs

Redefines the argument to be a positional argument

Parameters:

argument_name – The argparse parser to add the argument to.

class pysiral.scripts.parser_items.PlatformID

Bases: ArgparseArgumentsArgs

name_or_flags: ClassVar[list[str]] = ['-p', '--platform']
action: str = 'store'
dest: str = 'platform'
type: Callable
choices: List[Any]
metavar: str = '<platform_id>'
help: str = Multiline-String
Show Value
"""
    Radar altimeter platform id as defined in pysiral (see `pysiral info --platforms`). This option is
    required only if the processor configuration file is applicable to multiple platforms
    (e.g. sentinel3a, sentinel3b, etc.). If the processor configuration file is platform-specific,
    this option has no effect.
    """
class pysiral.scripts.parser_items.ProcessingPeriod

Bases: ArgparseArgumentsArgs

name_or_flags: ClassVar[list[str]] = ['processing_period']
action: Callable
metavar: str = '<processing period>'
help: str = Multiline-String
Show Value
"""
    Period definition for processing, given as a string in the format "YYYY-MM[-DD][:YYYY-MM[-DD]]".
    If only one date is given, it will be interpreted as a period (e.g., "2023-01" for January 2023 and
    ("2023-01-01" for one day). If two colon-separated dates are given, they will be interpreted
    as a start and end date or month.
    """
class pysiral.scripts.parser_items.Hemisphere

Bases: ArgparseArgumentsArgs

name_or_flags: ClassVar[list[str]] = ['-H', '--hemisphere']
action: str = 'store'
dest: str = 'hemisphere'
default: Any
metavar: str = ''
choices: List[Any]
type: Callable
help: str = Multiline-String
Show Value
"""
    Target hemisphere for processing. Options are 'global', 'nh', or 'sh'.
    """
class pysiral.scripts.parser_items.Duration

Bases: ArgparseArgumentsArgs

name_or_flags: ClassVar[list[str]] = ['-d', '--duration']
action: str = 'store'
dest: str = 'duration'
metavar: str = '<duration>'
choices: List[Any]
type: Callable
help: str = Multiline-String
Show Value
"""
    Duration type for splitting the processing period into segments.
    Options are 'daily', 'isoweekly', or 'monthly' and will be passed
    `dateperiod.Dateperiod().get_segments()`. If left empty, the
    duration type will be inferred from the processing period definition.
    """
class pysiral.scripts.parser_items.ProductProcessingLevel

Bases: ArgparseArgumentsArgs

name_or_flags: ClassVar[list[str]] = ['-p', '--processing-level']
dest: str = 'processing_level'
metavar: str = '<processing_level>'
choices: List[Any]
type: Callable
help: str = Multiline-String
Show Value
"""
    Target processing level. Setting this argument will overwrite any processing
    levels defined in the input data or processor definition.
     Valid processing levels are: []"""
class pysiral.scripts.parser_items.DataRecord

Bases: ArgparseArgumentsArgs

name_or_flags: ClassVar[list[str]] = ['-D', '--data-record']
dest: str = 'data_record'
metavar: str = '<data record>'
choices: List[Any]
type: Callable
help: str = Multiline-String
Show Value
"""
    Target data record. Setting this argument will overwrite any value
    defined in the input data or processor definition.
     Valid data records are: []"""
class pysiral.scripts.parser_items.ExcludeMonths

Bases: ArgparseArgumentsArgs

name_or_flags: ClassVar[list[str]] = ['-E', '--exclude-months']
nargs: str = '+'
type: Callable
dest: str = 'exclude_months'
metavar: str = '<month number>'
help: str = 'List of months to be excluded from processing, given as integers (1-12).'
class pysiral.scripts.parser_items.InputVersion

Bases: ArgparseArgumentsArgs

name_or_flags: ClassVar[list[str]] = ['-v', '--input-version']
action: str = 'store'
dest: str = 'input_version'
default: Any = 'default'
metavar: str = 'v{minor}p{major}|default'
type: Callable
help: str = Multiline-String
Show Value
"""
    Input version name (e.g., v1p0, v2p1, or 'default').
    This is used to identify the version of the input data.
    """
class pysiral.scripts.parser_items.SourceDatasetID

Bases: ArgparseArgumentsArgs

name_or_flags: ClassVar[list[str]] = ['-s', '--source-dataset-id']
action: str = 'store'
dest: str = 'source_dataset_id'
metavar: str = '<source_dataset_id>'
type: Callable
help: str = Multiline-String
Show Value
"""
    Identifier of the source dataset to be used for processing, summarizing the platform, version,
    and timeliness information. The source dataset ID must be specified in the local machine definition file
    ({pysiral-cfg-location}/local_machine_def.yaml, e.g. `root.l1b_repository.<platform>.<source_dataset_id>`)
    """
class pysiral.scripts.parser_items.L1PFile

Bases: ArgparseArgumentsArgs

name_or_flags: ClassVar[list[str]] = ['l1p_file']
type: Callable
help: str = Multiline-String
Show Value
"""
    Path to Level-1 Pre-Processed (l1p) input file for the Level-2 processor.
    """
class pysiral.scripts.parser_items.L1PSettings

Bases: ArgparseArgumentsArgs

name_or_flags: ClassVar[list[str]] = ['l1p_settings']
type: Callable
action: Callable
metavar: str = '<id|filepath>'
help: str = Multiline-String
Show Value
"""
    Identifier or file path to the Level-1 Pre-Processor definition file.
    This file contains the settings for the Level-1 processor. The default location
    for these files is `{pysiral-cfg-location}/proc/l1/`. The identifier is the filename without
    the `.yaml` extension. E.g.`cryosat2_pds_ipf1e_v1p2` will be resolved to
    `{pysiral-cfg-location}/proc/l1/cryosat2_pds_ipf1e_v1p2.yaml`.
    """
class pysiral.scripts.parser_items.L2Settings

Bases: ArgparseArgumentsArgs

name_or_flags: ClassVar[list[str]] = ['l2_settings']
type: Callable
action: Callable
metavar: str = '<l2 settings id|filepath>'
help: str = Multiline-String
Show Value
"""
    Identifier or file path to the Level-2 Processor definition file.
    This file contains the settings for the Level-2 processor. The default location
    for these files is `{pysiral-cfg-location}/proc/l2/`. The identifier is the filename without
    the `.yaml` extension. E.g.`awi_cryosat2_nh_v2p6_rep` will be resolved to
    `{pysiral-cfg-location}/proc/l2/awi/v2p6/awi_cryosat2_nh_v2p6_rep.yaml`.
    """
class pysiral.scripts.parser_items.L3Settings

Bases: ArgparseArgumentsArgs

name_or_flags: ClassVar[list[str]] = ['l3_settings']
action: Callable
type: Callable
metavar: str = '<l3 settings id|filepath>'
help: str = Multiline-String
Show Value
"""
    Identifier or file path to the Level-3 Processor definition file.
    This file contains the settings for the Level-2 processor. The default location
    for these files is `{pysiral-cfg-location}/proc/l3/`. The identifier is the filename without
    the `.yaml` extension. E.g.`l3c_cci_v4p0` will be resolved to
    `{pysiral-cfg-location}/proc/l3/cci/l3c_cci_v4p0.yaml`.
    """
class pysiral.scripts.parser_items.L2Outputs

Bases: ArgparseArgumentsArgs

name_or_flags: ClassVar[list[str]] = ['-o', '--l2-output']
nargs: str = '+'
dest: str = 'l2_outputs'
action: Callable
metavar: str = '<l2 output id|filepath>'
help: str = Multiline-String
Show Value
"""
    Identifier or file path of one ore several Level-2 output definition files.
    Each file contains the output definition for the l2/l2i dataformat. The default location
    for these files is `{pysiral-cfg-location}/output/l2/`. The identifier is the filename without
    the `.yaml` extension. E.g.`l2i_cci_v4p0` will be resolved to
    `{pysiral-cfg-location}/output/l2i/cci/l2i_cci_v4p0.yaml`.
    """
class pysiral.scripts.parser_items.L2POutputs

Bases: ArgparseArgumentsArgs

name_or_flags: ClassVar[list[str]] = ['-o', '--l2p-output']
action: Callable
metavar: str = '<l2p output id|filepath>'
help: str = Multiline-String
Show Value
"""
    Identifier or file path of one Level-2 output definition file.
    Each file contains the output definition for the l2/l2i dataformat. The default location
    for these files is `{pysiral-cfg-location}/output/l2/`. The identifier is the filename without
    the `.yaml` extension. E.g.`l2i_cci_v4p0` will be resolved to
    `{pysiral-cfg-location}/output/l2i/cci/l2i_cci_v4p0.yaml`.
    """
class pysiral.scripts.parser_items.L3Outputs

Bases: ArgparseArgumentsArgs

name_or_flags: ClassVar[list[str]] = ['-o', '--l3-output']
nargs: str = '+'
type: Callable
action: Callable
metavar: str = '<l3 output id|filepath>'
help: str = Multiline-String
Show Value
"""
    Identifier or file path of one or several Level-3 output definition files.
    Each file contains the output definition for the l3 dataformat. The default location
    for these files is `{pysiral-cfg-location}/output/l3/`. The identifier is the filename without
    the `.yaml` extension. E.g.`l3c_cci_v4p0` will be resolved to
    `{pysiral-cfg-location}/output/l3/cci/l3c_cci_v4p0.yaml`.
    """
class pysiral.scripts.parser_items.MultiProcesssingNumCores

Bases: ArgparseArgumentsArgs

name_or_flags: ClassVar[list[str]] = ['-m', '--multiprocessing-num-cores']
dest: str = 'multiprocessing_num_cores'
type: Callable
metavar: str = '<num_cores>'
default: Any = None
help: str = Multiline-String
Show Value
"""
    Set the number of CPU cores to be used for multiprocessing. If not set, the
    default value (derived from `multiprocessing.cpu_count()`) will be used.
    NOTE: In some managed environments, the default value is not reliable, which
    may lead to performance issues. In this case, it is recommended to set this
    value manually to the known number of available CPU cores.
    """
class pysiral.scripts.parser_items.UseMultiProcesssing

Bases: ArgparseArgumentsArgs

name_or_flags: ClassVar[list[str]] = ['--multiprocessing']
dest: str = 'use_multiprocessing'
action: Any
default: Any = True
help: str = Multiline-String
Show Value
"""
    Flag to allow disabling multiprocessing. If set, the processor will run in single-threaded mode.
    Default is True, meaning multiprocessing is enabled.
    (also see option -m/--multiprocessing-num-cores)
    """
class pysiral.scripts.parser_items.ForceL2DefRecordType

Bases: ArgparseArgumentsArgs

name_or_flags: ClassVar[list[str]] = ['--force-l2def-record-type']
dest: str = 'force_l2def_record_type'
default: Any = False
help: str = Multiline-String
Show Value
"""
    By default, the Level-2 processor will use the record_type defined in the l1p input files.
    If this flag is set, the processor will use the record_type defined in the Level-2 definition file
    (l2def) instead. This is useful if the l1p input files are not consistent with the l2def record_type,
    e.g. in case of metadata errors or if data from another timeliness is to be used for filling gaps.
    This flag should only be set in special cases.
    """
class pysiral.scripts.parser_items.L1PFiles

Bases: ArgparseArgumentsArgs

name_or_flags: ClassVar[list[str]] = ['l1p_files']
nargs: str = '+'
type: Callable
metavar: str = '<l1p filepath>'
help: str = Multiline-String
Show Value
"""
    Target Level-1P (l1p) file(s) to be processed by the Level-2 processor.
    """
class pysiral.scripts.parser_items.L2iDirectory

Bases: ArgparseArgumentsArgs

name_or_flags: ClassVar[list[str]] = ['-i', '--l2i-product-dir', '--l2-product-dir']
nargs: str | None = '+'
dest: str = 'l2_product_directory'
type: Callable
metavar: str = '<l2 directory>'
help: str = Multiline-String
Show Value
"""
    Target Level-2i (l2i) product directory where the Level-2 output files will be written.
    The l2i files need to be organized in `yyyy/mm/` subdirectory structure.
    """
class pysiral.scripts.parser_items.L3Directory

Bases: ArgparseArgumentsArgs

name_or_flags: ClassVar[list[str]] = ['-O', '--l3-product-directory']
dest: str = 'l3_product_directory'
type: Callable
metavar: str = '<l3 directory>'
help: str = Multiline-String
Show Value
"""
    Target Level-3 product directory where the Level-3 output files will be written.
    The last sub-directory must be a valid Level-3 processing level code [l3c|l3s].
    If not given, the directory will be inferred from the l2 input directory.
    """
class pysiral.scripts.parser_items.L3Grid

Bases: ArgparseArgumentsArgs

name_or_flags: ClassVar[list[str]] = ['l3_grid_id']
type: Callable
metavar: str = '<grid id>'
help: str = Multiline-String
Show Value
"""
    The grid definition id for the Level-3 processor.
     Valid grid ids are: []"""
class pysiral.scripts.parser_items.DOI

Bases: ArgparseArgumentsArgs

name_or_flags: ClassVar[list[str]] = ['--doi']
type: Callable
metavar: str = '<product doi>'
help: str = Multiline-String
Show Value
"""
    The DOI (Digital Object Identifier) to be written in the global attributes of the product files.
    """
class pysiral.scripts.parser_items.DefaultCommandLineArguments

Bases: object

_args
get_argparse_dict(name, destination, required)