Esempio n. 1
0
def main():
    """
    Just print a welcoming message and calls the production_line_multiproc.
    """
    # Start with a welcome message.
    print("#" * 79)
    print("")
    print(" " * 25 +
          crayons.red("Raw radar PPIs production line.\n", bold=True))
    print("\t- Input data directory path is: " + crayons.yellow(INFILE))
    print("\t- Output data directory path is: " + crayons.yellow(OUTPATH))
    print("\t- Radiosounding directory path is: " + crayons.yellow(SOUND_DIR))
    if USE_UNRAVEL:
        print("\t- " + crayons.yellow("UNRAVEL") +
              " will be used as dealiasing algorithm.")
    else:
        print("\t- " + crayons.yellow("REGION-BASED") +
              " will be used as dealiasing algorithm.")
    print("\n" + "#" * 79 + "\n")

    with warnings.catch_warnings():
        warnings.simplefilter('ignore')
        import cpol_processing
        cpol_processing.process_and_save(INFILE,
                                         OUTPATH,
                                         SOUND_DIR,
                                         use_unravel=USE_UNRAVEL)

    print(crayons.green("Process completed."))

    return None
Esempio n. 2
0
def main(inargs):
    """
    It calls the production line and manages it. Buffer function that is used
    to catch any problem with the processing line without screwing the whole
    multiprocessing stuff.

    Parameters:
    ===========
    infile: str
        Name of the input radar file.
    outpath: str
        Path for saving output data.
    """
    import warnings
    import traceback

    infile, outpath, sound_dir, use_unravel = inargs

    with warnings.catch_warnings():
        warnings.simplefilter('ignore')
        import cpol_processing

    try:
        cpol_processing.process_and_save(infile,
                                         outpath,
                                         sound_dir=sound_dir,
                                         use_unravel=use_unravel)
    except Exception:
        traceback.print_exc()
        return None

    return None
Esempio n. 3
0
def main(infile: str) -> None:
    """
    It calls the production line and manages it. Buffer function that is used
    to catch any problem with the processing line without screwing the whole
    multiprocessing stuff.

    Parameters:
    ===========
    infile: str
        Name of the input radar file.
    outpath: str
        Path for saving output data.
    """
    cpol_processing.process_and_save(infile,
                                     OUTPATH,
                                     sound_dir=SOUND_DIR,
                                     do_dealiasing=DO_DEALIASING)
    return None
Esempio n. 4
0
def main():
    """
    Just print a welcoming message and calls the production_line_multiproc.
    """
    # Start with a welcome message.
    print("#" * 79)
    print("")
    print(" " * 25 +
          crayons.red("Raw radar PPIs production line.\n", bold=True))
    print(" - Input data directory path is: " + crayons.yellow(INFILE))
    print(" - Output data directory path is: " + crayons.yellow(OUTPATH))
    print(" - Radiosounding directory path is: " + crayons.yellow(SOUND_DIR))
    print("\n" + "#" * 79 + "\n")

    with warnings.catch_warnings():
        warnings.simplefilter("ignore")
        cpol_processing.process_and_save(INFILE, OUTPATH, SOUND_DIR)

    print(crayons.green("Process completed."))
    return None
Esempio n. 5
0
def main():
    """
    Just print a welcoming message and calls the production_line_multiproc.
    """
    # Start with a welcome message.
    print("#" * 79)
    print("")
    print(" " * 25 + crayons.red("CPOL Level 1b production line.", bold=True))
    print("")
    print("- Input data directory path is: " + crayons.yellow(INFILE))
    print("- Output data directory path is: " + crayons.yellow(OUTPATH))
    print("- Radiosounding directory path is: " + crayons.yellow(SOUND_DIR))
    print("- Figures will be saved in: " + crayons.yellow(FIGURE_CHECK_PATH))
    print("#" * 79)
    print("")

    # Serious stuffs begin here.
    cpol_processing.process_and_save(INFILE, OUTPATH, OUTPATH_GRID,
                                     FIGURE_CHECK_PATH, SOUND_DIR)

    return None
def production_line_manager(radar_file_name, outpath, outpath_grid,
                            figure_path, sound_dir):
    """
    The production line manager calls the production line and manages it ;-).
    Buffer function that is used to catch any problem with the processing line
    without screwing the whole multiprocessing stuff.

    Parameters:
    ===========
        radar_file_name: str
            Name of the input radar file.
        outpath: str
            Path for saving output data.
    """
    shortname = os.path.basename(radar_file_name)
    # If we are stuck in the loop for more than TIME_BEFORE_DEATH seconds,
    # it will raise a TimeoutException that will kill the current process
    # and go to the next iteration.
    signal.signal(signal.SIGALRM, timeout_handler)
    signal.alarm(TIME_BEFORE_DEATH)
    try:
        cpol_processing.process_and_save(radar_file_name, outpath,
                                         outpath_grid, figure_path, sound_dir)
    except TimeoutException:
        # Treatment time was too long.
        logging.error("Too much time taken to treat %s, killing process.",
                      shortname)
        return None  # Go to next iteration.
    except Exception:
        print("Exception in production line code:")
        print("-" * 60)
        print("ERROR IN FILE {}.".format(radar_file_name))
        traceback.print_exc(file=sys.stdout)
        print("-" * 60)
        logging.error("Failed to process file", exc_info=True)
        return None
    else:
        signal.alarm(0)

    return None
Esempio n. 7
0
def buffer(infile):
    cpol_processing.process_and_save(infile, OUTPATH, SOUND_DIR, True)
    return None