;************************************************* ; WRF static: panel different variables ;************************************************ 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/WRF_contributed.ncl" begin ;************************************************ ; open file and read in data ;************************************************ f = addfile("/usr/rmt_share/tgdata/hrldas/workspace/jam2/france/code_ncl/geo_em.d01_france.nc", "r") ;************************************************ ; Read variables ;************************************************ use = f->LU_INDEX(0,:,:) ; land use dominant category lat2d = f->XLAT_M(0,:,:) lon2d = f->XLONG_M(0,:,:) lsMask= f->LANDMASK(0,:,:) ; land (1) water (0) mas ;************************************************ ; Use mask function to set all ocean areas to _FillValue ;************************************************ use = mask(use,lsMask,1) ;************************************************ ; Associate 2D coordinates with variables for plotting ;************************************************ use@lat2d = lat2d use@lon2d = lon2d dimll = dimsizes(lat2d) nlat = dimll(0) nlon = dimll(1) ;************************************************ ; create plots ;************************************************ wks = gsn_open_wks("ps" ,"new_usgs2") ; ps,pdf,x11,ncgm,eps ; gsn_define_colormap(wks ,"BlAqGrYeOrReVi200"); choose colormap res = True ; plot mods desired ; res@gsnMaximize = True res@gsnSpreadColors = False ; use full range of colormap res@cnFillOn = True ; color plot desired ; res@mpMinLonF = -120 ; set min lon ; res@mpMaxLonF = -85 ; set max lon ; res@mpMinLatF = 30. ; set min lat res@vpWidthF = 0.9 ; height and width of plot res@vpHeightF = 0.4 res@cnLinesOn = False ; turn off contour lines res@cnLineLabelsOn = False ; turn off contour labels res@cnFillMode = "RasterFill" ; activate raster mode res@lbLabelAutoStride = True ; let NCL figure lb stride res@cnLevelSelectionMode = "ManualLevels" ; set manual contour levels res@cnMinLevelValF = 1. ; set min contour level res@cnMaxLevelValF = 24. ; set max contour level res@cnLevelSpacingF = 1 ; manually specify interval res@lbOrientation = "vertical" ; vertical label bars ; res@lbLabelAutoStride = True res@cnFillColors= (/"White","Red1", "GreenYellow", "Green4", "Green", \ "SpringGreen1", "Tan1","Olivedrab1", "Pink", "Orange", \ "Yellow", "DarkSeaGreen3", "Salmon1", "SteelBlue4", \ "Salmon4", "Navy", "Azure", "VioletRed","LightSeaGreen", \ "Maroon1","Gold","Khaki","Blue","Peru","White"/) res@lbLabelFontHeightF =.006 res@lbLabelFont = "times-bold" res@lbLabelPosition = "Right" res@lbLabelStrings = (/"","Urban and Built-Up","Dryland and Cropland psture","Irrigated Cropland and pasture","Mixed Dryland-Irrigated", \ "Cropland-Grassland mosiac","Cropland-Woodland mosiac","Grassland","Shrubland","Mixed Shrubland-Grassland",\ "Savanna","Deciduous Broadleaf Forest","Deciduous Needleleaf Forest","Evergreen Broadleaf Forest","Evergreen Needleleaf Forest","Mixed Forest","Water Bodies", \ "Herbaceous Wetland","Wooded Wetland","Barren or sparsely veg","Herbaceous Tundra","Wooded Tundra","Mixed Tundra","Bare Ground Tundra","Snow or Ice"/) ;USE FOR BAR res@lbLabelPosition = "Center" ; label position res@lbLabelAlignment = "BoxCenters" ; label orientation res@lbLabelStrings = (/"0","1","2","3","4","5","6","7","8",\ "9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24"/) ; res@lbLabelOffsetF = 1.5; end bar ; gsn_define_colormap(wks, colors) ; cmap = gsn_retrieve_colormap(wks) ; cmap(0,:) = (/1.,1.,1./) ; Set background to white. ; cmap(1,:) = (/0.,0.,0./) ; Set foreground to black. ; gsn_define_colormap(wks,cmap) res@cnFillOn = True ; turn on color res@cnLinesOn = False ; turn contour lines res@lbLabelAutoStride = True ; let NCL determine label spacing plot = gsn_csm_contour(wks,use,res) dimp = dimsizes(use) ny = dimp(0) mx = dimp(1) dx = f@DX/1000. ; dx (km) west_east = ispan(0,mx-1,1)*dx ; calculate x values west_east@long_name = "west_east" west_east@units = "km" use&west_east = west_east ; associate "x" values with p dy = f@DY/1000. ; dy (km) south_north = ispan(0,ny-1,1)*dy ; calculate y values south_north@long_name = "south_north" south_north@units = "km" use&south_north = south_north ; associate "y" values with p printVarSummary(use) res@cnLinesOn = True res@lbOrientation = "Vertical" plot = gsn_csm_contour(wks,use,res) end