diff --git a/src/eva/data/cubed_sphere_restart.py b/src/eva/data/cubed_sphere_restart.py index 3d2b3535..d40bff3d 100644 --- a/src/eva/data/cubed_sphere_restart.py +++ b/src/eva/data/cubed_sphere_restart.py @@ -28,7 +28,7 @@ def read_fms_tiles(files, variable, logger): Args: files (list): List of netCDF file paths. variable (str): Name of the variable to extract. - logger: Logger object for logging messages. + logger (Logger): Logger object for logging messages. Returns: np.ndarray: Combined variable array from input files. @@ -77,7 +77,7 @@ def execute(self, dataset_config, data_collections, timing): Args: dataset_config (dict): Configuration dictionary for the dataset. - data_collections: Object for managing data collections. + data_collections (DataCollections): Object for managing data collections. timing: Timing object for tracking execution time. """ diff --git a/src/eva/data/gsi_obs_space.py b/src/eva/data/gsi_obs_space.py index d0326dde..bebb930a 100644 --- a/src/eva/data/gsi_obs_space.py +++ b/src/eva/data/gsi_obs_space.py @@ -80,7 +80,7 @@ def subset_channels(ds, channels, logger, add_channels_variable=False): Args: ds (Dataset): The xarray Dataset to subset. channels (list): List of channel numbers to keep. - logger: Logger instance for logging messages. + logger (Logger): Logger instance for logging messages. add_channels_variable (bool, optional): Whether to add 'channelNumber' variable. Default is False. """ diff --git a/src/eva/data/ioda_obs_space.py b/src/eva/data/ioda_obs_space.py index c10e268c..cca423a7 100644 --- a/src/eva/data/ioda_obs_space.py +++ b/src/eva/data/ioda_obs_space.py @@ -44,8 +44,10 @@ def subset_channels(ds, channels): the dataset, the function will perform the subset operation. Example: - # Subset the dataset 'data' to include only channels 1, 5 and 10: - subset_ds = subset_channels(data, [1, 5, 10]) + :: + + # Subset the dataset 'data' to include only channels 1, 5 and 10: + subset_ds = subset_channels(data, [1, 5, 10]) """ if 'Channel' in list(ds.dims): @@ -97,14 +99,16 @@ class IodaObsSpace(EvaDatasetBase): - (Additional notes, if applicable) Example: - # Instantiate the class - ioda_instance = IodaObsSpace() + :: + + # Instantiate the class + ioda_instance = IodaObsSpace() - # Execute data collection processing using IODA observation space - ioda_instance.execute(dataset_config, data_collections, timing) + # Execute data collection processing using IODA observation space + ioda_instance.execute(dataset_config, data_collections, timing) - # Generate a default configuration dictionary for IODA observation space - default_config = ioda_instance.generate_default_config(filenames, collection_name) + # Generate a default configuration dictionary for IODA observation space + default_config = ioda_instance.generate_default_config(filenames, collection_name) """ def execute(self, dataset_config, data_collections, timing): @@ -127,11 +131,13 @@ def execute(self, dataset_config, data_collections, timing): - This method operates on instance-specific attributes. Example: - # Instantiate the class - ioda_instance = IodaObsSpace() + :: - # Execute data collection processing using IODA observation space - ioda_instance.execute(dataset_config, data_collections, timing) + # Instantiate the class + ioda_instance = IodaObsSpace() + + # Execute data collection processing using IODA observation space + ioda_instance.execute(dataset_config, data_collections, timing) """ # Get channels for radiances @@ -293,11 +299,14 @@ def generate_default_config(self, filenames, collection_name): - This method operates on instance-specific attributes. Example: - # Instantiate the class - ioda_instance = IodaObsSpace() + :: + + # Instantiate the class + ioda_instance = IodaObsSpace() - # Generate a default configuration dictionary for IODA observation space - default_config = ioda_instance.generate_default_config(filenames, collection_name) + # Generate a default configuration dictionary for IODA observation space + default_config = ioda_instance.generate_default_config(filenames, + collection_name) """ eva_dict = {'filenames': filenames, diff --git a/src/eva/data/jedi_log.py b/src/eva/data/jedi_log.py index d32bf75c..4f9d3dbc 100644 --- a/src/eva/data/jedi_log.py +++ b/src/eva/data/jedi_log.py @@ -63,8 +63,8 @@ def execute(self, dataset_config, data_collections, timing): Args: dataset_config (dict): Configuration dictionary for the dataset. - data_collections: Object for managing data collections. - timing: Timing object for tracking execution time. + data_collections (DataCollections): Object for managing data collections. + timing (Timing): Timing object for tracking execution time. """ # Get name of the log file to parse diff --git a/src/eva/data/lat_lon.py b/src/eva/data/lat_lon.py index ed78d3dd..feb295a0 100644 --- a/src/eva/data/lat_lon.py +++ b/src/eva/data/lat_lon.py @@ -19,8 +19,8 @@ def execute(self, dataset_config, data_collections, timing): Args: dataset_config (dict): Configuration dictionary for the dataset. - data_collections: Object for managing data collections. - timing: Timing object for tracking execution time. + data_collections (DataCollections): Object for managing data collections. + timing (Timing): Timing object for tracking execution time. """ # Filename to be read into this collection diff --git a/src/eva/data/mon_data_space.py b/src/eva/data/mon_data_space.py index 2588161a..715d16a2 100644 --- a/src/eva/data/mon_data_space.py +++ b/src/eva/data/mon_data_space.py @@ -37,8 +37,8 @@ def execute(self, dataset_config, data_collections, timing): Args: dataset_config (dict): Configuration dictionary for the dataset. - data_collections: Object for managing data collections. - timing: Timing object for tracking execution time. + data_collections (DataCollections): Object for managing data collections. + timing (Timing): Timing object for tracking execution time. """ # Set the collection name diff --git a/src/eva/data/soca_restart.py b/src/eva/data/soca_restart.py index 0adeff8b..17d73205 100644 --- a/src/eva/data/soca_restart.py +++ b/src/eva/data/soca_restart.py @@ -144,7 +144,7 @@ def read_soca(file, variable, logger): Args: file (str): Path to the SOCA data file. variable (str): Name of the variable to read. - logger: Logger for logging messages. + logger (Logger): Logger for logging messages. Returns: tuple: A tuple containing dimensions (list) and data (numpy.ndarray) for the specified diff --git a/src/eva/plotting/emcpy/plot_tools/figure_driver.py b/src/eva/plotting/emcpy/plot_tools/figure_driver.py index 5168c1d6..46e923b1 100644 --- a/src/eva/plotting/emcpy/plot_tools/figure_driver.py +++ b/src/eva/plotting/emcpy/plot_tools/figure_driver.py @@ -30,7 +30,7 @@ def figure_driver(config, data_collections, timing, logger): config (dict): A dictionary containing the configuration for generating figures. data_collections (DataCollections): An instance of the DataCollections class containing input data. - timing: A timing instance to measure the execution time. + timing (Timing): A timing instance to measure the execution time. logger (Logger): An instance of the logger for logging messages. This function generates and saves multiple figures based on the provided configuration. It diff --git a/src/eva/transforms/accept_where.py b/src/eva/transforms/accept_where.py index a5d8f1e6..d6b68eb9 100644 --- a/src/eva/transforms/accept_where.py +++ b/src/eva/transforms/accept_where.py @@ -26,7 +26,7 @@ def accept_where(config, data_collections): Args: config (dict): A configuration dictionary containing transformation parameters. data_collections (DataCollections): An instance of the DataCollections class containing - input data. + input data. Returns: None @@ -40,15 +40,17 @@ def accept_where(config, data_collections): The resulting filtered variables are added to the data collections. Example: - config = { - 'collections': [...], - 'groups': [...], - 'variables': [...], - 'new name': 'filtered_variable', - 'starting field': 'original_variable', - 'where': ['${collection}::${group}::${variable} >= 0.0'] - } - accept_where(config, data_collections) + :: + + config = { + 'collections': [...], + 'groups': [...], + 'variables': [...], + 'new name': 'filtered_variable', + 'starting field': 'original_variable', + 'where': ['${collection}::${group}::${variable} >= 0.0'] + } + accept_where(config, data_collections) """ # Create a logger @@ -126,13 +128,14 @@ def generate_accept_where_config(new_name, starting_field, where, collection, va 'for' dictionary to apply the transformation to the specified variables. Example: - new_name = 'filtered_variable' - starting_field = 'original_variable' - where = ['group1 >= 0', 'group2 < 10'] - collection = 'my_collection' - var_list = ['variable1', 'variable2'] - config = generate_accept_where_config(new_name, starting_field, where, collection, - var_list) + :: + new_name = 'filtered_variable' + starting_field = 'original_variable' + where = ['group1 >= 0', 'group2 < 10'] + collection = 'my_collection' + var_list = ['variable1', 'variable2'] + config = generate_accept_where_config(new_name, starting_field, where, + collection, var_list) """ # Update new_name diff --git a/src/eva/transforms/arithmetic.py b/src/eva/transforms/arithmetic.py index 72dae6e3..48e7a41d 100644 --- a/src/eva/transforms/arithmetic.py +++ b/src/eva/transforms/arithmetic.py @@ -40,7 +40,9 @@ def isfloat(a_string): floating-point number. Example: - result = isfloat("3.14") + :: + + result = isfloat("3.14") """ try: @@ -60,7 +62,7 @@ def arithmetic(config, data_collections): Args: config (dict): A configuration dictionary containing transformation parameters. data_collections (DataCollections): An instance of the DataCollections class containing - input data. + input data. Returns: None @@ -71,14 +73,17 @@ def arithmetic(config, data_collections): resulting variables are added to the data collections. Example: - config = { - 'collections': [...], - 'groups': [...], - 'variables': [...], - 'new name': 'result_variable', - 'equals': '(${collection}::${group}::${var1} + ${collection}::${group}::${var2}) / 2' - } - arithmetic(config, data_collections) + :: + + config = { + 'collections': [...], + 'groups': [...], + 'variables': [...], + 'new name': 'result_variable', + 'equals': '(${collection}::${group}::${var1} + ${collection}::${group}::${var2}) + / 2' + } + arithmetic(config, data_collections) """ # Create a logger @@ -154,11 +159,13 @@ def generate_arithmetic_config(new_name, expression, collection, var_list): the transformation to the specified variables. Example: - new_name = 'result_variable' - expression = '(${group1} + ${group2}) / 2' - collection = 'my_collection' - var_list = ['variable1', 'variable2'] - config = generate_arithmetic_config(new_name, expression, collection, var_list) + :: + + new_name = 'result_variable' + expression = '(${group1} + ${group2}) / 2' + collection = 'my_collection' + var_list = ['variable1', 'variable2'] + config = generate_arithmetic_config(new_name, expression, collection, var_list) """ # Update new_name diff --git a/src/eva/transforms/channel_stats.py b/src/eva/transforms/channel_stats.py index 231d997d..bb177425 100644 --- a/src/eva/transforms/channel_stats.py +++ b/src/eva/transforms/channel_stats.py @@ -43,15 +43,17 @@ def channel_stats(config, data_collections): configuration. The resulting variables are added to the data collections. Example: - config = { - 'collections': [...], - 'groups': [...], - 'variables': [...], - 'variable_name': 'data_variable', - 'statistic list': ['Mean', 'Std', 'Count'], - 'statistic_dimension': 'Location' - } - channel_stats(config, data_collections) + :: + + config = { + 'collections': [...], + 'groups': [...], + 'variables': [...], + 'variable_name': 'data_variable', + 'statistic list': ['Mean', 'Std', 'Count'], + 'statistic_dimension': 'Location' + } + channel_stats(config, data_collections) """ # Create a logger diff --git a/src/eva/transforms/select_time.py b/src/eva/transforms/select_time.py index 0a2b14de..15522475 100644 --- a/src/eva/transforms/select_time.py +++ b/src/eva/transforms/select_time.py @@ -32,7 +32,7 @@ def select_time(config, data_collections): Args: config (dict): A configuration dictionary containing transformation parameters. data_collections (DataCollections): An instance of the DataCollections class containing - input data. + input data. Returns: None @@ -44,18 +44,20 @@ def select_time(config, data_collections): for a single time point. The resulting processed variables are added to the data collections. Example: - config = { - 'collections': [...], - 'groups': [...], - 'variables': [...], - 'new name': 'time_selected_variable', - 'starting field': 'original_variable', - 'cycle': 'YYYYMMDDHH', - # OR - 'start cycle': 'YYYYMMDDHH', - 'end cycle': 'YYYYMMDDHH' - } - select_time(config, data_collections) + :: + + config = { + 'collections': [...], + 'groups': [...], + 'variables': [...], + 'new name': 'time_selected_variable', + 'starting field': 'original_variable', + 'cycle': 'YYYYMMDDHH', + # OR + 'start cycle': 'YYYYMMDDHH', + 'end cycle': 'YYYYMMDDHH' + } + select_time(config, data_collections) """ # Create a logger diff --git a/src/eva/transforms/transform_driver.py b/src/eva/transforms/transform_driver.py index 4a17f1d4..85e89db9 100644 --- a/src/eva/transforms/transform_driver.py +++ b/src/eva/transforms/transform_driver.py @@ -24,7 +24,7 @@ def transform_driver(config, data_collections, timing, logger): Args: config (dict): A configuration dictionary containing transformation parameters. data_collections (DataCollections): An instance of the DataCollections class containing - input data. + input data. timing (Timing): An instance of the Timing class for tracking execution times. logger (Logger): An instance of the logger for logging messages. diff --git a/src/eva/transforms/transform_utils.py b/src/eva/transforms/transform_utils.py index 94b08b01..28c128a4 100644 --- a/src/eva/transforms/transform_utils.py +++ b/src/eva/transforms/transform_utils.py @@ -27,19 +27,21 @@ def parse_for_dict(config, logger): Returns: list: A list containing collection, group, and variable values extracted from the 'for' - dictionary. + dictionary. This function parses the 'for' dictionary provided in the configuration and extracts the collection, group, and variable values specified. It returns a list containing these extracted components. Example: - for_dict = { - 'collection': 'my_collection', - 'group': 'my_group', - 'variable': 'my_variable' - } - cgv = parse_for_dict(config, logger) + :: + + for_dict = { + 'collection': 'my_collection', + 'group': 'my_group', + 'variable': 'my_variable' + } + cgv = parse_for_dict(config, logger) """ # Get the for dict (might not be provided so default to empty dict) @@ -85,8 +87,10 @@ def replace_cgv(logger, collection, group, variable, *argv): placeholders. Example: - replaced_templates = replace_cgv(logger, 'my_collection', 'my_group', 'my_variable', - template1, template2) + :: + + replaced_templates = replace_cgv(logger, 'my_collection', 'my_group', + 'my_variable', template1, template2) """ # Create dictionary with templates @@ -139,7 +143,9 @@ def split_collectiongroupvariable(logger, collectiongroupvariable): group, variable). It returns a list containing these components. Example: - cgv = split_collectiongroupvariable(logger, 'my_collection::my_group::my_variable') + :: + + cgv = split_collectiongroupvariable(logger, 'my_collection::my_group::my_variable') """ # Split by double colon diff --git a/src/eva/utilities/config.py b/src/eva/utilities/config.py index 8c8e068b..39d10583 100644 --- a/src/eva/utilities/config.py +++ b/src/eva/utilities/config.py @@ -30,7 +30,7 @@ def __init__(self, dict_or_yaml, logger): Args: dict_or_yaml (dict or str): Either a dictionary containing configuration parameters or the path to a YAML file containing the configuration. - logger: An instance of the logger to handle log messages. + logger (Logger): An instance of the logger to handle log messages. Returns: None @@ -88,7 +88,7 @@ def get(dict, logger, key, default=None, abort_on_failure=True): Args: dict (dict): The dictionary from which the value needs to be retrieved. - logger: An instance of the logger to handle log messages. + logger (Logger): An instance of the logger to handle log messages. key (str): The key for which the value needs to be retrieved from the dictionary. default: The default value to return if the key is not found in the dictionary. abort_on_failure (bool): If True, aborts the program if the key is not found. diff --git a/src/eva/utilities/ioda_definitions.py b/src/eva/utilities/ioda_definitions.py index e2b1931c..3b1fbf0e 100644 --- a/src/eva/utilities/ioda_definitions.py +++ b/src/eva/utilities/ioda_definitions.py @@ -98,7 +98,7 @@ def ioda_platform_to_full_name(ioda_platform, logger): Args: ioda_platform (str): The IODA platform code. - logger: An instance of the logger to handle log messages. + logger (Logger): An instance of the logger to handle log messages. Returns: str: The corresponding full name of the IODA platform code. @@ -126,7 +126,7 @@ def ioda_group_dict(ioda_group, logger): Args: ioda_group (str): The IODA group name. - logger: An instance of the logger to handle log messages. + logger (Logger): An instance of the logger to handle log messages. Returns: str: The description of the IODA group. diff --git a/src/eva/utilities/stats.py b/src/eva/utilities/stats.py index b0e63d41..61159974 100644 --- a/src/eva/utilities/stats.py +++ b/src/eva/utilities/stats.py @@ -24,9 +24,9 @@ def get_field_data(logger, field, data_collections): Retrieve field data based on the field configuration. Args: - logger: The logger object for logging messages. + logger (Logger): The logger object for logging messages. field (dict): The field configuration containing the field name and optional channel. - data_collections: The data collections object to retrieve data from. + data_collections (DataCollections): The data collections object to retrieve data from. Returns: ndarray: The flattened and masked field data. @@ -69,9 +69,9 @@ def stats_helper(logger, plot_obj, data_collections, config): Add specified statistics to a plot. Args: - logger: The logging object. + logger (Logger): The logging object. plot_obj: The declarative plotting object. - data_collections: The eva data collections object. + data_collections (DataCollections): The eva data collections object. config (dict): The input configuration dictionary. Returns: diff --git a/src/eva/utilities/utils.py b/src/eva/utilities/utils.py index 7ba57a4a..99b68a85 100644 --- a/src/eva/utilities/utils.py +++ b/src/eva/utilities/utils.py @@ -437,7 +437,7 @@ def slice_var_from_str(config, datavar, logger): Parameters: config (dict): The configuration dictionary containing slicing information. datavar: The input variable to be sliced. - logger: The logger object for logging messages. + logger (Logger): The logger object for logging messages. Returns: The sliced variable 'datavar'.