美文网首页
使用CFSR驱动WRF的方法

使用CFSR驱动WRF的方法

作者: 段影评 | 来源:发表于2019-10-22 11:31 被阅读0次

前言:

不论是业务预报,还是中小尺度模拟,
WRF作为一种成熟且强大的工具,
已经成为气象行业内较为常用的方法。
使用不同源的再分析资料为中尺度计算提供初边界条件,
对比不同数据源的质量效果,
也是行业内从业人员比较关心的一个问题,同时也是一个很大的话题。

除了常见了GFS(FNL),ERA-Interim,ERA5资料外,小编还跑通了CFSR数据。下面对该方法简单分享下。

主要分以下几步:

资料下载,资料选择,解码,计算,后处理。

资料下载参考代码:

#!/usr/bin/env python
#################################################################
# Python Script to retrieve 93 online Data files of 'ds094.0',
# total 164.37M. This script uses 'requests' to download data.
#
# Highlight this script by Select All, Copy and Paste it into a file;
# make the file executable and run it on command line.
#
# You need pass in your password as a parameter to execute
# this script; or you can set an environment variable RDAPSWD
# if your Operating System supports it.
#
# Contact dattore@ucar.edu (Bob Dattore) for further assistance.
#################################################################


import sys, os
import requests

def check_file_status(filepath, filesize):
    sys.stdout.write('\r')
    sys.stdout.flush()
    size = int(os.stat(filepath).st_size)
    percent_complete = (size/filesize)*100
    sys.stdout.write('%.3f %s' % (percent_complete, '% Completed'))
    sys.stdout.flush()

# Try to get password
if len(sys.argv) < 2 and not 'RDAPSWD' in os.environ:
    try:
        import getpass
        input = getpass.getpass
    except:
        try:
            input = raw_input
        except:
            pass
    pswd = input('Password: ')
else:
    try:
        pswd = sys.argv[1]
    except:
        pswd = os.environ['RDAPSWD']

url = 'https://rda.ucar.edu/cgi-bin/login'
values = {'email' : 'duanyapeng1@163.com', 'passwd' : pswd, 'action' : 'login'}
# Authenticate
ret = requests.post(url,data=values)
if ret.status_code != 200:
    print('Bad Authentication')
    print(ret.text)
    exit(1)
dspath = 'http://rda.ucar.edu/dsrqst/DUAN391983/'
filelist = [
'dos-wget.391983.bat',
'unix-curl.391983.csh',
'unix-wget.391983.csh',
'201701300000.cdas1.20170129.sfluxgrbl.grb2',
'201701300600.cdas1.20170130.sfluxgrbl.grb2',
'201701301200.cdas1.20170130.sfluxgrbl.grb2',
'201701301800.cdas1.20170130.sfluxgrbl.grb2',
'201701310000.cdas1.20170130.sfluxgrbl.grb2',
'201701310600.cdas1.20170131.sfluxgrbl.grb2',
'201701311200.cdas1.20170131.sfluxgrbl.grb2',
'201701311800.cdas1.20170131.sfluxgrbl.grb2',
'201702010000.cdas1.20170131.sfluxgrbl.grb2',
'201701300000.cdas1.20170129.pgrbl.grb2',
'201701300600.cdas1.20170130.pgrbl.grb2',
'201701301200.cdas1.20170130.pgrbl.grb2',
'201701301800.cdas1.20170130.pgrbl.grb2',
'201701310000.cdas1.20170130.pgrbl.grb2',
'201701310600.cdas1.20170131.pgrbl.grb2',
'201701311200.cdas1.20170131.pgrbl.grb2',
'201701311800.cdas1.20170131.pgrbl.grb2',
'201702010000.cdas1.20170131.pgrbl.grb2',
'201701300000.cdas1.20170129.pgrbf.grb2',
'201701300600.cdas1.20170130.pgrbf.grb2',
'201701301200.cdas1.20170130.pgrbf.grb2',
'201701301800.cdas1.20170130.pgrbf.grb2',
'201701310000.cdas1.20170130.pgrbf.grb2',
'201701310600.cdas1.20170131.pgrbf.grb2',
'201701311200.cdas1.20170131.pgrbf.grb2',
'201701311800.cdas1.20170131.pgrbf.grb2',
'201702010000.cdas1.20170131.pgrbf.grb2',
'201701300000.cdas1.20170129.pgrbh.grb2',
'201701300600.cdas1.20170130.pgrbh.grb2',
'201701301200.cdas1.20170130.pgrbh.grb2',
'201701301800.cdas1.20170130.pgrbh.grb2',
'201701310000.cdas1.20170130.pgrbh.grb2',
'201701310600.cdas1.20170131.pgrbh.grb2',
'201701311200.cdas1.20170131.pgrbh.grb2',
'201701311800.cdas1.20170131.pgrbh.grb2',
'201702010000.cdas1.20170131.pgrbh.grb2',
'201701300000.cdas1.20170129.sfluxgrbf.grb2',
'201701300600.cdas1.20170130.sfluxgrbf.grb2',
'201701301200.cdas1.20170130.sfluxgrbf.grb2',
'201701301800.cdas1.20170130.sfluxgrbf.grb2',
'201701310000.cdas1.20170130.sfluxgrbf.grb2',
'201701310600.cdas1.20170131.sfluxgrbf.grb2',
'201701311200.cdas1.20170131.sfluxgrbf.grb2',
'201701311800.cdas1.20170131.sfluxgrbf.grb2',
'201702010000.cdas1.20170131.sfluxgrbf.grb2',
'201701300000.cdas1.20170129.ipvgrbf.grb2',
'201701300000.cdas1.20170129.ipvgrbh.grb2',
'201701300000.cdas1.20170129.ipvgrbl.grb2',
'201701300000.cdas1.20170129.splgrbf.grb2',
'201701300000.cdas1.20170129.splgrbl.grb2',
'201701300600.cdas1.20170130.ipvgrbf.grb2',
'201701301200.cdas1.20170130.ipvgrbf.grb2',
'201701301800.cdas1.20170130.ipvgrbf.grb2',
'201701310000.cdas1.20170130.ipvgrbf.grb2',
'201701300600.cdas1.20170130.ipvgrbh.grb2',
'201701301200.cdas1.20170130.ipvgrbh.grb2',
'201701301800.cdas1.20170130.ipvgrbh.grb2',
'201701310000.cdas1.20170130.ipvgrbh.grb2',
'201701300600.cdas1.20170130.ipvgrbl.grb2',
'201701301200.cdas1.20170130.ipvgrbl.grb2',
'201701301800.cdas1.20170130.ipvgrbl.grb2',
'201701310000.cdas1.20170130.ipvgrbl.grb2',
'201701300600.cdas1.20170130.splgrbf.grb2',
'201701301200.cdas1.20170130.splgrbf.grb2',
'201701301800.cdas1.20170130.splgrbf.grb2',
'201701310000.cdas1.20170130.splgrbf.grb2',
'201701300600.cdas1.20170130.splgrbl.grb2',
'201701301200.cdas1.20170130.splgrbl.grb2',
'201701301800.cdas1.20170130.splgrbl.grb2',
'201701310000.cdas1.20170130.splgrbl.grb2',
'201701310600.cdas1.20170131.ipvgrbf.grb2',
'201701311200.cdas1.20170131.ipvgrbf.grb2',
'201701311800.cdas1.20170131.ipvgrbf.grb2',
'201702010000.cdas1.20170131.ipvgrbf.grb2',
'201701310600.cdas1.20170131.ipvgrbh.grb2',
'201701311200.cdas1.20170131.ipvgrbh.grb2',
'201701311800.cdas1.20170131.ipvgrbh.grb2',
'201702010000.cdas1.20170131.ipvgrbh.grb2',
'201701310600.cdas1.20170131.ipvgrbl.grb2',
'201701311200.cdas1.20170131.ipvgrbl.grb2',
'201701311800.cdas1.20170131.ipvgrbl.grb2',
'201702010000.cdas1.20170131.ipvgrbl.grb2',
'201701310600.cdas1.20170131.splgrbf.grb2',
'201701311200.cdas1.20170131.splgrbf.grb2',
'201701311800.cdas1.20170131.splgrbf.grb2',
'201702010000.cdas1.20170131.splgrbf.grb2',
'201701310600.cdas1.20170131.splgrbl.grb2',
'201701311200.cdas1.20170131.splgrbl.grb2',
'201701311800.cdas1.20170131.splgrbl.grb2',
'201702010000.cdas1.20170131.splgrbl.grb2']
for file in filelist:
    filename=dspath+file
    file_base = os.path.basename(file)
    print('Downloading',file_base)
    req = requests.get(filename, cookies = ret.cookies, allow_redirects=True, stream=True)
    filesize = int(req.headers['Content-length'])
    with open(file_base, 'wb') as outfile:
        chunk_size=1048576
        for chunk in req.iter_content(chunk_size=chunk_size):
            outfile.write(chunk)
            if chunk_size < filesize:
                check_file_status(file_base, filesize)
    check_file_status(file_base, filesize)
    print()

资料选择

经过尝试,

surface数据要选择后缀为sfluxgrbf.tar中的201701300000.cdas1.20170129.sfluxgrbf.grib2
pressure level的数据要选择后缀为pgrbh.tar中的
201701300600.cdas1.20170130.pgrbh.grib2

这是资料文件名的命名规则

解码:

地面资料链接 Vtable.CFSR_sfc_flxf06 作为Vtable
高空资料链接 Vtable.CFSR_press_pgbh06 作为Vtable

计算:

方法和跑ECMWF资料的方法基本一致

后处理:

方法和跑ECMWF资料的方法基本一致

联系作者: DYP

相关文章

  • 使用CFSR驱动WRF的方法

    前言: 不论是业务预报,还是中小尺度模拟,WRF作为一种成熟且强大的工具,已经成为气象行业内较为常用的方法。使用不...

  • 使用gdas资料驱动WRF

    先贴一个小错误 错误:First eta level should be 1.0 and the last 0.0...

  • 创建运行目录

    export path_src_wrf=/public/home/hysplit/work/WRF381/WRF-...

  • USTC version of WRF-Chem (USTC-W

    USTC version of WRF-Chem (USTC-WRF-Chem) WRF-Chem是天气研究和预测...

  • 使用高程数据

    近期有个需求,在地图上绘制高度数据,于是各种搜索,期间想到的方法主要包括以下几种:使用WRF模型的WPS直接输出高...

  • WRF简介

    WRF:全名是Weather Research and Forecast Model。从名字上就可以看出,WRF的...

  • 安装 WRF-Chem 3.8.1 (WPS & WRF

    [ucar官方+最新版wrf安装说明](http://www2.mmm.ucar.edu/wrf/OnLineTu...

  • WRF

    查看时刻ncdump -v Times wrfout文件 查看末尾tail -f rsl.error.0000 查...

  • <转>JDBC连接数据库的四种方式:DriverManager,

    《转》 方法1:使用java.sql.DriverManager类 驱动管理器类,用于管理所有注册的驱动程序。 (...

  • coredata诡异的crash

    病情描述:使用coreData来驱动tableview,在代理方法 - (void)controllerWillC...

网友评论

      本文标题:使用CFSR驱动WRF的方法

      本文链接:https://www.haomeiwen.com/subject/ijxqvctx.html