WRF中使用ERA5再分析数据
本人在做一些实例时,需要用到最新的ERA5再分析数据集,其中我下载的是ERA5 hourly data on pressure levels form 1979 to present和ERA5 hourly data on single levels from 1979 to present中的3天数据。1、注册climate copernicus账号下载ERA5数据前先要注册其账号2、选择
本人在做一些实例时,需要用到最新的ERA5再分析数据集。我下载的是ERA5 hourly data on pressure levels form 1979 to present和ERA5 hourly data on single levels from 1979 to present中的3天数据,时间间隔是6小时。
1、注册climate copernicus账号
点击climate copernicus,下载ERA5数据前先要注册其账号。
注册完成之后,点击Climate Data Store API,然后复制自己的url和key,如下图所示:
复制完成之后,c盘中新建一个文本文档,然后将刚刚复制的内容粘贴进文本中,命名为.cdsapirc,如下图所示:
2、选择变量
WRF中对于气象数据的字段有具体的要求,其中我们可以参考官网用户手册。我这里直接提取出来了,如下所示:
3D Data (e.g. data on pressure levels)
Temperature
U and V components of Wind
Geopotential Height
Relative Humidity (the code can calculate RH if Specific Humidity is available;this is controlled in the Vtable)
2D Data
Surface Pressure
Mean Sea Level Pressure
Skin Temperature/SST
2-meter Temperature
2-meter Relative or Specific Humidity
10-meter U and V components of wind
Soil data (temperature and moisture) and soil height
If any masked field is ingested, then a LANDSEA field is recommended
Water equivalent snow depth (SNOW) is a nice field to have, but not required.
SEAICE is good to have for a high latitude winter case, but it is not required.
3、下载数据
(1)下载ERA5 hourly data on pressure levels form 1979 to present
点击网站导航栏的Datasets,找到ERA5 hourly data on pressure levels form 1979 to present,选择相应的变量,选择完毕之后,点击Show API request,可以看到API,如下所示:
import cdsapi
c = cdsapi.Client()
c.retrieve(
'reanalysis-era5-pressure-levels',
{
'product_type': 'reanalysis',
'format': 'grib',
'pressure_level': [
'1', '2', '3',
'5', '7', '10',
'20', '30', '50',
'70', '100', '125',
'150', '175', '200',
'225', '250', '300',
'350', '400', '450',
'500', '550', '600',
'650', '700', '750',
'775', '800', '825',
'850', '875', '900',
'925', '950', '975',
'1000',
],
'variable': [
'geopotential', 'relative_humidity', 'specific_humidity',
'temperature', 'u_component_of_wind', 'v_component_of_wind',
],
'year': '2021',
'month': '01',
'day': [
'01', '02', '03',
],
'time': [
'00:00', '06:00', '12:00',
'18:00',
],
'area': [
60, 0, -60,
120,
],
},
'download.grib')
再点击下面的最右下角的Submit Form按钮,查看自己数据排队的进度,如下图所示:
当Status显示In progress时,就可以直接点击通过浏览器下载,而我是利用Python进行下载的,下面是我下载的Python代码:
import cdsapi
import os
def download():
c = cdsapi.Client()
c.retrieve(
'reanalysis-era5-pressure-levels',
{
'product_type': 'reanalysis',
'variable': [
'geopotential', 'relative_humidity', 'specific_humidity',
'temperature', 'u_component_of_wind', 'v_component_of_wind',
],
'pressure_level': [
'1', '2', '3',
'5', '7', '10',
'20', '30', '50',
'70', '100', '125',
'150', '175', '200',
'225', '250', '300',
'350', '400', '450',
'500', '550', '600',
'650', '700', '750',
'775', '800', '825',
'850', '875', '900',
'925', '950', '975',
'1000',
],
'year': '2021',
'month': '01',
'day': [
'01', '02', '03',
],
'time': [
'00:00', '06:00', '12:00',
'18:00',
],
'area': [
60, 0, -60,
120,
],
'format': 'grib',
},
'pressure-levels.grib')
if __name__ == '__main__':
# define directory where you want data store in.
os.chdir(r"E:/06Data/ERA5")
download()
最后只需等待即可!
(2)下载ERA5 hourly data on single levels from 1979 to present
在Datasets中找到ERA5 hourly data on single levels from 1979 to present,选择相应变量,API如下所示:
import cdsapi
c = cdsapi.Client()
c.retrieve(
'reanalysis-era5-single-levels',
{
'product_type':'reanalysis',
'format':'grib',
'variable':[
'10m_u_component_of_wind','10m_v_component_of_wind','2m_dewpoint_temperature',
'2m_temperature','land_sea_mask','mean_sea_level_pressure',
'sea_ice_cover','sea_surface_temperature','skin_temperature',
'snow_depth','soil_temperature_level_1','soil_temperature_level_2',
'soil_temperature_level_3','soil_temperature_level_4','surface_pressure',
'volumetric_soil_water_layer_1','volumetric_soil_water_layer_2','volumetric_soil_water_layer_3',
'volumetric_soil_water_layer_4'
],
'year': '2021',
'month': '01',
'day': [
'01', '02', '03',
],
'time': [
'00:00', '06:00', '12:00',
'18:00',
],
'area': [
60, 0, -60,
120,
],
'format': 'grib',
},
'Single-level.grib')
后面的步骤和(1)是一样的,这里我就不再赘述了。
4、ERA5嵌入到WRF中
(1)下载好的两个ERA5的数据放入WRF中的DATA文件夹中,如下图所示:
(2)连接ERA-interim.pl Vtable
test@test:~/Build_WRF/WPS-4.1$ ln -sf ungrib/Variable_Tables/Vtable.ERA-interim.pl Vtable
(3)通过link_grib.csh脚本来连接GRIB data
test@test:~/Build_WRF/WPS-4.1$ ./link_grib.csh ../DATA/ERA5/*.grib
在WPS文件夹中出现了以下两个文件,则说明连接成功,
(4)运行ungrib.exe
先打开namelist.wps,设置&ungrib项,如下所示:
&ungrib
out_format = 'WPS',
prefix = 'FILE',
/
执行ungrib.exe
test@test:~/Build_WRF/WPS-4.1$ ./ungrib.exe
运行成功后,在WPS文件夹下得到以下几个文件:
则说明已经将ERA5嵌入到WRF中了!
整个流程到这里就结束了,请大家批评指正!希望对大家有帮助!

DAMO开发者矩阵,由阿里巴巴达摩院和中国互联网协会联合发起,致力于探讨最前沿的技术趋势与应用成果,搭建高质量的交流与分享平台,推动技术创新与产业应用链接,围绕“人工智能与新型计算”构建开放共享的开发者生态。
更多推荐
所有评论(0)