请选择 进入手机版 | 继续访问电脑版
爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 4818|回复: 2

有没有大神遇到netcdf格式的感热通量文件绘图出现白点,求指导,代码和图如下

[复制链接]

新浪微博达人勋

发表于 2022-6-13 20:47:36 | 显示全部楼层 |阅读模式

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

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

x
;load WRF ARW model data
;***********************************************
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/wrf/WRFUserARW.ncl"
;***********************************************
begin
;************************************************
; open file and read in data
;************************************************
  dir = "./"




  fn = systemfunc ("ls -1 " + dir + "202002"+".nc")

  in = addfiles (fn(:),"r")

  ListSetType(in,"cat")

  sshf1 = short2flt(in[:]->sshf(:,:,:))

  dim=dimsizes(sshf1)
  sshf1_ave = dim_avg_n_Wrap(sshf1,0)/3600
  ;print(sshf1_ave)


;


  wks_type = "png"

wks = gsn_open_wks(wks_type,"sshf202002")


  res                            = True
  res@gsnMaximize                = True
  res@gsnDraw                    = False
  res@gsnFrame                   = False
  res@tmBorderThicknessF         = 3.0


  res@mpMinLatF             =  15        ; Asia limits
  res@mpMaxLatF             =  53
  res@mpMinLonF             =  84
  res@mpMaxLonF             = 127

  res@cnLevelSelectionMode   = "ExplicitLevels"
  res@cnFillOn              = True
  res@cnLinesOn             = False          ;等值线不显示
  res@cnLineLabelsOn        = False
  res@cnFillDrawOrder       = "PreDraw"         ; draw contours first
  res@cnFillPalette         = "BlAqGrYeOrRe"     ;depth_qiu_02
  ;res@cnLevels = (/-130,-120,-110,-100,-90,-80,-70,-60,-50,-40,-30,-20,-10,0,10,20/)
;res@cnFillColors  = (/5,8,11,15,20,25,30,35,44,50,60,70,74,80,90,95,98,99/)
  res@lbLabelBarOn          = True       ;LabelBar显示
  res@tiMainOffsetYF        = 0.02  ;set place for main title along Y,offset
  res@tiMainFontHeightF     = 0.02   ;set main title font size
  res@tiMainString          = "SSHF"






  res@gsnAddCyclic          = False      ;由于我们的数据不是循环地球一周的,因此必须把这个置否
  res@mpDataSetName         = "/data1/pub_data/ncl_database/Earth..4"   ; This new database contains
  res@mpDataBaseVersion     = "MediumRes"  ; Medium resolution database
  res@mpOutlineOn           = True         ; Turn on map outlines
  res@mpOutlineSpecifiers   = (/"China","China:Provinces"/)       ;China:states
  res@mpFillBoundarySets    = "NoBoundaries"
  res@mpOutlineBoundarySets = "NoBoundaries"
  res@mpMaskAreaSpecifiers  = (/"China:states"/)
  res@mpAreaMaskingOn       = True   ;使能填充覆盖
  res@mpOceanFillColor      = 0     ;用白色填充海洋  0是colormap的索引值
  res@mpInlandWaterFillColor= 0  ;用白色填充内陆湖水
  res@mpGeophysicalLineThicknessF= 2.      ; double the thickness of geophysical boundaries
  res@mpNationalLineThicknessF= 2.         ; double the thickness of national boundaries


res@mpProjection = "LambertConformal"   ;兰伯特投影
  res@mpLambertMeridianF = 110.0
  res@mpLimitMode = "LatLon"
  res@mpLambertParallel1F = .001      ;Default: .001 ;可以自己改一改,看看投影有什么不同,挺有趣的
  res@mpLambertParallel2F = 89.999    ;Default: 89.999




;---------------------------------------------------------------

  res1                            = True
  res1@gsnMaximize                = False
  res1@gsnDraw                    = False
  res1@gsnFrame                   = False
  res1@tmBorderThicknessF         = 3.0

  res1@mpMinLatF             =  2.5       ; Asia limits
  res1@mpMaxLatF             =  24
  res1@mpMinLonF             =  106.5
  res1@mpMaxLonF             = 120.5

  res1@vpXF = 0.8   ;左边距
  res1@vpYF = 0.756   ;上边距
  res1@vpWidthF  = 0.11              ; height and width of plot
  res1@vpHeightF = 0.85



  res1@cnFillOn      = True
  res1@cnLinesOn     = False          ;等值线不显示
  res1@cnLineLabelsOn = False
  res1@cnFillDrawOrder = "PreDraw"         ; draw contours first  
  res1@cnFillPalette = "BlAqGrYeOrRe"     ;depth_qiu_02
  res1@lbLabelBarOn = False       ;LabelBar显示
  res1@tiMainOffsetYF        = 0.02  ;set place for main title along Y,offset
  res1@tiMainFontHeightF     = 0.02   ;set main title font size
  res1@tiMainString          = ""
  res1@gsnRightString = ""
  res1@gsnLeftString        = ""




  res1@gsnAddCyclic         = False      ;由于我们的数据不是循环地球一周的,因此必须把这个置否
  res1@mpDataSetName         = "/data1/pub_data//ncl_database/Earth..4"   ; This new database contains
  res1@mpDataBaseVersion     = "MediumRes"  ; Medium resolution database
  res1@mpOutlineOn           = True        ; Turn on map outlines
  res1@mpOutlineSpecifiers   = (/"China","China:Provinces"/)       ;China:states
  res1@mpFillBoundarySets    = "NoBoundaries"
  res1@mpOutlineBoundarySets = "NoBoundaries"
  res1@mpMaskAreaSpecifiers  = (/"China:states"/)
  res1@mpAreaMaskingOn       = True   ;使能填充覆盖
  res1@mpOceanFillColor      = 0     ;用白色填充海洋  0是colormap的索引值
  res1@mpInlandWaterFillColor= 0  ;用白色填充内陆湖水
  res1@mpGeophysicalLineThicknessF= 2.      ; double the thickness of geophysical boundaries
  res1@mpNationalLineThicknessF= 2.         ; double the thickness of national boundaries
  res1@mpProjection = "LambertConformal"   ;兰伯特投影
  res1@mpLambertMeridianF = 110.0
  res1@mpLimitMode = "LatLon"

  res1@mpLambertParallel1F = .001      ;Default: .001 ;可以自己改一改,看看投影有什么不同,挺有趣的
  res1@mpLambertParallel2F = 89.999    ;Default: 89.999


;------------------------------------------------------------------------
   ;xx map=gsn_csm_contour_map_ce(wks,blh_mon_ave(:,:),res)
  map=gsn_csm_contour_map_ce(wks,sshf1_ave(:,:),res)
  map1=gsn_csm_contour_map(wks,sshf1_ave(:,:),res1)

  dgres = False
  dgres@gsLineThicknessF = 2.0
  dgres@gsLineColor  = "Black"

   plot1 = gsn_add_shapefile_polylines(wks,map,"/data3/wangyan/bou-files/bou2_4l_cn50.shp",dgres)
   plot11 = gsn_add_shapefile_polylines(wks,map1,"/data3/wangyan/bou-files/bou2_4l_cn50.shp",dgres)


  draw(map)
  draw(map1)

  frame(wks)

end


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

新浪微博达人勋

发表于 2022-6-14 10:05:53 | 显示全部楼层
可能是水体
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

新浪微博达人勋

 楼主| 发表于 2022-6-14 17:23:10 | 显示全部楼层

可能不是水体,因为我换一个月数据他这些白点出现的位置和数量也会变化,我已经排出了缺失值所导致这一原因。
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

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