def METHOD_NAME():
    doc="""
    LPGTA data processing routine.
    You may need to set these environment variables, check your LPGTA.json file.
      * $LPGTA_DATA : base data directory
      * $LEGEND_META : the legend-metadata repository
    By default, we move output files into place in the LH5 directory tree, but
    there is also an option to leave it in place in CWD.
    TODO: parallelize, submit processing jobs
    """
    rthf = argparse.RawTextHelpFormatter
    par = argparse.ArgumentParser(description=doc, formatter_class=rthf)
    arg, st, sf = par.add_argument, 'store_true', 'store_false'
    # declare datagroup
    arg('--dg', action=st, help='load datagroup')
    arg('--q', type=str, help='datagroup query (AND-ed with the date query)')
    arg('--date', type=str, help='date query (AND-ed with the datagroup query)')
    # routines
    arg('--d2r', action=st, help='run daq_to_raw')
    arg('--r2d', action=st, help='run raw_to_dsp')
    # options
    arg('-o', '--over', action=st, help='overwrite existing files')
    arg('-n', '--nwfs', type=int, help='limit num. waveforms')
    arg('-v', '--verbose', action=st, help='verbose mode')
    arg('-l', '--bl', type=int, default=3200, help='buffer length for chunked reads for DSP')
    arg('-w', '--bw', type=int, default=8, help='buffer width for DSP')
    arg('-c', '--cwd', action=st, help="save output to current directory")
    args = par.parse_args()
    # print out the arguments for log files
    if args.verbose:
        print('Arguments:', args)
    # -- set options --
    nwfs = args.nwfs if args.nwfs is not None else np.inf
    print('Processing settings:'
          '\n$LPGTA_DATA =', os.environ.get('LPGTA_DATA'),
          '\n$LEGEND_META =', os.environ.get('LEGEND_META'),
          f'\n  overwrite? {args.over}'
          f'\n  limit wfs? {nwfs}')
    # -- run routines --
    query = "YYYYmmdd == '" + args.date + "'" if args.date else args.q
    if args.date and args.q:
        query += ' and ' + args.q
    if args.dg or args.d2r or args.r2d: dg = load_datagroup(query)
    if args.d2r: d2r(dg, args.over, nwfs, args.verbose, args.cwd)
    if args.r2d: r2d(dg, args.over, nwfs, args.verbose, args.cwd, args.bl, args.bw)