爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 10801|回复: 7

[其他] 关于NCL 提取wrfout的数值问题

[复制链接]

新浪微博达人勋

发表于 2014-5-11 21:53:28 | 显示全部楼层 |阅读模式

登录后查看更多精彩内容~

您需要 登录 才可以下载或查看,没有帐号?立即注册 新浪微博登陆

x
我通过插值函数把它插出各个高度,然后我想把各个高度的温度数值度出来,但写出来后缺测值那都是**********   不知道怎么弄     
想向大家请教下   
下面是我的代码
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"

begin
a = addfile("wrfout_d03_2012-11-04_07:00:00","r")
time = -1
y1=0
y2=185
y3=186
x1=0
x2=254
x3=255
  tc = wrf_user_getvar(a,"tc",time)       ; T [C]
  p  = wrf_user_getvar(a,"pressure",time) ; total pressure

; The specific pressure levels that we want the data interpolated to.
  pressure_levels = (/900.,875.,850.,825.,800.,775.,750.,700.,650.,600.,550.,500.,450.,400.,350.,300.,250.,200.,150.,100./)   ; pressure levels to plot
  nlevels         = dimsizes(pressure_levels)     ; number of pressure levels

  do level = 0,nlevels-1                 ; LOOP OVER LEVELS
   pressure = pressure_levels(level)
   tc_plane = wrf_user_intrp3d(tc,p,"h",pressure,0.,False)

   if ( pressure .eq. 900) then
   f=tc_plane(:,y1:y2,x1:x2)
   f2=onedtond(f,(/y3,x3/))
   fmtf = "255f7.2"
   opt=True
   opt@fout = "D02-900.txt"
   write_matrix (f2, fmtf, opt)

   end if

   if ( pressure .eq. 875 ) then
   f=tc_plane(:,y1:y2,x1:x2)
   f2=onedtond(f,(/y3,x3/))
   fmtf = "255f7.2"
   opt=True
   opt@fout = "D02-875.txt"
   write_matrix (f2, fmtf, opt)

   end if

   if ( pressure .eq. 850 ) then
   f=tc_plane(:,y1:y2,x1:x2)
   f2=onedtond(f,(/y3,x3/))
   fmtf = "255f7.2"
   opt=True
   opt@fout = "D02-850.txt"
   write_matrix (f2, fmtf, opt)

   end if

   if ( pressure .eq. 825 ) then
   f=tc_plane(:,y1:y2,x1:x2)
   f2=onedtond(f,(/y3,x3/))
   fmtf = "255f7.2"
   opt=True
   opt@fout = "D02-825.txt"
   write_matrix (f2, fmtf, opt)

   end if

   if ( pressure .eq. 800 ) then
   f=tc_plane(:,y1:y2,x1:x2)
   f2=onedtond(f,(/y3,x3/))
   fmtf = "255f7.2"
   opt=True
   opt@fout = "D02-800.txt"
   write_matrix (f2, fmtf, opt)

   end if

   if ( pressure .eq. 775 ) then
   f=tc_plane(:,y1:y2,x1:x2)
   f2=onedtond(f,(/y3,x3/))
   fmtf = "255f7.2"
   opt=True
   opt@fout = "D02-775.txt"
   write_matrix (f2, fmtf, opt)

   end if

   if ( pressure .eq. 750 ) then
   f=tc_plane(:,y1:y2,x1:x2)
   f2=onedtond(f,(/y3,x3/))
   fmtf = "255f7.2"
   opt=True
   opt@fout = "D02-750.txt"
   write_matrix (f2, fmtf, opt)

   end if

   if ( pressure .eq. 700 ) then
   f=tc_plane(:,y1:y2,x1:x2)
   f2=onedtond(f,(/y3,x3/))
   fmtf = "255f7.2"
   opt=True
   opt@fout = "D02-700.txt"
   write_matrix (f2, fmtf, opt)

   end if

   if ( pressure .eq. 650 ) then
   f=tc_plane(:,y1:y2,x1:x2)
   f2=onedtond(f,(/y3,x3/))
   fmtf = "255f7.2"
   opt=True
   opt@fout = "D02-650.txt"
   write_matrix (f2, fmtf, opt)

   end if

   if ( pressure .eq. 600 ) then
   f=tc_plane(:,y1:y2,x1:x2)
   f2=onedtond(f,(/y3,x3/))
   fmtf = "255f7.2"
   opt=True
   opt@fout = "D02-600.txt"
   write_matrix (f2, fmtf, opt)

   end if

   if ( pressure .eq. 550 ) then
   f=tc_plane(:,y1:y2,x1:x2)
   f2=onedtond(f,(/y3,x3/))
   fmtf = "255f7.2"
   opt=True
   opt@fout = "D02-550.txt"
   write_matrix (f2, fmtf, opt)

   end if

   if ( pressure .eq. 500 ) then
   f=tc_plane(:,y1:y2,x1:x2)
   f2=onedtond(f,(/y3,x3/))
   fmtf = "255f7.2"
   opt=True
   opt@fout = "D02-500.txt"
   write_matrix (f2, fmtf, opt)

   end if

   if ( pressure .eq. 450 ) then
   f=tc_plane(:,y1:y2,x1:x2)
   f2=onedtond(f,(/y3,x3/))
   fmtf = "255f7.2"
   opt=True
   opt@fout = "D02-450.txt"
   write_matrix (f2, fmtf, opt)

   end if

   if ( pressure .eq. 400 ) then
   f=tc_plane(:,y1:y2,x1:x2)
   f2=onedtond(f,(/y3,x3/))
   fmtf = "255f7.2"
   opt=True
   opt@fout = "D02-400.txt"
   write_matrix (f2, fmtf, opt)

   end if

   if ( pressure .eq. 350 ) then
   f=tc_plane(:,y1:y2,x1:x2)
   f2=onedtond(f,(/y3,x3/))
   fmtf = "255f7.2"
   opt=True
   opt@fout = "D02-350.txt"
   write_matrix (f2, fmtf, opt)

   end if

   if ( pressure .eq. 300 ) then
   f=tc_plane(:,y1:y2,x1:x2)
   f2=onedtond(f,(/y3,x3/))
   fmtf = "255f7.2"
   opt=True
   opt@fout = "D02-300.txt"
   write_matrix (f2, fmtf, opt)

   end if

   if ( pressure .eq. 250 ) then
   f=tc_plane(:,y1:y2,x1:x2)
   f2=onedtond(f,(/y3,x3/))
   fmtf = "255f7.2"
   opt=True
   opt@fout = "D02-250.txt"
   write_matrix (f2, fmtf, opt)

   end if

   if ( pressure .eq. 200 ) then
   f=tc_plane(:,y1:y2,x1:x2)
   f2=onedtond(f,(/y3,x3/))
   fmtf = "255f7.2"
   opt=True
   opt@fout = "D02-200.txt"
   write_matrix (f2, fmtf, opt)

   end if

   if ( pressure .eq. 150 ) then
   f=tc_plane(:,y1:y2,x1:x2)
   f2=onedtond(f,(/y3,x3/))
   fmtf = "255f7.2"
   opt=True
   opt@fout = "D02-150.txt"
   write_matrix (f2, fmtf, opt)

   end if

   if ( pressure .eq. 100 ) then
   f=tc_plane(:,y1:y2,x1:x2)
   f2=onedtond(f,(/y3,x3/))
   fmtf = "255f7.2"
   opt=True
   opt@fout = "D02-100.txt"
   write_matrix (f2, fmtf, opt)

   end if

  end do
end


密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2014-5-11 22:10:08 | 显示全部楼层
你可以在里面print看一下,不过你这个写的太繁琐了 也没必要输出来啊
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2014-5-11 22:10:14 | 显示全部楼层
你可以在里面print看一下,不过你这个写的太繁琐了 也没必要输出来啊
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2015-11-18 09:15:23 | 显示全部楼层
楼主厉害,加油
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2016-1-7 10:06:29 | 显示全部楼层
{:lxm_24:}
密码修改失败请联系微信:mofangbao
回复

使用道具 举报

新浪微博达人勋

发表于 2016-2-16 16:16:37 | 显示全部楼层
好厉害的样子
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2016-6-28 21:37:02 | 显示全部楼层
马克一下!
密码修改失败请联系微信:mofangbao
回复

使用道具 举报

新浪微博达人勋

发表于 2016-7-21 18:56:29 | 显示全部楼层
{:eb513:}{:eb513:}{:eb513:}
密码修改失败请联系微信:mofangbao
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册 新浪微博登陆

本版积分规则

Copyright ©2011-2014 bbs.06climate.com All Rights Reserved.  Powered by Discuz! (京ICP-10201084)

本站信息均由会员发表,不代表气象家园立场,禁止在本站发表与国家法律相抵触言论

快速回复 返回顶部 返回列表