爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 6791|回复: 3

ncl程序问题

[复制链接]
发表于 2015-4-2 11:07:07 | 显示全部楼层 |阅读模式

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

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

x
有哪位大神可以帮忙看看嘛,程序一直提示有错误,很急,很急,在线等,跪求回复

tpsnow.ncl

3.36 KB, 下载次数: 6, 下载积分: 金钱 -5

ncl

密码修改失败请联系微信:mofangbao
发表于 2015-4-2 11:10:19 | 显示全部楼层
代码直接贴,错误截图上传!
密码修改失败请联系微信:mofangbao
 楼主| 发表于 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
密码修改失败请联系微信:mofangbao
发表于 2015-4-2 13:03:48 | 显示全部楼层
dannybear 发表于 2015-4-2 11:38
好的,不好意思
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"  
load "$NCARG_ROOT/lib/nc ...

contributed.ncl的12378行是用systemfunc调用系统date命令,出错原因不好说。
先把程序里的obj_anal_ic_deprecated替换为obj_anal_ic或obj_anal_ic_Wrap试试看。
密码修改失败请联系微信:mofangbao
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

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

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