爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 3677|回复: 7

在ncl中怎样加载中国地图

[复制链接]

新浪微博达人勋

发表于 2020-3-10 17:18:34 | 显示全部楼层 |阅读模式
GrADS
系统平台:
问题截图: -
问题概况: 在ncl中怎样加载出中国地图,要有明确省分界线的那种
我看过提问的智慧: 没看过(看完再来提问)
自己思考时长(天): 7

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

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

x

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

新浪微博达人勋

发表于 2020-3-10 19:57:33 | 显示全部楼层
ncl自带的Earth..4数据集是包含中国省界的(Taiwan印象中好像是没有)
;----设定绘制区域
fill_area = (/"China: states"/)
res@mpDateBaseVesion = "MediumRes"
res@mpDateSetMame = "Earth..4"
res@mpOutlineOn = True
res@mpOutlineSpecifiers = fill_area ;指定绘制边界名称
.......
一般来说这样就可以但是我最近用的时候貌似6.4.0版本有Bug,Earth..4数据集的文件安装的时候有遗漏,如果不行的话建议gsn_add_shapefile_polylines函数试试,但是这个要自己去下载shp文件,包含中国省界的

密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

新浪微博达人勋

 楼主| 发表于 2020-3-11 17:13:21 | 显示全部楼层
一大碗年糕 发表于 2020-3-10 19:57
ncl自带的Earth..4数据集是包含中国省界的(Taiwan印象中好像是没有)
;----设定绘制区域
fill_area = ( ...

那画的如果是大范围的图,但我只要中国的具体地图呢?
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

新浪微博达人勋

发表于 2020-3-11 17:24:48 | 显示全部楼层
方莹红 发表于 2020-3-11 17:13
那画的如果是大范围的图,但我只要中国的具体地图呢?

?specifiers这个里面设置好就应该是只有中国的了呀
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

新浪微博达人勋

 楼主| 发表于 2020-3-11 19:34:30 | 显示全部楼层
一大碗年糕 发表于 2020-3-11 17:24
?specifiers这个里面设置好就应该是只有中国的了呀

warning:MapV40DHUpdateDrawList: invalid boundary specification string: "china: s    tates"
warning:mpDateBaseVesion is not a valid resource in map at this time
warning:mpDateSetMame is not a valid resource in map at this time


我按照你回复我的,试了一下,然后就得到了这个警告。我把我代码发你看一下行吗?谢谢大佬


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"
  load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/diagnostics_cam.ncl"
  begin
  ;================read
f1= addfile("d:/changshui/1800.pressure.nc","r")
f2= addfile("d:/changshui/1800uv.nc","r")
f3= addfile("d:/changshui/1800.2m.t.nc","r")

sp=short2flt(f1->sp(28,:,:))
sp1=sp
sp1=sp/100
t2m=short2flt(f3->t2m(28,:,:))
t2m_1=t2m
t2m_1=t2m-273.15
u10=short2flt(f2->u10(28,:,:))
v10=short2flt(f2->v10(28,:,:))
;printVarSummary(t2m)
time=f1->time
tim= cd_calendar(time,-1)
;print(tim)
;printVarSummary(hgt)
;exit
;printMinMax (t2m, False)
;=================================================================plot
wks = gsn_open_wks("eps","dimian")
res0                   = True
res0@tiMainString     = " dimian"
;res0@gsnLeftString     = "sp"
res0@gsnRightString    = "Wind"
res0@gsnDraw            =False
res0@gsnFrame          =False  
res0@mpFillOn     = False
res0@mpOutlineOn  = True
res0@mpMinLonF         = 80
res0@mpMaxLonF         = 110
res0@mpMinLatF         =10
res0@mpMaxLatF         = 44.75
res0@gsnAddCyclic      =False
res0@cnLineThicknessF  =3
;res0@cnFillOn           = True
res0@cnLevelSelectionMode = "ManualLevels"
;res0@cnLineLabelInterval   = 1
res0@cnLevelSpacingF     =20


fill_area = (/"China: states"/)
res0@mpDateBaseVesion = "MediumRes"
res0@mpDateSetMame = "Earth..4"
res0@mpOutlineOn = True
res0@mpOutlineSpecifiers = fill_area

plot=gsn_csm_contour_map_ce(wks,sp1,res0)

;===============================================================res
res                      = True               ; plot mods desired
res@gsnDraw            =False
res@gsnFrame          =False
res@vcRefMagnitudeF           = 6.5             ; define vector ref mag
res@vcRefLengthF              =  0.035   ; define length of vec
res@vcRefAnnoOrthogonalPosF   = -1.2  
res@vcRefAnnoArrowLineColor   = "purple"         ; change ref vector color
res@vcRefAnnoArrowUseVecColor = False           ; don't use vec color for ref
res@vcMinDistanceF           = 0.03          ; thin vectors
res@vcLineArrowColor        = "purple"           ; change vector color
res@vcLineArrowThicknessF   =2.0              ; change vector thickness
res@vcLineArrowHeadMaxSizeF=0.01
res@vcRefAnnoString2On     =True
res@vcRefAnnoString2       ="m/s"

res@gsnLeftString     = ""
res@gsnRightString    = ""
plot1=gsn_csm_vector(wks,u10,v10,res)
overlay(plot,plot1)

res2     =True
res2@gsnDraw  =False
res2@gsnFrame  =False
res2@cnFillOn =True
res2@cnLineThicknessF  =1.5
res2@gsnRightString  ="~F35~J~F~C"
res2@cnLevelSelectionMode = "ManualLevels"
res2@cnLevelSpacingF     = 4
res2@cnFillColor ="red"
plot2=gsn_csm_contour(wks, t2m_1, res2)
overlay(plot, plot2)

draw(plot)    ; This will draw everything
frame(wks)

               
end
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

新浪微博达人勋

发表于 2020-3-13 10:41:59 | 显示全部楼层
方莹红 发表于 2020-3-11 19:34
warning:MapV40DHUpdateDrawList: invalid boundary specification string: "china: s    tates"
warnin ...

可能还是Earth..4这个数据集有问题,我也是这样,那还是试试看gsn_add_shapefile_polylines函数试试
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

新浪微博达人勋

发表于 2020-3-17 15:31:37 | 显示全部楼层
res0@mpDateSetMame = "Earth..4"  
你这个用绝对路径试试。直接这样引用我也出现问题,比如这样 /mnt/d/ncl6.6/lib/ncarg/database/Earth..4
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

新浪微博达人勋

 楼主| 发表于 2020-3-19 10:10:38 | 显示全部楼层
t_imba 发表于 2020-3-17 15:31
res0@mpDateSetMame = "Earth..4"  
你这个用绝对路径试试。直接这样引用我也出现问题,比如这样 /mnt/d/n ...

怎样查看自己电脑下这个Earth..4文件的绝对路径啊
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

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