示例#1
0
def run():
    #1. 首先是下载EC数据,
    starttime = datetime.datetime.now()
    yearint = datetime.datetime.now().year
    hours = datetime.datetime.now().hour
    if hours > 17:
        datestr = datetime.datetime.strftime(starttime, '%Y-%m-%d')
        pdatetimestring00 = datestr + " 00:00:00"
    else:
        nowdate = starttime + datetime.timedelta(days=-1)
        datestr = datetime.datetime.strftime(nowdate, '%Y-%m-%d')
        pdatetimestring00 = datestr + ' 12:00:00'
    initial_datetime = datetime.datetime.strptime(pdatetimestring00,
                                                  '%Y-%m-%d %H:%M:%S')
    downloadECdatafrombigdata_processing(initial_datetime)
    #2.解压EC数据
    oldfilepath = '/opt/meteo/cluster/data/ecmwf/orig'
    dirpath = '/moji/ecdata'
    ecpath = unzipfile(oldfilepath, dirpath)
    logger.info(ecpath)
    #3.DEM模型预测
    # path = '/moji/ecdata'
    outpath = '/home/wlan_dev/result'
    csvfile = '/home/wlan_dev/stations.csv'
    demcsv = '/mnt/data/dem.csv'
    modelProdict(ecpath, outpath, csvfile, demcsv, starttime)
    #4.准确率计算
    calculateAccuracy(initial_datetime)
    # 模型预测和准确率计算
    modelpredict001(ecpath, outpath, csvfile, starttime)
    calculateAccuracy001(initial_datetime)
    #5.删除EC数据
    if hours < 12:
        print ecpath
        deleteECMWF(ecpath)
示例#2
0
文件: mosrun.py 项目: cycle13/moji
def mosrun_history(starttime):
    #1. 首先是下载EC数据,
    # yearint=datetime.datetime.now().year
    # hours=datetime.datetime.now().hour
    yearint = starttime.year
    hours = starttime.hour
    if hours > 17:
        datestr = datetime.datetime.strftime(starttime, '%Y-%m-%d')
        pdatetimestring00 = datestr + " 00:00:00"
        print "2018-08-21 00:00:00"
    else:
        nowdate = starttime + datetime.timedelta(days=-1)
        datestr = datetime.datetime.strftime(nowdate, '%Y-%m-%d')
        pdatetimestring00 = datestr + ' 12:00:00'
    initial_datetime = datetime.datetime.strptime(pdatetimestring00,
                                                  '%Y-%m-%d %H:%M:%S')
    logger.info(initial_datetime)
    #传入时间为00点或者是12点
    downloadECdatafrombigdata(initial_datetime)
    #2.解压EC数据
    dirpath = '/moji/ecdata'
    print "2018-08-21 00:00:00-----------------------------------------------------------"
    ecpath = unzipfile(initial_datetime, dirpath)
    print ecpath + '==================================================================='
    #3.DEM模型预测
    # path = '/moji/ecdata'
    outpath = '/home/wlan_dev/result'
    csvfile = '/home/wlan_dev/stations.csv'
    demcsv = '/mnt/data/dem.csv'
    modelProdict(ecpath, outpath, csvfile, demcsv, initial_datetime)
    #4.准确率计算
    calculateAccuracy(initial_datetime)
    # 模型预测和准确率计算
    modelpredict001(ecpath, outpath, csvfile, starttime)
    calculateAccuracy001(initial_datetime)
    print ecpath
    #5.删除EC数据
    if hours < 12:
        deleteECMWF(ecpath)
示例#3
0
def mosrun_history(starttime):
    #1. 首先是下载EC数据,
    # yearint=datetime.datetime.now().year
    # hours=datetime.datetime.now().hour
    yearint=starttime.year
    hours=starttime.hour
    #给定时间世界时大于17计算本天的,否则计算昨天的12点的
    if hours>17:
        datestr=datetime.datetime.strftime(starttime,'%Y-%m-%d')
        pdatetimestring00 = datestr+" 00:00:00"
    else:
        nowdate=starttime+datetime.timedelta(days=-1)
        datestr=datetime.datetime.strftime(nowdate,'%Y-%m-%d')
        pdatetimestring00 = datestr+' 12:00:00'
    initial_datetime = datetime.datetime.strptime(pdatetimestring00,'%Y-%m-%d %H:%M:%S')
    #传入时间为00点或者是12点
    downloadECdatafrombigdata(initial_datetime)
    #2.解压EC数据
    dirpath='/home/wlan_dev/mosdata'
    print "-----------------------------------------------------------"
    ecpath=unzipfile(initial_datetime,dirpath)
    print ecpath+'==================================================================='
    #3.DEM模型预测
    # path = '/moji/ecdata'
    outpath = '/home/wlan_dev/mos/mosresult'
    csvfile = '/mnt/data/mosfile/stations.csv'
    demcsv = '/mnt/data/mosfile/dem0.1.csv'
    #modelProdict(ecpath, csvfile, demcsv,initial_datetime)
    ecfilename= os.path.split(ecpath)[1]
    readymodel(initial_datetime,dirpath)
    #4.准确率计算
    calculateAccuracy(initial_datetime)
    calculateAccuracy2(initial_datetime)
    # 模型预测和准确率计算
    # modelpredict001(ecpath,outpath,csvfile,starttime)
    # calculateAccuracy001(initial_datetime)
    print ecpath