- 积分
- 2302
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2015-3-27
- 最后登录
- 1970-1-1
|

楼主 |
发表于 2015-4-2 11:38:15
|
显示全部楼层
好的,不好意思
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/csm/contributed.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
begin
yrStrt=1
yrLast=575
;读取经纬度
filelat="lat.txt"
lat= asciiread(filelat,(/317/),"float")
filelon="lon.txt"
lon= asciiread(filelon,(/317/),"float")
; print(lon)
nt=575
fr="tpsnow.grd"
r= fbindirread(fr,0,(/nt,317/),"float")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;首先创建存放差值后生成数据的数组 根据青藏高原的经纬度而定北纬20-45,东经60-105这个矩形框内插值
olon = new(46,"float");
olat = new(26,"float");
data = new((/nt,26,46/),"float")
do i=0,45
olon(i) =60+i
end do
do l=0,25
olat(l) = 20+l
end do
;接下来设置数组属性,为了符合netcdf规定的数据格式,使函数能够识别经纬度
olon!0 = "lon"
olon@long_name = "lon"
olon@units = "degrees-east"
olon&lon = olon
olat!0 = "lat"
olat@long_name = "lat"
olat@units = "degrees_north"
olat&lat = olat
path = "zh2"
;最后调用插值函数
r@_FillValue = -999.0
do i=0,nt-1
rscan = (/10,5,3/) ;连续的有效半径大小,最大为10,依次递减
data(i,:,:)=obj_anal_ic_deprecated(lon,lat,r(i,:),olon,olat,rscan, False) ;Creanm插值
fbindirwrite(path,data(i,:,:))
end do
printVarSummary(data)
;print(data(2:,1,1));1967之后
data!0="time"
data&time=ispan(yrStrt,yrLast,1 )
;ddata=dtrend_msg_n(data&time,data,True,False,0)去趋势
;copy_VarCoords(data,ddata)
;copy_VarMeta(data,ddata)
;ddata!0="time"
;ddata&time=ispan(yrStrt,yrLast,1 )
;data!1="lat"
;ccr=escorc(ddata(lat|:,lon|:,time|:),dsam)
;copy_VarCoords(data(5,:,:),ccr)
;copy_VarMeta(data(5,:,:),ccr)
;做出196701-201312时间段的每月平均
avemon=clmMonTLL(data(2:565,:,:))
;计算冬季平均
winterave=month_to_season(avemon,"DJF")
printVarSummary(winterave)
;SPRING AVE
springave=month_to_season(avemon,"MAM")
printVarSummary(springave)
;设置地图颜色
wks=gsn_open_wks("ps","snow")
gsn_define_colormap(wks,"rainbow")
;设置地图属性,对等值线填充进行基本设置
res=True
res@cnFillOn=True
res@cnLineOn=False
res@cnLineLablelsOn=False
res@cnFillDrawOder="PreDraw"
res@cnLevelSelectionMode="ExplicitLevels"
res@lbLabelBaron=True
;地图的范围
res@gsnAddCyclic=False
res@mpDataSetName="Earth..4"
res@mpDataBaseVersion="MediumRes"
res@mpOutlineOn=True
res@mpOutlineSpecifiers=(/"China:states"/)
;缩小区域
res@mpMinLatF=10
res@mpMaxLatF=55
res@mpMinLonF=50
res@mpMaxLonF=115
;加粗边界
res@mpGeophysicalLineThicknessF=2
res@mpNationalLineThicknessF=2
;使用兰伯特投影
res@mpProjection="LambertConformal"
res@mpLambertMeridianF=83.5
res@mpLimitMode="LatLon"
res@mpLambertParallel1F=0.001
res@mpLambertParallel2F=89.999
;将填充区域设置为青藏高原内部
res@mpAreaMaskingOn=True
res@mpMaskAreaSpecifiers=(/"China:states"/)
res@mpInlandWaterFillColor=0
;生成图片标题
res@tiMainFont="helvetica"
res@tiMainOffsetYF=0.02
res@tiMainFontHeightF=0.02
res@tiMainString="tpsnow"
plot=gsn_csm_contour_map(wks,springave,res)
end
显示的错误为:
$ ncl tpsnow.ncl
Copyright (C) 1995-2014 - All Rights Reserved
University Corporation for Atmospheric Research
NCAR Command Language Version 6.2.1
The use of this software is governed by a License Agreement.
See http://www.ncl.ucar.edu/ for more details.
1 [main] ncl 7768 fork: child -1 - CreateProcessW failed for 'D:\cygwin\app\ncl\bin\ncl.exe', errno 13
fatal:systemfunc: cannot create child process:[errno=13]
fatal:["Execute.c":8578]:Execute: Error occurred at or near line 12378 in file $NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl
fatal:["Execute.c":8578]:Execute: Error occurred at or near line 51 in file tpsnow.ncl
|
|