Demo entry 6662950

test

   

Submitted by wang on Nov 28, 2017 at 18:23
Language: NCL. Code size: 6.1 kB.

begin
;-----------add vars--------------------------
    f=addfile("air.2016.nc","r")
    air=f->air
    air = air - 273.15
    delete(f)
    f=addfile("air.2m.gauss.2016.nc","r")
    sair=f->air
    sair = sair - 273.15
    delete(f)
    f=addfile("hgt.2016.nc","r")
    hgt=f->hgt
    hgt=hgt/10.0
    delete(f)
    f=addfile("slp.2016.nc","r")
    slp=f->slp
    slp=slp/100.0
    delete(f)
;-----------end vars--------------------------

;---------open wkstation----------------------
    xwks="pdf"
    xwks@wkOrientation  ="landscape"
    xwks@wkPaperWidthF=9
    xwks@wkPaperHeightF=9
    wks=gsn_open_wks(xwks,"overlord")
    gsn_define_colormap(wks,"WhBlGrYeRe")
;-----------end open--------------------------

;------------map & tem resource---------------
    tres                         = True
    tres@gsnAddCyclic            = False
    tres@gsnMaximize             = True
    tres@gsnPaperMargin          = 0.01
    tres@gsnDraw                 = False
    tres@gsnFrame                = False
    tres@gsnLeftString           = ""
    tres@gsnRightString          = ""
    tres@tiMainString            = ""

    tres@mpLimitMode             = "LatLon"
    tres@mpMinLatF               =  15.0
    tres@mpMaxLatF               =  60.0
    tres@mpMinLonF               =  80.0
    tres@mpMaxLonF               = 130.0
    tres@mpLambertMeridianF      = 105.0
    tres@mpGridSpacingF          = 10.0
    tres@mpGridLineDashPattern   = 16
    tres@mpProjection            = "LambertConFormal"
    tres@mpLimitMode             = "LatLon"
    tres@mpDataSetName           = "Earth..4"
    tres@mpDataBaseVersion       = "MediumRes"
    tres@mpOutlineOn             = True
    tres@mpOutlineBoundarySets   = "National"
    tres@mpOutlineSpecifiers     = (/"China:Provinces"/)
    tres@mpLandFillColor         = "white"
    tres@mpOceanFillColor        = "SkyBlue"
    tres@mpInlandWaterFillColor  = "SkyBlue"
    tres@mpProvincialLineColor   = "purple"
    tres@mpProvincialLineThicknessF= 2
    tres@mpNationalLineColor      = "purple"

    tres@pmTickMarkDisplayMode   = "Always"
    tres@tmYLLabelFontHeightF    = 0.008
    tres@tmBorderThicknessF      = 0.0
    tres@tmYLMajorLengthF        = 0.002

    tres@cnFillOn                          = True
    tres@cnFillPalette                     = "NCV_blu_red"
    tres@cnLinesOn                         = False
    tres@cnLineLabelFontHeightF            = 0.008
    tres@cnLineLabelBackgroundColor        = 0
    tres@cnSmoothingOn                     = True
    tres@cnSmoothingTensionF               = 0.5  ;-2.5
    tres@cnSmoothingDistanceF              = 0.005  ;0.01

    ;res@gsnSpreadColors                   = True
    ;res@lbOrientation                     = "Vertical"
    ;res@lbBoxSeparatorLinesOn             = False
    tres@lbRightMarginF                    = 0.0
    tres@lbLabelFontHeightF                = 0.01
    tres@lbLabelStride                     = 2
    tres@pmLabelBarHeightF                 = 0.05
    tres@lbBoxEndCapStyle                  = "TriangleBothEnds"

;------------------hgt resource--------------------------
    hres                         = True
    hres@gsnAddCyclic            = False
    ;hres@gsnDraw                 = False
    ;hres@gsnFrame                = False
    ;hres@gsnLeftString           = ""
    ;hres@gsnRightString          = ""
    hres@tiMainString            = ""
    hres@cnLineLabelInterval     = 1
    hres@cnLineColor             = "midnightblue" ;mediumblue
    hres@cnLineLabelFontHeightF  = 0.01
    hres@cnLineThicknessF        = 2.0
    hres@cnLineLabelBackgroundColor= 0
    hres@cnLineDashPattern       = 0
    hres@cnLevelSpacingF         = 4
    hres@cnSmoothingOn           = True
    hres@cnSmoothingTensionF     = 0.5    ;-2.5
    hres@cnSmoothingDistanceF    = 0.005  ;0.01
    hres@cnInfoLabelOn           = False
;------------------end hgt----------------------------------

;--------------------------plot-----------------------------
    timeunits = "hours since 1800-01-01 00:00:0.0"
    tres@cnLevelSelectionMode              ="ManualLevels"
    plot=new(4,graphic)

    do im = 22,25
        do ihr = 0,18,6
            time = cd_inv_calendar(2016,1,im,ihr,0,0,timeunits,0)
            hres@cnLevelSpacingF         = 4
            tres@gsnLeftString = "100hPa"
            tres@cnMinLevelValF                    = -80
            tres@cnMaxLevelValF                    = -40
            tres@cnLevelSpacingF                   = 4
            plot(0) = gsn_csm_contour_map_overlay(wks,air({time},{100},:,:), \
                      hgt({time},{100},:,:), tres, hres)
            tres@gsnLeftString = "500hPa"
            tres@cnMinLevelValF                    = -48
            tres@cnMaxLevelValF                    = 0
            tres@cnLevelSpacingF                   = 4
            plot(1) = gsn_csm_contour_map_overlay(wks,air({time},{500},:,:), \
                      hgt({time},{500},:,:), tres, hres)
            tres@gsnLeftString = "850hPa"
            tres@cnMinLevelValF                    = -36
            tres@cnMaxLevelValF                    = 24
            tres@cnLevelSpacingF                   = 4
            plot(2) = gsn_csm_contour_map_overlay(wks,air({time},{850},:,:), \
                      hgt({time},{850},:,:), tres, hres)

            hres@cnLevelSpacingF         = 5
            tres@gsnLeftString = "surface"
            tres@cnMinLevelValF                    = -32
            tres@cnMaxLevelValF                    = 32
            tres@cnLevelSpacingF                   = 4
            plot(3) = gsn_csm_contour_map_overlay(wks,sair({time},:,:), \
                            slp({time},:,:), tres, hres)

        pres =True
        pres@gsnMaximize=True
        pres@gsnPaperMargin=0.01
        pres@txString= "2016-1-"+ im +"-" + ihr + ":00"
        pres@txFontHeightF=0.015
        pres@txJust="TopCenter"
        pres@txPerimSpaceF = 0.01
        gsn_panel(wks,plot,(/2,2/),pres)
        print(im+"day " + ihr + "hour")
        end do

        if ( (im .lt. 25) .and. (ihr .lt. 18) ) then
            frame(wks)
        end if


    end do


end

This snippet took 0.02 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).