资讯详情

NCL绘制:WRF输出结果wrfout_d01*文件后处理

目录

    • 1. 读取
    • 2. 绘制


WRF官网关于ncl的教程:: https://www2.mmm.ucar.edu/wrf/OnLineTutorial/Graphics/NCL/NCL_examples.php

编程语言:NCL 系统:Ubuntu 16.04.6 LTS 以及 Windows10

windows下Sublime编辑脚本,链接共享文件夹run/下运行。

ln -sf /media/sf_WRF/WRFout.ncl .


1. 读取

WRF模式运行结束后会输出wrfout_d01*结果文件addfile()打开函数。 可批量修改文件.nc格式,详情请参考其他教程;也可以使用NCL直接读取。

    a = addfile("wrfout_d01_2017-06-20_00:00:00","r")     print(a)     printVarSummary(a) 

1

关于文件wrfout_d01*输出结果,大致看变量和维度信息,包括wrf设置参数信息等。

NCL: 文件大于2G时,需要用setfileoption()函数读。

2. 绘制

利用wrf_user_getvar()函数读取文件中的气象变量数据。 此外,简单设置绘图参数,出简图看一眼数据是否正常。

  • wrf_user_getvar()函数可以使用WRF Output的sigma坐标直接插入高层或气压层,实现垂直坐标转换,方便NCL继续处理。
  load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"   load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl" begin   a = addfile("wrfout_d01_2017-06-23_00:00:00","r")   print(a) ;## wrf_user_getvar()函数可以使用WRF Output的sigma坐标直接插到高度层 ;## 或气压层,实现垂直坐标转换,方便NCL继续处理。   ter = wrf_user_getvar(a,"HGT",0)   ; Get terrain height for time 0    wks = gsn_open_wks("png","test3")       ; Create a plot workstation   opts = True                                ; Set some Basic Plot options   opts@MainTitle = "GEOGRID FIELDS"    res = opts                                 ; Use basic options for this field   res@cnFillOn = True                        ; Create a color fill plot    contour = wrf_contour(a,wks,ter,res) ; 单独contour没有画面    pltres = True                              ; Set plot options   mpres = True                               ; Set map options   mpres@mpGeophysicalLineColor      = "Black"  ; Overwrite bsic map settings
  mpres@mpGridLineColor             = "Black"
  mpres@mpLimbLineColor             = "Black"
  mpres@mpNationalLineColor         = "Black"
  mpres@mpPerimLineColor            = "Black"
  mpres@mpUSStateLineColor          = "Black"
  plot = wrf_map_overlays(a,wks,(/contour/),pltres,mpres)  ; Plot the data over a map background
end

输出结果图大致如下: 更多细化的绘图设置参考NCL官网。连续输出多个时次的图参考WRF官网对于NCL绘图的脚本实例。

标签: d01kn热继电器

锐单商城拥有海量元器件数据手册IC替代型号,打造 电子元器件IC百科大全!

锐单商城 - 一站式电子元器件采购平台