cedadev / padocc

Other
0 stars 0 forks source link

TypeError init_config - Initialising water vapour example #33

Open efisher008 opened 2 months ago

efisher008 commented 2 months ago

I got the following error when initialising CCI water vapour files from a CSV using the (adapted) example command:

python group_run.py init ellie-test-wv -fi extensions/example_water_vapour/water_vapour.csv -v

INFO [main-group]: Starting group execution for ellie-test-wv
INFO [main-group]: Running init steps as a serial process for ellie-test-wv
Traceback (most recent call last):
  File "/gws/nopw/j04/cedaproc/padocc/group_run.py", line 245, in <module>
    main(args)
  File "/gws/nopw/j04/cedaproc/padocc/group_run.py", line 175, in main
    init_config(args)
TypeError: init_config() missing 1 required positional argument: 'logger'

I can see that the init_config() function is imported from init.py, where it is defined:

def init_config(args, logger, fh=None, logid=None, **kwargs):
    """
    Main configuration script, load configurations from input sources, determine
    input file type and use appropriate functions to instantiate group and project
    directories.

    :param args:        (obj) Set of command line arguments supplied by argparse.

    :param logger:      (obj) Logging object for info/debug/error messages. Will create a new
                        logger object if not given one.

    :param fh:          (str) Path to file for logger I/O when defining new logger.

    :param logid:       (str) If creating a new logger, will need an id to distinguish this logger
                        from other single processes (typically n of N total processes.)

    :returns:   None
    """
    if not logger:
        logger = init_logger(args.verbose, args.mode, 'init',fh=fh, logid=logid)
    logger.info('Starting initialisation')

And so on.

It sounds as though the init_config() function does not seem to require a logger to be specified, but does the group_run.py implementation fail if it isn't given one?

efisher008 commented 2 months ago

UPDATE:

This was solved by adding logger as an argument to init_config(), like so: init_config(args, logger)