WRF大神

    1. 在提取变量前查看.nc 文件的变量信息

    Note: for WRF variable names and their definitions, you can easily check them by using "ncl_filedump":

 ncl_filedump wrfout_d01_2000-01-24_12:00:00.nc(注意你在用Tab,补全命令时是不会加surfix.nc的,所以你自己加上后缀才可以,否则报错)



2.如何提取诊断变量slp(因为slp不是输出变量)

  两个函数 wrf_slp() wrf_usr_getvar()

Example 1

       T  = nc_file->T(time,:,:,:)
       th = T + 300.

       P  = nc_file->P(time,:,:,:)
       PB = nc_file->PB(time,:,:,:)
       p  = ( P + PB )

       tk = wrf_tk( p , th )

       QVAPOR = nc_file->QVAPOR(time,:,:,:)
       PH     = nc_file->PH(time,:,:,:)
       PHB    = nc_file->PHB(time,:,:,:)
       var    = ( PH + PHB ) / 9.81
       dim    = dimsizes(var)
       z      = 0.5 * ( var(0:dim(0)-2,:,:) + var(1:dim(0)-1,:,:) )

       slp   = wrf_slp( z, tk, p, QVAPOR )
Example 2

The function wrf_user_getvar, (available in the $NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl script)

can also be used to calculate many diagnostics in one step.

  load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
  load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"

  a = addfile("wrfout_d01_2000-01-24_12:00:00.nc","r")

  time = 1
  slp = wrf_user_getvar(a,"slp",time)  ; calculate SLP
You can see some other example scripts and their resultant images at:
http://www2.mmm.ucar.edu/wrf/OnLineTutorial/Graphics/NCL/



原文地址:https://www.cnblogs.com/zhengtaodoit/p/4947541.html