• WRF学习笔记之四:撰写WPS intermediate file添加海冰场/NCL学习/WRF进阶:如何向WRF添加额外气象场?


    问题简介

    我们都知道,在运行WRF模式之前,需要使用其WPS前处理程序,制作对应的模拟域与气象场输入,而WPS主要由3个主程序组成,分别为:

    1. geogrid.exe定义模式的模拟域,并将静态地理数据插值到模式网格中。
    2. ungrib.exe 从Grib的格式的文件读取气象数据。
    3. metgrid.exe将读取的气象数据,水平插值到geogrid.exe定义的模拟域网格中。

    通过以上介绍不难看出,整个WPS的处理流程并不复杂,而最后我们的目的就是要将模拟域与气象场结合,输入到WRF中。
    在运行WPS过程中,metgrid.exe需要最后运行,因为它是将其他两个主程序处理后的数据进行插值结合的程序,即:从geogrid.exe中获得模拟域与地理信息,从ungrib.exe中获得气象数据,而metgrid.exe从两个程序中获取信息的方式则为:读取geogrid.exeungrib.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
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
  • 相关阅读:
    哈希表(哈希函数和处理哈希冲突)_20230528
    Android11.0 修改设备名、型号、厂商
    快速掌握 Base 64 | Java JS 密码系列
    C++入门04—数组与函数
    JavaScript 的运算符和表达式
    【Vue五分钟】 五分钟了解Webpack底层原理以及脚手架工具分析
    C语言关键字之C89、C99、C11
    [Linux Review-1] Linux OS fundamental #101
    vite下,修改node_modules源码后,在浏览器源码中看不到改动的内容
    K-近邻算法
  • 原文地址:https://blog.csdn.net/weixin_43750300/article/details/127534372