爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 10240|回复: 6

[求助] ncl怎么把海洋设置为蓝色

[复制链接]

新浪微博达人勋

发表于 2020-3-11 16:55:02 | 显示全部楼层 |阅读模式

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

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

x
res@mpFillOn =   True ;False
  res@mpOutlineBoundarySets = "AllBoundaries"
  res@mpDataSetName         = "Earth..4"
  res@mpDataBaseVersion     = "MediumRes"          ; Default is LowRes
  res@mpOutlineDrawOrder    = "PostDraw"          ; Draw map outlines last
  res@mpOutlineOn           = True
  res@mpOutlineSpecifiers   = (/"China:states","Taiwan"/)
  res@mpAreaMaskingOn           = True
  res@mpOutlineDrawOrder    = "PostDraw"          ; Draw map outlines last
  res@mpFillAreaSpecifiers  = (/"water"/)
  res@mpSpecifiedFillColors = ("blue")

  res@mpGridAndLimbOn       = False                ; Turn off lat/lon lines
  res@pmTickMarkDisplayMode = "Always"             ; Turn on map tickmarks
  res = set_mp_wrf_map_resources(d1,res)
  res@mpLimitMode        = "Corners"               ; Portion of map to zoom
  res@mpLeftCornerLatF   = lat1(0,0)
  res@mpLeftCornerLonF   = lon1(0,0)
  res@mpRightCornerLatF  = lat1(ny1,nx1)
  res@mpRightCornerLonF  = lon1(ny1,nx1)

自己画的

自己画的

文献

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

新浪微博达人勋

发表于 2020-3-11 17:48:12 | 显示全部楼层

回帖奖励 +2 金钱

mpres@mpFillOn                    = True
mpres@mpFillAreaSpecifiers        = (/"water",       "land" /)
mpres@mpSpecifiedFillColors       = (/"skyblue1","white"/)
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

新浪微博达人勋

 楼主| 发表于 2020-3-11 22:34:13 | 显示全部楼层
小其其格 发表于 2020-3-11 17:48
mpres@mpFillOn                    = True
mpres@mpFillAreaSpecifiers        = (/"water",       "land ...

你好,但是还是没成功,可以帮我看下是不是其他设置出了问题

res                 = True

; Set some contouring resources.
  ;cmap     := read_colormap_file("OceanLakeLandSnow")
  ;cmap(0,:) = (/0,0,0,0/)    ; make first color fully transparent
  res@cnFillOn        = True
res@cnLinesOn       = False
  res@cnLineLabelsOn  = False
  res@cnInfoLabelOn   = False
  res@gsnSpreadColors = True
  res@cnLevelSelectionMode = "ExplicitLevels"
  res@cnLevels             = (/0,10, 20, 50,100, 200, 300, 500, 700, \
                                900,1000, 1300/)
  res@cnFillPalette = "OceanLakeLandSnow"
  res@gsnLeftString = ""
  res@gsnRightString = ""

  res@gsnDraw         = False
  res@gsnFrame        = False
; Add map resources
  res@mpFillOn =   True ;False
  res@mpOutlineBoundarySets = "AllBoundaries"
  res@mpDataSetName         = "Earth..4"
  res@mpDataBaseVersion     = "MediumRes"          ; Default is LowRes
  res@mpOutlineDrawOrder    = "PostDraw"          ; Draw map outlines last
  res@mpOutlineOn           = True
  res@mpOutlineSpecifiers   = (/"China:states","Taiwan"/)
  res@mpAreaMaskingOn           = True
  res@mpFillOn                    = True
  res@mpFillAreaSpecifiers        = (/"water",       "land" /)
  res@mpSpecifiedFillColors       = (/"skyblue1","white"/)
; res@mpOutlineDrawOrder    = "PostDraw"          ; Draw map outlines last


  res@mpGridAndLimbOn       = False                ; Turn off lat/lon lines
  res@pmTickMarkDisplayMode = "Always"             ; Turn on map tickmarks
  res = set_mp_wrf_map_resources(d1,res)
  res@mpLimitMode        = "Corners"               ; Portion of map to zoom
  res@mpLeftCornerLatF   = lat1(0,0)
  res@mpLeftCornerLonF   = lon1(0,0)
  res@mpRightCornerLatF  = lat1(ny1,nx1)
  res@mpRightCornerLonF  = lon1(ny1,nx1)

; Add label bar resources
  res@lbLabelAutoStride = True
  res@gsnMaximize     = True    ; Maximize plot in frame


  res2@lbLabelBarOn = False  ; Labelbar already created in 1st plot
  res2@gsnMaximize  = False  ; Use maximization from original plot
; Add map resources
  res@mpFillOn =   True ;False
  res@mpOutlineBoundarySets = "AllBoundaries"
  res@mpDataSetName         = "Earth..4"
  res@mpDataBaseVersion     = "MediumRes"          ; Default is LowRes
  res@mpOutlineDrawOrder    = "PostDraw"          ; Draw map outlines last
  res@mpOutlineOn           = True
  res@mpOutlineSpecifiers   = (/"China:states","Taiwan"/)
  res@mpAreaMaskingOn           = True
  res@mpFillOn                    = True
  res@mpFillAreaSpecifiers        = (/"water",       "land" /)
  res@mpSpecifiedFillColors       = (/"skyblue1","white"/)
; res@mpOutlineDrawOrder    = "PostDraw"          ; Draw map outlines last


  res@mpGridAndLimbOn       = False                ; Turn off lat/lon lines
  res@pmTickMarkDisplayMode = "Always"             ; Turn on map tickmarks
  dom_rank = dimsizes(dom_dims)
  nx2 = dom_dims(dom_rank - 1) - 1
  ny2 = dom_dims(dom_rank - 2) - 1


  res                 = True

; Set some contouring resources.
  ;cmap     := read_colormap_file("OceanLakeLandSnow")
  ;cmap(0,:) = (/0,0,0,0/)    ; make first color fully transparent
  res@cnFillOn        = True
res@cnLinesOn       = False
  res@cnLineLabelsOn  = False
  res@cnInfoLabelOn   = False
  res@gsnSpreadColors = True
  res@cnLevelSelectionMode = "ExplicitLevels"
  res@cnLevels             = (/0,10, 20, 50,100, 200, 300, 500, 700, \
                                900,1000, 1300/)
  res@cnFillPalette = "OceanLakeLandSnow"
  res@gsnLeftString = ""
  res@gsnRightString = ""

  res@gsnDraw         = False
  res@gsnFrame        = False

  res2 = res

; Add map resources
  res@mpFillOn =   True ;False
  res@mpOutlineBoundarySets = "AllBoundaries"
  res@mpDataSetName         = "Earth..4"
  res@mpDataBaseVersion     = "MediumRes"          ; Default is LowRes
  res@mpOutlineDrawOrder    = "PostDraw"          ; Draw map outlines last
  res@mpOutlineOn           = True
  res@mpOutlineSpecifiers   = (/"China:states","Taiwan"/)
  res@mpAreaMaskingOn           = True
  res@mpFillOn                    = True
  res@mpFillAreaSpecifiers        = (/"water",       "land" /)
  res@mpSpecifiedFillColors       = (/"skyblue1","white"/)
; res@mpOutlineDrawOrder    = "PostDraw"          ; Draw map outlines last


  res@mpGridAndLimbOn       = False                ; Turn off lat/lon lines
  res@pmTickMarkDisplayMode = "Always"             ; Turn on map tickmarks
  res = set_mp_wrf_map_resources(d1,res)
  res@mpLimitMode        = "Corners"               ; Portion of map to zoom
  res@mpLeftCornerLatF   = lat1(0,0)
  res@mpLeftCornerLonF   = lon1(0,0)
  res@mpRightCornerLatF  = lat1(ny1,nx1)
  res@mpRightCornerLonF  = lon1(ny1,nx1)

; Add label bar resources
  res@lbLabelAutoStride = True
  res@gsnMaximize     = True    ; Maximize plot in frame


  res2@lbLabelBarOn = False  ; Labelbar already created in 1st plot
  res2@gsnMaximize  = False  ; Use maximization from original plot

; we need these to later draw boxes for the location of the nest domain
  xbox_out = new(5,float)
  ybox_out = new(5,float)
  lnres = True
  lnres@gsLineThicknessF  = 1.5

; make images
  map = gsn_csm_contour_map(wks, var1, res)
  plot = gsn_csm_contour(wks, var2, res2)


; let's make 3 plots
; 1 - the mother domain only
; 2 - the mother and nest domains
; 3 - same as 2, but add a box around domain 2


; PLOT 1
  draw(map)
  frame(wks)

; PLOT 2
  overlay (map, plot)
  draw(map)
  frame(wks)

; PLOT 3
  draw(map)   ; domain 2 already overlaid here - so just draw again
  xbox = (/lon2(0,0),lon2(0,nx2),lon2(ny2,nx2),lon2(ny2,0),lon2(0,0)/)
  ybox = (/lat2(0,0),lat2(0,nx2),lat2(ny2,nx2),lat2(ny2,0),lat2(0,0)/)
  datatondc(map, xbox, ybox, xbox_out, ybox_out)
  gsn_polyline_ndc(wks, xbox_out, ybox_out, lnres)
  frame(wks)

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

使用道具 举报

新浪微博达人勋

发表于 2020-3-12 08:06:55 | 显示全部楼层
本帖最后由 小其其格 于 2020-3-12 08:08 编辑
yeraindrop 发表于 2020-3-11 22:34
你好,但是还是没成功,可以帮我看下是不是其他设置出了问题

res                 = True
我是这样画的,出图效果: wrf_overlay_doms.png
  1. ; Add map resources
  2.     res@mpDataSetName               = "Earth..4"
  3.     res@mpDataBaseVersion           = "MediumRes"
  4.     res@mpOutlineOn                 = True
  5.     res@mpOutlineSpecifiers         = (/"China:states","Taiwan","Xinjiang Uygur"/)
  6.     res@mpGeophysicalLineThicknessF = 2
  7.     res@mpNationalLineThicknessF    = 2
  8.     res@mpFillOn                    = True
  9.     res@mpFillAreaSpecifiers        = (/"water",       "land" /)
  10.     res@mpSpecifiedFillColors       = (/"skyblue1","white"/)
  11.     res@mpMaskAreaSpecifiers        = (/"China:states","Taiwan","Zhejiang"/)
  12.    
  13.     ;res@mpDataBaseVersion     = "MediumRes"          ; Default is LowRes
  14.     res@mpOutlineDrawOrder    = "PostDraw"           ; Draw map outlines last
  15.     res@mpGridAndLimbOn       = False                ; Turn off lat/lon lines
  16.     res@pmTickMarkDisplayMode = "Always"             ; Turn on map tickmarks
  17.     res = set_mp_wrf_map_resources(d1,res)
  18.     res@mpLimitMode        = "Corners"               ; Portion of map to zoom
  19.     res@mpLeftCornerLatF   = lat1(0,0)
  20.     res@mpLeftCornerLonF   = lon1(0,0)
  21.     res@mpRightCornerLatF  = lat1(ny1,nx1)
  22.     res@mpRightCornerLonF  = lon1(ny1,nx1)
复制代码

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

使用道具 举报

新浪微博达人勋

发表于 2020-3-12 08:11:37 | 显示全部楼层
yeraindrop 发表于 2020-3-11 22:34
你好,但是还是没成功,可以帮我看下是不是其他设置出了问题

res                 = True

貌似我的也不行,我没注意看……绘制阴影是把海洋的地形也一起算进去了,所以得不出效果,我再研究一下
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

新浪微博达人勋

 楼主| 发表于 2020-3-12 15:47:03 | 显示全部楼层
小其其格 发表于 2020-3-12 08:11
貌似我的也不行,我没注意看……绘制阴影是把海洋的地形也一起算进去了,所以得不出效果,我再研究一下

谢谢你,那可以通过改颜色来改吗?
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

新浪微博达人勋

发表于 2020-3-17 17:45:35 | 显示全部楼层
修改色标文件的值就行了
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

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