爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 9081|回复: 8

ncl绘制中国地图出错

[复制链接]

新浪微博达人勋

发表于 2016-10-17 23:26:40 | 显示全部楼层 |阅读模式

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

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

x
我是刚开始学的ncl,小白一个。绘制地图出现下面的错误不知道该怎么解决,求各位大神帮帮忙啊!!
ncl 0> ; ------------------------------------------
ncl 1> ; Script     : NCLproject1.ncl
ncl 2> ; Created on : 2016-10-16 22:48:41
ncl 3> ; Author     : la
ncl 4> ; ------------------------------------------
ncl 5> ; Description:
ncl 6> ;   Purpose of the script follows.
ncl 7> ; ------------------------------------------
ncl 8> ;load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
ncl 9> ;load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
ncl 10> ;load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
ncl 11> ;load "$NCARG_ROOT/lib/ncarg/nclscripts/cnmap/cnmap.ncl"
ncl 12> begin
ncl 13> f=addfile("pres.mon.ltm.nc","r")
ncl 14>
ncl 15> pres= f->pres(0,:,:)
ncl 16>
ncl 17> ;>=========================================================<
ncl 18>  wks       = gsn_open_wks("png","china_boundary")
ncl 19>  gsn_define_colormap( wks ,"gui_default")
ncl 20>
ncl 21>
ncl 22>  res                         = True
ncl 23>  res@tiMainString            ="china_map"
ncl 24>  res@gsnMaximize             = True
ncl 25>  res@gsnDraw                 = False
ncl 26>  res@gsnFrame                = False
res@mpLandFillColor         = "white"
res@mpInlandWaterFillColor  = "white"
res@mpOceanFillColor        = "wncl 27> hite"
ncl 28> ;>--------------------------------------------<
ncl 29> ;            set for the map
ncl 30> ;>--------------------------------------------<
ncl 31>  res@mpMinLatF               = 17.
ncl 32>  res@mpMaxLatF               = 55.
ncl 33>  res@mpMinLonF               = 72.
ncl 34>  res@mpMaxLonF               = 136.
ncl 35>
ncl 36>  res@mpFillOn                = True
ncl 37>  res@mpOutlineOn             = False  ; Use outlines from shapefile
ncl 38>  res@cnFillDrawOrder         = "PreDraw"
ncl 39>  res@mpDataBaseVersion       = "MediumRes"
ncl 40>  res@mpDataSetName           = "Earth..4"
ncl 41>  res@mpAreaMaskingOn         = True
ncl 42>  res@mpMaskAreaSpecifiers    = (/"China","Taiwan","Disputed area between India and China","India:Arunachal Pradesh"/)
ncl 43>  res@mpLandFillColor         = "white"
ncl 44>  res@mpInlandWaterFillColor  = "white"
ncl 45>  res@mpOceanFillColor        = "white"
ncl 46>  res@mpOutlineBoundarySets   = "NoBoundaries"
ncl 47> ;>--------------------------------------------<
ncl 48> ;set for the plot
ncl 49>
ncl 50>  res@cnFillOn                = True
ncl 51>
ncl 52> res@cnLinesOn               = False
ncl 53>
ncl 54> res@cnLevelSpacingF         = 20.
ncl 55>
ncl 56> res@gsnSpreadColors         = True
ncl 57>
ncl 58> res@lbLabelAutoStride       = True
ncl 59>  map=gsn_csm_contour_map(wks,pres,res)
ncl 60> ;>============================================================<
ncl 61> ;                      add China map
ncl 62> ;>------------------------------------------------------------<
ncl 63>
ncl 64> cnres           = True
ncl 65>  cnres@china     = True       ;draw china map or not
ncl 66>  cnres@river     = True       ;draw changjiang&huanghe or not
ncl 67>  cnres@province  = True       ;draw province boundary or not
ncl 68>  cnres@nanhai    = True       ;draw nanhai or not
ncl 69>
ncl 70> cnres@diqu      = False       ; draw diqujie or not
ncl 71>
ncl 72> chinamap = add_china_map(wks,map,cnres)
ncl 73> ;>============================================================<
ncl 74>
ncl 75>
ncl 76> draw(map)
ncl 77> frame(wks)
ncl 78> end
fatal:Undefined identifier: (add_china_map) is undefined, can't continue
fatal:["Execute.c":8576]:Execute: Error occurred at or near line 72

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

新浪微博达人勋

发表于 2016-10-17 23:28:52 | 显示全部楼层
你把 ;load "$NCARG_ROOT/lib/ncarg/nclscripts/cnmap/cnmap.ncl"注释了,还怎么用add_china_map
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2016-10-18 07:50:16 来自手机 | 显示全部楼层
把前几行打开
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2016-10-18 12:54:01 | 显示全部楼层
andrewsoong 发表于 2016-10-17 23:28
你把 ;load "$NCARG_ROOT/lib/ncarg/nclscripts/cnmap/cnmap.ncl"注释了,还怎么用add_china_map

那现在这种状况呢 怎么搞啊?
捕获.PNG
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2018-3-19 19:33:49 | 显示全部楼层
英英茵 发表于 2016-10-18 12:54
那现在这种状况呢 怎么搞啊?

想请教一下,怎么在这个编辑器上弄NCL
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2018-3-20 13:06:25 | 显示全部楼层
Volan 发表于 2018-3-19 19:33
想请教一下,怎么在这个编辑器上弄NCL

我换了sublime text 感觉比那个好用
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2018-4-4 16:01:40 | 显示全部楼层
英英茵 发表于 2018-3-20 13:06
我换了sublime text 感觉比那个好用

啊。。好吧。。我觉得在IDE上是不是可以直接运行什么的
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2023-3-13 11:55:20 | 显示全部楼层
请问答主最后解决了吗?我这里显示could not open load "$NCARG_ROOT/lib/ncarg/nclscripts/cnmap/cnmap.ncl"
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

新浪微博达人勋

发表于 2023-6-11 23:14:23 | 显示全部楼层
zhangbella 发表于 2023-3-13 11:55
请问答主最后解决了吗?我这里显示could not open load "$NCARG_ROOT/lib/ncarg/nclscripts/cnmap/cnmap.nc ...

我也是这个问题 想问一下解决了吗 怎么解决的呢
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

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