- 积分
- 16060
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2013-5-7
- 最后登录
- 1970-1-1
|
发表于 2014-4-12 14:16:59
|
显示全部楼层
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;本段代码用来显示指定的经纬度在计算网格中最近的点的编号和经纬度
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
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"
;上边是写ascii文件需要导入的脚本文件
begin
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; 输入文件
; 读入一个nc文件。如下:(注意:需要补充好文件类型,否则不识别)
a = addfile("3.nc","r")
;读取数据
T2=wrf_user_getvar(a,"T2",-1) ;-1取全部数据 ;slp是sea level pressure海平面气压
times = wrf_user_getvar(a,"times",-1)
xlat=wrf_user_getvar(a,"XLAT",0)
xlon=wrf_user_getvar(a,"XLONG",0)
locationij=wrf_user_ll_to_ij(a,121.95,29.2,True); ;此命令返回给定的(纬度,经度)对应的最近的节点坐标:网格意义上的(i,j)
;print(locationij)
lonlat=wrf_user_ij_to_ll(a,locationij(0),locationij(1),True); ;此命令返回给定的节点坐标对应的(纬度,经度)
print(lonlat)
;xx=xlat(locationij(1)-1,locationij(0)-1) ;注意ij坐标到编号的转换,需要-1
;print(xx)
t=T2(:,locationij(1)-1,locationij(0)-1)
print(t)
asciiwrite("jwd.txt",t)
end
|
|