问题简介
我们都知道,在运行WRF模式之前,需要使用其WPS前处理程序,制作对应的模拟域与气象场输入,而WPS主要由3个主程序组成,分别为:
geogrid.exe
定义模式的模拟域,并将静态地理数据插值到模式网格中。ungrib.exe
从Grib的格式的文件读取气象数据。metgrid.exe
将读取的气象数据,水平插值到geogrid.exe
定义的模拟域网格中。
通过以上介绍不难看出,整个WPS的处理流程并不复杂,而最后我们的目的就是要将模拟域与气象场结合,输入到WRF中。
在运行WPS过程中,metgrid.exe
需要最后运行,因为它是将其他两个主程序处理后的数据进行插值结合的程序,即:从geogrid.exe
中获得模拟域与地理信息,从ungrib.exe
中获得气象数据,而metgrid.exe
从两个程序中获取信息的方式则为:读取geogrid.exe
和ungrib.exe
运行生成的中间文件(intermediate file),即geo_dem和 FILE打头的文件。
那么,就有了问题,如果我们想添加额外的气象数据,而这个气象数据本身并不支持grib格式,无法用ungrib.exe
处理,我们应当怎么做呢?
这时候,我们就需要自己根据我们的数据,撰写可以被metgrid.exe
所读取的中间文件,并修改metgrid.TBL文件和namelist.wps,使得我们添加的数据与变量可以被metgrid.exe
处理。
中间文件可分为三种格式:WPS、WRFSI、MM5。而WRF-ARW-online网站提供了三种格式的信息与描述: intermediate file这里主要介绍最简单与最常用的WPS FROMAT。
WPS intermediate file
在将数据写入WPS中间格式时,二维字段被写入实值的矩形数组。三维数组必须跨垂直维度拆分为独立编写的二维数组。还应注意的是,对于全局数据集,必须使用高斯投影或柱面等距投影,对于区域数据集,可以使用墨卡托投影、兰伯特共形投影、极坐标投影或柱面等距投影。
WRF的官网手册第三章,给出了如何将单个二维数组写成中间格式的Fortran代码:
integer :: version ! Format version (must =5 for WPS format)
integer :: nx, ny ! x- and y-dimensions of 2-d array
integer :: iproj ! Code for projection of data in array:
! 0 = cylindrical equidistant
! 1 = Mercator
! 3 = Lambert conformal conic
! 4 = Gaussian (global only!)
! 5 = Polar stereographic
real :: nlats ! Number of latitudes north of equator
! (for Gaussian grids)
real :: xfcst ! Forecast hour of data
real :: xlvl ! Vertical level of data in 2-d array
real :: startlat, startlon ! Lat/lon of point in array indicated by
! startloc string
real :: deltalat, deltalon ! Grid spacing, degrees
real :: dx, dy ! Grid spacing, km
real :: xlonc ! Standard longitude of projection
real :: truelat1, truelat2 ! True latitudes of projection
real :: earth_radius ! Earth radius, km
real, dimension(nx,ny) :: slab ! The 2-d array holding the data
logical :: is_wind_grid_rel ! Flag indicating whether winds are
! relative to source grid (TRUE) or
! relative to earth (FALSE)
character (len=8) :: startloc ! Which point in array is given by
! startlat/startlon; set either
! to 'SWCORNER' or 'CENTER '
character (len=9) :: field ! Name of the field
character (len=24) :: hdate ! Valid date for data YYYY:MM:DD_HH:00:00
character (len=25) :: units ! Units of data
character (len=32) :: map_source ! Source model / originating center
character (len=46) :: desc ! Short description of data
! 1) WRITE FORMAT VERSION
write(unit=ounit) version
! 2) WRITE METADATA
! Cylindrical equidistant
if (iproj == 0) then
write(unit=ounit) hdate, xfcst, map_source, field, &
units, desc, xlvl, nx, ny, iproj
write(unit=ounit) startloc, startlat, startlon, &
deltalat, deltalon, earth_radius
! Mercator
else if (iproj == 1) then
write(unit=ounit) hdate, xfcst, map_source, field, &
units, desc, xlvl, nx, ny, iproj
write(unit=ounit