;************************************************* ; conOncon_3.ncl ; ; Concepts illustrated: ; - Overlaying two sets of contours on a polar stereographic map ; - Overlaying line contours on filled contours ; - Turning off map tickmarks ; - Increasing the thickness of contour lines ; - Using a blue-white-red color map ;************************************************* load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" begin external FLIP "./flip.so" a = addfile("hrrr.t19z.wrfprsf00.grib2","r") qv = a->DPT_P0_L103_GLC0(:,:) ; qva = a->DPT_P0_L100_GLC0(:,:,:) ; ISBL0 tk = a->TMP_P0_L103_GLC0(:,:) ; tka = a->TMP_P0_L100_GLC0(:,:,:) ; ISBL0 vegt = a->VGTYP_P0_L1_GLC0(:,:) ; tflx = a->SHTFL_P0_L1_GLC0(:,:) ; qflx = a->LHTFL_P0_L1_GLC0(:,:) ; hpbl = a->HPBL_P0_L1_GLC0(:,:) ; tsfc = a->TMP_P0_L1_GLC0(:,:) ; cld = a->CLWMR_P0_L100_GLC0(:,:,:) ; ISBL0 rh = a->RH_P0_L100_GLC0(:,:,:) ; ISBL0 rnw = a->RWMR_P0_L100_GLC0(:,:,:) ; ISBL0 ua = a->UGRD_P0_L100_GLC0(:,:,:) ; ISBL0 va = a->VGRD_P0_L100_GLC0(:,:,:) ; ISBL0 refl = a->REFD_P0_L103_GLC0(:,:,:) ; HTGL6 lat = a->gridlat_0(:,:) lon = a->gridlon_0(:,:) height = a->lv_ISBL0(:) print(height) tk@lat2d = lat tk@lon2d = lon tka@lat2d = lat tka@lon2d = lon cld@lat2d = lat cld@lon2d = lon rnw@lat2d = lat rnw@lon2d = lon rh@lat2d = lat rh@lon2d = lon ua@lat2d = lat ua@lon2d = lon va@lat2d = lat va@lon2d = lon qv@lat2d = lat qv@lon2d = lon tflx@lat2d = lat tflx@lon2d = lon qflx@lat2d = lat qflx@lon2d = lon vegt@lat2d = lat vegt@lon2d = lon ; printVarSummary(tka) ; printVarSummary(lon) ; print(lat(472,1309)) ; print(lon(472,1309)) ; print(tflx(472,1309)) ; print(tk(472,1309)) ; print(hpbl(472,1309)) ; print(tsfc(472,1309)) ny = 1059 nx = 1799 nz = 40 yi = ispan(1,ny,1)*1. xi = ispan(1,nx,1)*1. zi = ispan(1,nz,1)*3.0 ; printVarSummary(ua) data = new((/nz,ny,nx/), float) data2 = new((/nx,ny,nz/), float) FLIP::switch(rnw,data,nz,ny,nx) do i=10,30 do j=0,300 do k=1648,1798 data2(k,j,i)=data(i,j,k) end do end do end do px = new(11, float) py = new(11, float) pz = new(11, float) mtri = 15000 rtri = new((/mtri,10/), float) do i=0,10 px(i)= 1650 +10.1*i py(i)= 100 +10.1*i pz(i)= 30 + 2.1*i end do wks = gsn_open_wks("X11","gsn_contour") ; open a ps file ; wks = gsn_open_wks("pdf","t19f00_hrrr_tflx.pdf") ; open a ps file gsn_define_colormap(wks,"BlRe") ; define colormap ;***************************** ; create first plot ;***************************** resn = True ; create vector resource array resn@cnFillOn = True ; color fill resn@cnLinesOn = False ; no contour lines resn@gsnLeftString = "" ; no titles resn@gsnRightString = "" resn@tiXAxisString = "" resn@tiYAxisString = "" resn@gsnDraw = False ; don't draw resn@gsnFrame = False ; don't advance frame resn@vpWidthF = 0.8 ; change the aspect ratio resn@vpHeightF = 0.6 ; resn@tmXBMode = "Manual" ; resn@trXMinF = 0 ; resn@tmXBTickStartF = resn@trXMinF ; resn@trYMinF = 0 ; resn@tmYRTickStartF = resn@trYMinF ; resn@tmXBTickEndF = 32000 ; resn@tmXBTickSpacingF = 4000 resn@mpDataBaseVersion = "MediumRes" resn@pmTickMarkDisplayMode = "Always" resn@gsnAddCyclic = False ; regional data resn@mpProjection = "LambertConformal" resn@mpLimitMode = "Corners" ; choose region of map ; resn@mpLeftCornerLatF = lat(0,0) ; resn@mpLeftCornerLonF = lon(0,0) ; resn@mpRightCornerLatF = lat(ny-1,nx-1) ; resn@mpRightCornerLonF = lon(ny-1,nx-1) ; resn@mpLeftCornerLatF = lat(450,500) ; choose subset ; resn@mpLeftCornerLonF = lon(820,1200) ; resn@mpRightCornerLatF = lat(475,800) ; resn@mpRightCornerLonF = lon(800,1300) resn@mpLeftCornerLatF = lat(0,0) ; choose subset resn@mpLeftCornerLonF = -85.0 resn@mpRightCornerLatF = 35.0 resn@mpRightCornerLonF = lon(ny-1,nx-1) resn@mpLambertMeridianF = -97.5 resn@mpLambertParallel1F = 38.5 resn@mpLambertParallel2F = 38.5 resn@mpDataBaseVersion = "MediumRes" resn@mpDataSetName = "Earth..4" resn@mpOutlineBoundarySets = "AllBoundaries" ; all boundaries ; resn@cnLevelSelectionMode = "ManualLevels" ; manually set the contour levels with the following 3 resources ; resn@cnMinLevelValF = 0.0 ; resn@cnMaxLevelValF = 300.0 ; resn@cnLevelSpacingF = 50.0 ; resn@gsnPaperOrientation = "Portrait" resn@pmLegendDisplayMode = "Never" resn@tiMainOn = False ; plot1 = gsn_csm_contour_map(wks,ua(35,:,:),resn) unlb = "30, 45, 60" vnlb = "800, 850, 900" wnlb = "300, 350, 400" uilb = "Z-coordinate values" vilb = "Y-coordinate values" wilb = "W-coordinate values" ntri = 0 dotsize = 0.2 do i = 0, 10 tdmtri(-5, (/px(i), py(i), pz(i)/), dotsize, \ rtri, ntri, 4, (/1649.,50.,30./),(/1799.,300.,90./)) end do rtwk = new((/2,mtri/),float) itwk = tdotri(rtri, ntri, rtwk, 0) tddtri(wks,rtri, ntri, itwk) ; tdlbls(wks,(/30.,800.,300./),(/60.,900.,400./),(/unlb,vnlb,wnlb/),(/uilb,vilb,wilb/),1) tdgrds(wks,(/1649., 50., 30./), (/1799, 300., 90./), (/10., 10., 10./),11,1) tdez3d(wks,xi(1648:1798),yi(50:300),zi(10:30),data2(1648:1798,50:300,10:30),.0003,2.,-20.,50.,-3) ; tdez3d(wks,zi(10:20),yi(0:100),xi(1698:1798),rh(10:20,0:100,1698:1798),70.0,0.,0.,0.,-3) ; tdgrds(wks,(/0., 1., 0./), (/1., 0., 1./), (/-1., -1., -1./),11,0) tdgrds(wks,(/1649., 50., 30./), (/1799, 300., 90./), (/10., 10., 10./),11,0) ;***************************** ; create second plot ;***************************** resr = True ; create vector resource array resr@cnFillOn = False ; color fill resr@cnLinesOn = True ; no contour lines resr@gsnLeftString = "" ; no titles resr@gsnRightString = "" resr@tiXAxisString = "" resr@tiYAxisString = "" resr@gsnDraw = False ; don't draw resr@gsnFrame = False ; don't advance frame resr@vpWidthF = 0.8 ; change the aspect ratio resr@vpHeightF = 0.6 ; resr@tmXBMode = "Manual" ; resr@trXMinF = 0 ; resr@tmXBTickStartF = resn@trXMinF ; resr@trYMinF = 0 ; resr@tmYRTickStartF = resn@trYMinF ; resr@tmXBTickEndF = 32000 ; resr@tmXBTickSpacingF = 4000 ; resr@mpDataBaseVersion = "MediumRes" ; resr@pmTickMarkDisplayMode = "Always" ; resr@gsnAddCyclic = False ; regional data ; resr@mpProjection = "LambertConformal" ; resr@mpLimitMode = "Corners" ; choose region of map ; resr@mpLeftCornerLatF = lat(0,0) ; resr@mpLeftCornerLonF = lon(0,0) ; resr@mpRightCornerLatF = lat(ny-1,nx-1) ; resr@mpRightCornerLonF = lon(ny-1,nx-1) ; resr@mpLambertMeridianF = -97.5 ; resr@mpLambertParallel1F = 38.5 ; resr@mpLambertParallel2F = 38.5 ; resr@mpDataBaseVersion = "MediumRes" ; resr@mpDataSetName = "Earth..4" ; resr@mpOutlineBoundarySets = "AllBoundaries" ; all boundaries resr@cnLevelSelectionMode = "ManualLevels" ; manually set the contour levels with the following 3 resources resr@cnMinLevelValF = 0.0 resr@cnMaxLevelValF = 300.0 resr@cnLevelSpacingF = 50.0 ; resr@gsnPaperOrientation = "Portrait" resr@pmLegendDisplayMode = "Never" resr@tiMainOn = False plot2 = gsn_csm_contour(wks,qflx,resr) ;****************************** ; overlay the plots ;****************************** ; overlay(plot1,plot2) ; draw(plot1) frame(wks) end