爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 10750|回复: 4

[作图] 又是南海作图问题

[复制链接]
回帖奖励 2 金钱 回复本帖可获得 2 金钱奖励! 每人限 1 次

新浪微博达人勋

发表于 2019-12-24 09:20:13 | 显示全部楼层 |阅读模式

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

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

x
关于南海区域作图的颜色和大陆地区不同的情况我之前已经发问了,并且在下面的链接中得到解决http://bbs.06climate.com/forum.php?mod=viewthread&tid=93697但是现在又出新状况了呜呜呜,同一个问题,上次的办法不管用了。代码就是兰溪大神的代码,几乎没有改动,不知道为啥现在又不行了
SPEI_ave_1986-2005.png

-----------下面是代码----------
  f=addfile("CN05.1_SPEI_1961_2017_month_025x025.nc","r")
  spei= f->SPEI12(301:540,:,:)
  SPEI=dim_avg_n_Wrap(spei,0)
;---------------------------------------------------------------
  wks = gsn_open_wks("png","SPEI_ave_1986-2005")
  cmap = read_colormap_file("NCV_blue_red")
  
  res                            = True            
  res@gsnMaximize                = True
  res@gsnDraw                    = False
  res@gsnFrame                   = False
  res@gsnAddCyclic         = False        ; plotted dataa are not cyclic
  res@cnFillPalette          = cmap(30:,:)
;---------------------------------------------------------------
; set for the map
  res@mpMinLatF                  = 0.                        
  res@mpMaxLatF                  = 55.
  res@mpMinLonF                  = 72.
  res@mpMaxLonF                  = 136.
   
  res@mpFillOn                   = True
  res@mpDataSetName              = "./database/Earth..4"
  res@mpDataBaseVersion          = "MediumRes" ; or "Ncarg4_1"
  res@mpAreaMaskingOn            = True
  res@mpMaskAreaSpecifiers       = (/"China"/)
  res@mpOutlineSpecifiers        = (/"China","China:Provinces"/)
   
  res@mpLandFillColor            = "white"
  res@mpInlandWaterFillColor     = "white"
  res@mpOceanFillColor           = "white"
  res@mpFillBoundarySets         = "NoBoundaries"
  res@mpOutlineBoundarySets      = "NoBoundaries"
  res@mpNationalLineColor        = "black"
  res@mpProvincialLineColor      = "black"
  res@mpGeophysicalLineColor     = "black"
  res@mpNationalLineThicknessF   = 2
  res@mpProvincialLineThicknessF = 1
;---------------------------------------------------------------
; set for the plot
  res@cnFillOn                   = True
  res@cnFillDrawOrder            = "PreDraw"
  res@cnLinesOn                  = False
  res@cnLineLabelsOn             = False
  res@cnLevelSelectionMode       = "ExplicitLevels"
  res@cnLevels                   = fspan(-1,1,11)
  res@lbLabelAutoStride          = True
  res@pmTickMarkDisplayMode      = "Always"
;---------------------------------------------------------------
; plot one part of China map with South China Sea subplot
  res@mpMinLatF                  = 17.
  res@gsnLeftString              = "SPEI"
  map1 = gsn_csm_contour_map(wks,SPEI,res)
;--- add South China Sea ---
  nhres                          = True
  nhres@gsnFrame                 = False
  nhres@gsnDraw                  = False
      
  nhres@gsnAddCyclic             = False
  nhres@vpHeightF                = 0.18   
  nhres@vpWidthF                 = 0.18
   
  nhres@mpMinLatF                =   2.0   
  nhres@mpMaxLatF                =  23.0
  nhres@mpMinLonF                = 105.0
  nhres@mpMaxLonF                = 123.0
  getvalues map1
    "mpDataSetName"              : nhres@mpDataSetName
    "mpDataBaseVersion"          : nhres@mpDataBaseVersion
    "mpFillOn"                   : nhres@mpFillOn
    "mpFillDrawOrder"            : nhres@mpFillDrawOrder
    "mpAreaMaskingOn"            : nhres@mpAreaMaskingOn
    "mpMaskAreaSpecifiers"       : nhres@mpMaskAreaSpecifiers
    "mpOutlineSpecifiers"        : nhres@mpOutlineSpecifiers
    "mpOutlineBoundarySets"      : nhres@mpOutlineBoundarySets
    "mpLandFillColor"            : nhres@mpLandFillColor      
    "mpOceanFillColor"           : nhres@mpOceanFillColor      
    "mpInlandWaterFillColor"     : nhres@mpInlandWaterFillColor
    "mpNationalLineColor"        : nhres@mpNationalLineColor   
    "mpProvincialLineColor"      : nhres@mpProvincialLineColor
  end getvalues
  getvalues map1@contour
    "cnFillOn"                   : nhres@cnFillOn
    "cnLevelSelectionMode"       : nhres@cnLevelSelectionMode
    "cnLevels"                   : nhres@cnLevels
    "cnFillColors"               : nhres@cnFillColors
    "cnFillDrawOrder"            : nhres@cnFillDrawOrder
    "cnLinesOn"                  : nhres@cnLinesOn
    "cnLineLabelsOn"             : nhres@cnLineLabelsOn
  
  end getvalues
  nhres@lbLabelBarOn             = False
  nhres@tmXBOn                   = False
  nhres@tmYLOn                   = False
  nhres@tmYROn                   = False
  nhres@tmXTOn                   = False
  nhres@gsnLeftString            = ""
  nhres@gsnRightString           = ""
  map_nanhai = gsn_csm_contour_map(wks,SPEI,nhres)
  adres                          = True
  adres@amParallelPosF           = 0.5 ; -0.5 is the left edge of the plot.
  adres@amOrthogonalPosF         = 0.5  ; -0.5 is the top edge of the plot.
  adres@amJust                   = "BottomRight"
  plotnh = gsn_add_annotation(map1,map_nanhai,adres)
  draw(map1)
  frame(wks)


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

新浪微博达人勋

发表于 2021-10-26 16:49:22 | 显示全部楼层

回帖奖励 +2 金钱

建议把getvalues 这部分直接拿nhres=res代替
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

新浪微博达人勋

发表于 2022-3-20 22:34:32 | 显示全部楼层

回帖奖励 +2 金钱

请问楼主解决了没?
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

新浪微博达人勋

发表于 2022-8-16 19:01:25 | 显示全部楼层

回帖奖励 +2 金钱

请问下,我用添加南海的代码,没画出来九段线,是什么原因呢
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

新浪微博达人勋

发表于 2023-11-7 11:09:24 | 显示全部楼层

回帖奖励 +2 金钱

楼主,请问南海区域小图如何设置大小
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

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