Esempio n. 1
0
def tclim_main(tscale_file):
    print(tscale_file)
    daily_obs = resamp_1D(tscale_file)

    # run qmap
    sample = daily_obs.split('/')[-1].split('.')[0]
    #logging.info("Running qmap job "+ sample )
    cmd = [
        "Rscript", "qmap_hour_plots_daily.R", root,
        str(sample), daily_obs,
        str(mylon),
        str(mylat)
    ]
    subprocess.check_output(cmd)

    cmd = ["Rscript", "aggregate_qmap_results.R", root, str(sample)]
    subprocess.check_output(cmd)

    cmd = ["Rscript", "qmap_plots.R", root, str(sample), daily_obs]
    subprocess.check_output(cmd)

    # cleanup _HOURLY.txt
    # /home/joel/sim/qmap/topoclim_test_hpc/g4/smeteoc1_1D/aqmap_results
    #findDelete(root+"/**/aqmap_results", dir=True)

    # list all daily qmap files
    daily_cordex_files = glob.glob(root + "/s" + sample + "/fsm/*Q.txt")
    # hourly obs
    hourly_obs = resamp_1H(tscale_file)
    # loop over with dissag routine
    for daily_cordex in daily_cordex_files:
        tclim_disagg.main(daily_cordex, hourly_obs, str(mylon), str(mylat),
                          str(mytz))
Esempio n. 2
0
def tclim_main_DEBUG(tscale_file, mylon, mylat, mytz, slope):
    print(tscale_file)

    # list all daily qmap files
    daily_cordex_files = glob.glob(root + "/s" + sample + "/fsm/*Q.txt")
    # hourly obs
    hourly_obs = resamp_1H(tscale_file)
    # loop over with dissag routine
    for daily_cordex in daily_cordex_files:
        tclim_disagg.main(daily_cordex, hourly_obs, str(mylon), str(mylat),
                          str(mytz), slope)

    meteofiles = (sorted(glob.glob(root + "/s" + sample + "/fsm/*F.txt")))
Esempio n. 3
0
def tclim_main(tscale_file, mylon, mylat, mytz, slope):
    print(tscale_file)
    logging.info("tcliming" + tscale_file)
    daily_obs = resamp_1D(tscale_file)

    # run qmap
    sample = daily_obs.split('/')[-1].split('.')[0]
    #logging.info("Running qmap job "+ sample )
    cmd = [
        "Rscript", "qmap_hour_plots_daily.R", root,
        str(sample), daily_obs,
        str(mylon),
        str(mylat), CORDEXPATH
    ]
    subprocess.check_output(cmd)

    cmd = ["Rscript", "aggregate_qmap_results.R", root, str(sample)]
    subprocess.check_output(cmd)

    cmd = ["Rscript", "qmap_plots.R", root, str(sample), daily_obs]
    #subprocess.check_output(cmd)

    # cleanup
    findDelete(root + "/s" + sample + "/aqmap_results", dir=True)

    # list all daily qmap files
    daily_cordex_files = glob.glob(root + "/s" + sample + "/fsm/*Q.txt")
    # hourly obs
    hourly_obs = resamp_1H(tscale_file)
    # loop over with dissag routine
    for daily_cordex in daily_cordex_files:
        tclim_disagg.main(daily_cordex, hourly_obs, str(mylon), str(mylat),
                          str(mytz), slope)

    meteofiles = (sorted(glob.glob(root + "/s" + sample + "/fsm/*F.txt")))

    for meteofile in meteofiles:
        fsm_sim(meteofile, namelist, fsmexepath)

    findDelete(root + "/s" + sample + "/fsm", dir=True)
    os.chdir(srcdir)
Esempio n. 4
0
    print("Quantile mapping... ")
    cmd = [
        "Rscript", "../rsrc/qmap_hour.R", wd,
        str(sample), daily_obs,
        str(lp.lon[i]),
        str(lp.lat[i]), cordex_path, startDateHist, endDateHist,
        startDateRcp.endDateRcp, startDateQmap, endDateQmap
    ]
    subprocess.check_output(cmd)

    cmd = ["Rscript", "../rsrc/aggregate_qmap_results.R", wd, str(sample)]
    subprocess.check_output(cmd)

    # cleanup
    tsrc.findDelete(wd + "/s" + sample + "/aqmap_results", dir=True)

    # list all daily qmap files
    daily_cordex_files = glob.glob(wd + "/s" + sample + "/fsm/*Q.txt")
    # hourly obs
    hourly_obs = tsrc.resamp_1H(tscale_file)
    # loop over with dissag routine

    print("Dissagregate daily to hourly... ")
    for daily_cordex in daily_cordex_files:
        disagg.main(daily_cordex, hourly_obs, str(lp.lon[i]), str(lp.lat[i]),
                    str(lp.tz[i]), str(lp.slp[i]))

    f = open(wd + '/s' + sample + "/QSUCCESS", "w")

    print("TopoCLIM finished!")