Ejemplo n.º 1
0
def main(iargs=None):
    """Downloads data with ssara and asfserial scripts."""

    command = 'download_rsmas.py ' + iargs[0]
    messageRsmas.log(command)

    inps = command_line_parse(iargs)

    #########################################
    # Submit job
    #########################################
    if inps.submit_flag:
        job_file_name = 'download_rsmas'
        work_dir = os.getcwd()
        job_name = inps.template_file.split(os.sep)[-1].split('.')[0]
        wall_time = '24:00'

        cb.submit_script(job_name, job_file_name, sys.argv[:], work_dir,
                         wall_time)

    project_name = putils.get_project_name(
        custom_template_file=inps.template_file)
    work_dir = putils.get_work_directory(None, project_name)
    slc_dir = os.path.join(work_dir, 'SLC')
    if not os.path.isdir(work_dir):
        os.makedirs(work_dir)
    if not os.path.isdir(slc_dir):
        os.makedirs(slc_dir)

    os.chdir(work_dir)

    # if satellite is not Sentinel (not tried yet)
    if 'SenDT' not in project_name and 'SenAT' not in project_name:

        dataset_template = Template(inps.template_file)

        ssaraopt = dataset_template.generate_ssaraopt_string()
        ssara_call = ['ssara_federated_query.py'
                      ] + ssaraopt + ['--print', '--download']
        ssara_process = subprocess.Popen(ssara_call, shell=True).wait()
        completion_status = ssara_process.poll()

        return

    download('ssara', inps.template_file, slc_dir, outnum=1)
    #download('ssara', inps.template_file, slc_dir, outnum = 2)
    download('asfserial', inps.template_file, slc_dir, outnum=1)
Ejemplo n.º 2
0
##############################################################################
class inpsvar:
    pass

if __name__ == "__main__":

    inps = inpsvar()

    try:
        inps.custom_template_file = sys.argv[1]
        inps.start = int(sys.argv[2])
        inps.stop = int(sys.argv[3])
    except:
        print('')

    inps.project_name = get_project_name(inps.custom_template_file)
    inps.work_dir = os.getenv('SCRATCHDIR') + '/' + inps.project_name
    inps = create_or_update_template(inps)
    run_file_list = get_run_files()

    try:
        inps.start
    except:
        inps.start = 1
    try:
        inps.stop
    except:
        inps.stop = len(run_file_list)


    logger_exec_run.log(loglevel.INFO, "Executing Runfiles {} to {}".format(inps.start,inps.stop))
Ejemplo n.º 3
0
    if exit_code in bad_codes or hang_status:
        if exit_code in bad_codes:
            logger.log(loglevel.WARNING,
                       "Exited with bad exit code, running again")
        if hang_status:
            logger.log(loglevel.WARNING, "Hanging, running again")

        run_ssara(inps, run_number=run_number + 1)

    return 0


if __name__ == "__main__":
    inps = command_line_parse(sys.argv[1:])

    inps.project_name = putils.get_project_name(
        custom_template_file=inps.template)
    inps.work_dir = putils.get_work_directory(None, inps.project_name)
    inps.slcDir = inps.work_dir + "/SLC"
    os.chdir(inps.work_dir)
    messageRsmas.log(
        os.path.basename(sys.argv[0]) + ' ' + ' '.join(sys.argv[1::]))
    os.chdir(inps.slcDir)

    logger.log(loglevel.INFO, "DATASET: %s",
               str(inps.template.split('/')[-1].split(".")[0]))
    logger.log(loglevel.INFO, "DATE: %s",
               datetime.datetime.now().strftime("%Y-%m-%dT%H:%M:%S.%f"))
    succesful = run_ssara(inps)
    logger.log(loglevel.INFO, "SUCCESS: %s", str(succesful))
    logger.log(loglevel.INFO, "------------------------------------")
Ejemplo n.º 4
0
def process(inps):

    #########################################
    # Initiation
    #########################################
    start_time = time.time()

    inps.project_name = get_project_name(inps.custom_template_file)
    inps.work_dir = get_work_directory(None, inps.project_name)
    inps.slc_dir = os.path.join(inps.work_dir, 'SLC')

    if inps.remove_project_dir:
        _remove_directories(directories_to_delete=[inps.work_dir])

    if not os.path.isdir(inps.work_dir):
        os.makedirs(inps.work_dir)
    os.chdir(inps.work_dir)

    #  Read and update template file:
    inps = prs.create_or_update_template(inps)
    print(inps)
    if not inps.processingMethod or inps.workflow == 'interferogram':
        inps.processingMethod = 'sbas'

    if not os.path.isdir(inps.slc_dir):
        os.makedirs(inps.slc_dir)

    command_line = os.path.basename(sys.argv[0]) + ' ' + ' '.join(sys.argv[1:])
    logger_process_rsmas.log(loglevel.INFO, '##### NEW RUN #####')
    logger_process_rsmas.log(loglevel.INFO, 'process_rsmas.py ' + command_line)
    messageRsmas.log('##### NEW RUN #####')
    messageRsmas.log(command_line)

    #########################################
    # startssara: Getting Data
    #########################################

    # running download scripts:
    #     download_ssara_rsmas.py $TE/template
    #     downlaod_asfserial_rsmas.py $TE/template
    prs.call_ssara(inps.flag_ssara, inps.custom_template_file, inps.slc_dir)

    #########################################
    # startmakerun: create run files
    #########################################

    # create or copy DEM
    # running the script:
    #     dem_rsmas.py $TE/template

    prs.create_or_copy_dem(inps, inps.work_dir, inps.template,
                           inps.custom_template_file)

    # Check for DEM and create sentinel run files
    # running the script:
    #     create_stacksentinel_run_files.py $TE/template

    prs.create_runfiles(inps)

    #########################################
    # startprocess: Execute run files
    #########################################

    # Running the script:
    #    execute_stacksentinel_run_files.py $TE/template starting_run stopping_run
    #    Example for running run 1 to 4:
    #    execute_stacksentinel_run_files.py $TE/template 1 4

    prs.process_runfiles(inps)

    #########################################
    # startpysar: running PySAR and email results
    #########################################

    if inps.processingMethod == 'squeesar':
        # Run squeesar script:
        #    create_squeesar_run_files.py $TE/template
        #    execute_squeesar_run_files.py $TE/template
        prs.process_time_series(inps)
    else:
        # Run PySAR script:
        #    pysarApp.py $TE/template
        prs.run_pysar(inps, start_time)

    # Run ingest insarmaps script and email results
    #    ingest_insarmaps.py $TE/template

    prs.run_ingest_insarmaps(inps)

    logger_process_rsmas.log(loglevel.INFO, 'End of process_rsmas')