爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 4973|回复: 1

[作图] NCL出图如何将UTC时间改成我国的时间

[复制链接]
发表于 2017-9-4 17:26:04 | 显示全部楼层 |阅读模式

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

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

x
第一个问题:我的CMAQ是UTC时间,如何在NCL出图的时候,将UTC时间改成我国的时间
第二个问题:
当要设置图的浓度范围时,有时候设大或者设小,都可能导致整个图是一个颜色,如何解决这个问题。
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 "/data4/huihong/map_info/cnmap/cnmap.ncl"

begin

  ;grid file
  grid_fn="/data4/huihong/map_info/cmaq_domain/GRIDCRO2D_9km"

  ;Fig title
  fig_title="O3 Concentration (ppmv)"

  g_font=0.02

  ;File IO
  pdata_fn     = "/data4/huihong/data/cctm/multi-nodes/CCTM_e1a_Linux2_x86_64intel.ACONC.CN9GD_98X74.multi-nodes.2017235"
  ctrl_in = addfile(pdata_fn ,"r")  ; open output netCDF file
  var1    = ctrl_in->O3(:,0,:,:)
; var1    = var1+ctrl_in->NO2(:,0,:,:)

  latlon_in   =  addfile(grid_fn,"r")
  lat = latlon_in->LAT(0,0,:,:)
  lon = latlon_in->LON(0,0,:,:)

  var1@lat2d=lat
  var1@lon2d=lon

  res                  = True       ; use plot options

  res@cnFillOn             = True               ; turn on color for contours
  res@cnLinesOn            = False              ; turn off contour lines
  res@cnLineLabelsOn       = False              ; turn off contour line labels

res@cnLineLabelsOn       = False              ; turn off contour line labels

;  res@cnLevelSelectionMode = "ExplicitLevels"   ; set manual contour levels
;  res@cnLevels = ispan(0,60,10)
;  res@cnFillColors =(/-1,20,47,57,94,127,152/)

res@cnLevelSelectionMode  = "ManualLevels" ; set manual contour levels
res@cnMinLevelValF        = 0          ; set min contour level
res@cnMaxLevelValF        = 0.06          ; set max contour level
res@cnLevelSpacingF       = 0.002          ; set contour interval

  res@gsnFrame         = False
  res@gsnDraw  = False

  res@gsnSpreadColors      = True               ; use full color map
;  res@gsnSpreadColorStart  = 2               ; start at color 17
;  res@gsnSpreadColorEnd    = 14                ; end at color 200

  res@gsnRightString = ""
  res@gsnMaximize      = True       ; fill up the page
  ;res@gsnAddCyclic   = True;False
  res@gsnPaperOrientation = "portrait"
  res@gsnContourZeroLineThicknessF = 2.  ;set thickness of zero

  res@cnFillMode           = "CellFill" ; Raster Mode

  res@lbLabelBarOn = True   ; turn off the label bar
  res@lbOrientation          = "vertical"
  res@lbLabelFontHeightF  = 0.02              ; make labels smaller
  ;res@lbLabelStride = 1

  res@mpMinLatF            = min(var1@lat2d)        ; zoom in on map
  res@mpMaxLatF            = max(var1@lat2d)
  res@mpMinLonF            = min(var1@lon2d)

res@mpMaxLatF            = max(var1@lat2d)
  res@mpMinLonF            = min(var1@lon2d)
  res@mpMaxLonF            = max(var1@lon2d)

  res@mpGeophysicalLineThicknessF = 2.0 ;costal line thick
  res@tmXBTickSpacingF = 2
  res@tmYLTickSpacingF = 2

  res@tmXBLabelFontHeightF =g_font
  res@tmYLLabelFontHeightF = g_font
  res@gsnStringFontHeightF = g_font
  res@tiMainFontHeightF= g_font
  ;res@lbLabelFontHeightF = 0.02
  ;res@pmLabelBarOrthogonalPosF = .12           ; move label bar down
  res@tmXBMajorThicknessF = 2.0
  res@tmYLMajorThicknessF = 2.0
  res@tmXBMinorThicknessF = 2.0
  res@tmYLMinorThicknessF = 2.0
  res@tmBorderThicknessF = 2.0
  res@tmYLMajorLengthF = 0.002


  res@mpFillOn                = True
  res@mpOutlineOn             = False  ; Use outlines from shapefile
  res@cnFillDrawOrder         = "PreDraw"
  res@mpDataBaseVersion       = "MediumRes"
  res@mpDataSetName           = "Earth..4"
  res@mpAreaMaskingOn         = True
  res@mpMaskAreaSpecifiers    = (/"China","Taiwan","Disputed area between India and China","India:Arunachal Pradesh"/)
  res@mpLandFillColor         = "white"
  res@mpInlandWaterFillColor  = "white"
  ;res@mpOceanFillColor        = "white"
  ;res@mpOutlineBoundarySets   = "NoBoundaries"

;res@mpOutlineBoundarySets   = "NoBoundaries"

;>============================================================<
;                      add China map
;>------------------------------------------------------------<
  cnres           = True
  cnres@china     = False       ;draw china map or not
  cnres@river     = False       ;draw changjiang&huanghe or not
  cnres@province  = True       ;draw province boundary or notcnres@nanhai    = False       ;draw nanhai or not
  cnres@nanhai    = False       ;draw nanhai or not
  cnres@diqu      = True       ; draw diqujie or not

        g_fig_name="/data4/huihong/fig/O3_daymean"

        var_mean=dim_avg_n_Wrap(var1,0)

        res@gsnCenterString="O3"
        res@gsnLeftString="20170823"
        res@gsnRightString="ppmv"
        wks = gsn_open_wks("png",g_fig_name)       ; open file to plot
        ;gsn_define_colormap(wks,"WhiteBlueGreenYellowRed")
        gsn_define_colormap(wks,"wh-bl-gr-ye-re")
    ;    gsn_reverse_colormap(wks)
        plot = gsn_csm_contour_map(wks,var_mean(:,:),res) ; dim1 = 0 for lvl = 0
        chinamap = add_china_map(wks,plot,cnres)
        draw(plot)
        frame(wks)

        delete([/wks,plot,chinamap/])

end



密码修改失败请联系微信:mofangbao
 楼主| 发表于 2017-9-4 17:26:45 | 显示全部楼层
自己顶起。不要沉
密码修改失败请联系微信:mofangbao
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

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

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