| 
 
	积分6贡献 精华在线时间 小时注册时间2014-12-8最后登录1970-1-1 
 | 
 
 
 楼主|
发表于 2014-12-15 17:53:10
|
显示全部楼层 
| 好吧,最后从网上看到这个文件WRFUserARW.ncl 发现里面有公式,直接翻译过来就可以用了
 
 
 if( variable .eq. "rh" ) then
 if(isfilevar(nc_file,"T")) then
 ;; first compute theta - function wrf_tk needs theta and pressure (Pa) on input
 ;; THEN compute rh, using tk, p (Pa), QVAPOR
 if ( time .eq. -1 ) then
 if(ISFILE) then
 T      = nc_file->T
 P      = nc_file->P
 PB     = nc_file->PB
 QVAPOR = nc_file->QVAPOR
 else
 T      = file_handle[:]->T
 P      = file_handle[:]->P
 PB     = file_handle[:]->PB
 QVAPOR = file_handle[:]->QVAPOR
 end if
 else
 if(ISFILE) then
 T      = nc_file->T(time_in,:,:,:)
 P      = nc_file->P(time_in,:,:,:)
 PB     = nc_file->PB(time_in,:,:,:)
 QVAPOR = nc_file->QVAPOR(time_in,:,:,:)
 else
 T      = file_handle[:]->T(time_in,:,:,:)
 P      = file_handle[:]->P(time_in,:,:,:)
 PB     = file_handle[:]->PB(time_in,:,:,:)
 QVAPOR = file_handle[:]->QVAPOR(time_in,:,:,:)
 end if
 end if
 T = T + 300.
 P  = P + PB
 QVAPOR = QVAPOR > 0.000
 tk = wrf_tk( P , T )
 rh = wrf_rh( QVAPOR, P, tk )
 delete_VarAtts(T,(/"description","units"/))
 copy_VarAtts(T,rh)
 else
 ;; may be a met_em file - see if we can get RH
 if(isfilevar(nc_file,"RH")) then
 if ( time .eq. -1 ) then
 if(ISFILE) then
 rh = nc_file->RH
 else
 rh = file_handle[:]->RH
 end if
 else
 if(ISFILE) then
 rh = nc_file->RH(time_in,:,:,:)
 else
 rh = file_handle[:]->RH(time_in,:,:,:)
 end if
 end if
 end if
 end if
 return(rh)
 end if
 
 
  {:eb513:}{:eb513:} | 
 |