pysiral.scripts

Main entry point for pysiral console scripts.

Submodules

Attributes

__author__

Classes

InfoScriptArguments

ConfigScriptArguments

L1PreProcScriptArguments

L2ProcScriptArguments

L2ProcFilesScriptArguments

L2PreProcScriptArguments

L3ProcScriptArguments

Functions

info(→ None)

Main entry point for the info script.

config(→ None)

Main entry point for the config script. Can either initialize the pysiral configuration

l1preproc(→ None)

Workflow script of the pysiral l1b preprocessor.

l2proc(→ None)

Main entry point for the Level-2 Processor job.

l2procfiles([l1p_files, l2_settings, l2_outputs, ...])

A more simple Level-2 job with a predefined list of l1b data files

l2preproc(→ None)

Caller for converting Level-2 Intermediate (l2i) into

l3proc(→ None)

main(→ None)

info_cli(→ None)

Command-line interface entry point for the pysiral info script.

config_cli(→ None)

Command-line interface entry point for the pysiral info script.

l1preproc_cli(→ None)

Command-line interface entry point for the pysiral l1preproc script.

l2proc_cli(→ None)

Command-line interface entry point for the pysiral l2proc script.

l2preproc_cli(→ None)

Command-line interface entry point for the pysiral l2preproc script.

l3proc_cli(→ None)

Command-line interface entry point for the pysiral l3proc script.

Package Contents

pysiral.scripts.__author__ = 'Stefan Hendricks <stefan.hendricks@awi.de>'
pysiral.scripts.info(target: str = None, search_string: str = None) None

Main entry point for the info script.

This function provides information about the specified target.

Parameters:
  • target – The target to get information about.

  • search_string – Optional search string to filter information.

class pysiral.scripts.InfoScriptArguments

Bases: object

parser
get(args_list: List[str] = None) argparse.Namespace
static get_argument_parser() argparse.ArgumentParser

Set up the command line argument parser for the Level-2 Processor.

Returns:

The argument parser object.

pysiral.scripts.config(action: ConfigActions = ConfigActions.INIT, target_or_directory: pathlib.Path | str | None = None, yes: bool = False) None

Main entry point for the config script. Can either initialize the pysiral configuration in the default configuration directory or set/update the configuration to a specific directory.

Parameters:
  • action

  • target_or_directory

  • yes

Returns:

None

class pysiral.scripts.ConfigScriptArguments

Bases: object

parser
get(args_list: List[str] = None) argparse.Namespace
static get_argument_parser() argparse.ArgumentParser

Set up the command line argument parser for the Level-2 Processor.

Returns:

The argument parser object.

pysiral.scripts.l1preproc(l1p_settings: str | pathlib.Path = None, processing_period: dateperiods.DatePeriod = None, exclude_months: List[int] | None = None, hemisphere: str = 'global', platform: str = None, output_handler_cfg: dict = None, source_dataset_id: str = None, use_multiprocessing: bool = False, multiprocessing_num_cores: int | None = None) None

Workflow script of the pysiral l1b preprocessor.

Parameters:
  • l1p_settings – Level-1 preprocessor settings file or ID.

  • processing_period – The processing period to run the preprocessor for.

  • exclude_months – List of months to exclude from processing (optional).

  • hemisphere – Hemisphere to process data for, default is “global”.

  • platform – Platform identifier (optional).

  • output_handler_cfg – Configuration for the output handler (optional).

  • source_dataset_id – Identifier for the source repository (optional).

Returns:

None

class pysiral.scripts.L1PreProcScriptArguments

Bases: object

parser
get(args_list: List[str] = None) argparse.Namespace
static get_argument_parser() argparse.ArgumentParser

Set up the command line argument parser for the Level-1 Pre-Processor.

Returns:

The argument parser object.

pysiral.scripts.l2proc(processing_period: dateperiods.DatePeriod = None, l2_settings: str | pathlib.Path = None, l2_outputs: List[str | pathlib.Path] = None, exclude_months: List[int] = None, source_dataset_id: str = None, l1p_version: str = None, force_l2def_record_type: bool = False, use_multiprocessing: bool = False, multiprocessing_num_cores: int = None) None

Main entry point for the Level-2 Processor job.

This function initializes the Level-2 processor with the provided settings and processes the Level-1P data files for the specified time range.

Parameters:
  • processing_period – Start date for processing in [year, month, [day]] format.

  • l2_settings – Path to the Level-2 settings file or its identifier.

  • l2_outputs – List of output definitions for Level-2 products.

  • exclude_months – List of months to exclude from processing (1-12).

  • source_dataset_id – Version of the input data (optional).

  • l1p_version – Version of the Level-1P data (optional).

  • force_l2def_record_type – If True, forces the use of a specificLevel-2 definition record type.

  • use_multiprocessing – If True, enables multiprocessing for the processor.

  • multiprocessing_num_cores – Number of CPU cores to use for multiprocessing (optional).

class pysiral.scripts.L2ProcScriptArguments

Bases: object

parser
get(args_list: List[str] = None) argparse.Namespace
static get_argument_parser() argparse.ArgumentParser

Set up the command line argument parser for the Level-2 Processor.

Returns:

The argument parser object.

pysiral.scripts.l2procfiles(l1p_files: list[pathlib.Path] = None, l2_settings: pathlib.Path | str = None, l2_outputs: list[pathlib.Path] = None, mp_cpu_count: int = None, force_l2def_record_type: bool = False, **_: dict)

A more simple Level-2 job with a predefined list of l1b data files

Parameters:
  • l1p_files – A list of Level-1P files to process.

  • l2_settings – Path to the Level-2 settings file or its identifier.

  • l2_outputs – List of output definitions for Level-2 products.

  • mp_cpu_count – Number of CPUs to use for multiprocessing (optional).

  • force_l2def_record_type – If True, forces the use of a specificLevel-2 definition record type.

  • _

Returns:

class pysiral.scripts.L2ProcFilesScriptArguments

Bases: object

parser
get(args_list: List[str] = None) argparse.Namespace
static get_argument_parser() argparse.ArgumentParser

Set up the command line argument parser for the Level-2 Processor.

Returns:

The argument parser object.

pysiral.scripts.l2preproc(processing_period: dateperiods.DatePeriod = None, l2i_product_dir: str | pathlib.Path = None, l2p_outputs: List[str | pathlib.Path] = None, doi: str = None, exclude_month: List[int] = None) None

Caller for converting Level-2 Intermediate (l2i) into Level-2 Pre-Processed (l2p) data products. NOTE: At the moment that only means summary of valid freeboard/thickness

data points into daily summary files.

class pysiral.scripts.L2PreProcScriptArguments

Bases: object

parser
get(args_list: List[str] = None) argparse.Namespace
static get_argument_parser() argparse.ArgumentParser

Set up the command line argument parser for the Level-2 Processor.

Returns:

The argument parser object.

pysiral.scripts.l3proc(processing_period: dateperiods.DatePeriod = None, l2_product_directory: List[pathlib.Path] = None, l3_product_directory: str | pathlib.Path = None, l3_settings: str | pathlib.Path = None, l3_grid_id: str = None, l3_output: List[str | pathlib.Path] = None, duration: pysiral.core.flags.DurationType = DurationType.P1M, doi: str = None, processing_level: pysiral.core.flags.ProductProcessingLevels = ProductProcessingLevels.LEVEL3_COLLATED, data_record: pysiral.core.flags.DataRecordType = None, exclude_months: List[int] = None) None
Parameters:
  • processing_period

  • l2_product_directory

  • l3_product_directory

  • l3_settings

  • l3_grid_id

  • l3_output

  • duration

  • doi

  • processing_level

  • data_record

  • exclude_months – List of months to exclude from processing (1-12). If None, no months are excluded. If provided, the months will be filtered out from the processing period.

Returns:

class pysiral.scripts.L3ProcScriptArguments

Bases: object

parser
get(args_list: List[str] = None) argparse.Namespace
static autocomplete_product_processing_level(l2_product_directory: List[pathlib.Path]) str

Autocomplete the product processing level based on the provided arguments.

Parameters:

l2_product_directory – The L2 product directory path or multiple thereof.

Returns:

product processing level as a string.

static autocomplete_l3_product_directory(l3_product_directory: str | pathlib.Path | None, l2_product_directory: str | pathlib.Path | List[pathlib.Path], processing_level: str) pathlib.Path

Autocomplete the L3 product directory based on the provided arguments.

Parameters:
  • l3_product_directory – The L3 product directory path or None if not provided.

  • l2_product_directory – The L2 product directory path or multiple thereof.

  • processing_level – The target processing level.

Returns:

Updated Level-3 product directory path.

static autocomplete_l3_product_duration(duration: str | None, processing_period: dateperiods.DatePeriod) str

Autocomplete the L3 product directory based on the provided arguments.

Parameters:
  • duration

  • processing_period

Returns:

Updated arguments namespace with the L3 product directory set (if required)

static get_argument_parser() argparse.ArgumentParser

Set up the command line argument parser for the Level-2 Processor.

Returns:

The argument parser object.

pysiral.scripts.main() None
pysiral.scripts.info_cli(args_list: List = None) None

Command-line interface entry point for the pysiral info script.

Parameters:

args_list – Command line arguments to be passed to the script.

Returns:

None

pysiral.scripts.config_cli(args_list: List = None) None

Command-line interface entry point for the pysiral info script.

Parameters:

args_list – Command line arguments to be passed to the script.

Returns:

None

pysiral.scripts.l1preproc_cli(args_list: List = None) None

Command-line interface entry point for the pysiral l1preproc script.

Parameters:

args_list – Command line arguments to be passed to the script.

Returns:

None

pysiral.scripts.l2proc_cli(args_list: List = None) None

Command-line interface entry point for the pysiral l2proc script.

Parameters:

args_list – Command line arguments to be passed to the script.

Returns:

None

pysiral.scripts.l2preproc_cli(args_list: List = None) None

Command-line interface entry point for the pysiral l2preproc script.

Parameters:

args_list – Command line arguments to be passed to the script.

Returns:

None

pysiral.scripts.l3proc_cli(args_list: List = None) None

Command-line interface entry point for the pysiral l3proc script.

Parameters:

args_list – Command line arguments to be passed to the script.

Returns:

None