; load some packages load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" begin ; -------------------------------- ; Loading netcdf data cdf_file = addfile("H.nn50003.cdf","r") ; -------------------------------- ; Create variables Hplot = cdf_file->HAVGSG(24,:,:) lat = cdf_file->YLAT lon = cdf_file->XLON ; -------------------------------- ; 0 transforme to -999 Hplot = where(Hplot.eq.0.,-0.01,Hplot) ; -------------------------------- ; set to the missing value Hplot@_FillValue = -0.01 ; sets _FillValue to -999 print(min(Hplot)) ; -------------------------------- res = True ; plot mods desired ; -------------------------------- ; Plotting or saving wtype = "eps" ;wks = gsn_open_wks(wtype,"HPD20kapar3.cdf") ; open an eps file wks = gsn_open_wks("x11","H50par4ka") ; -------------------------------- ; Which colormap gsn_define_colormap (wks,"GMT_hot") ; 100 colors NhlSetColor(wks,10,0.83,0.83,0.83) ; -------------------------------- ; Plot size res@mpShapeMode = "FreeAspect" res@vpWidthF = 0.6 res@vpHeightF = 0.4 ; -------------------------------- ; Contour line style ... res@cnFillOn = True ; turn on color res@cnFillMode = "cellfill" res@cnLinesOn = False ; no contour lines res@gsnSpreadColors = True ; use full color map ; -------------------------------- ; Colormap res@cnLevelSelectionMode = "ManualLevels" ; manual levels res@cnMinLevelValF = 0 res@cnMaxLevelValF = 1200. res@cnLevelSpacingF = 100. res@lbLabelStride = 4 ; every nth label res@lbTitleString = "Ice thickness (m)" res@lbTitlePosition = "Bottom" ;"right" res@lbTitleOffsetF = 0.3 res@lbTitleFontHeightF =.020 res@lbLabelFontHeightF =.015 ; make labels larger res@pmLabelBarWidthF = 0.6 res@pmLabelBarHeightF = 0.06 res@pmLabelBarOrthogonalPosF = .15 ; move whole thing down res@gsnSpreadColorStart = -1 ; start with last color res@gsnSpreadColorEnd = 15 ; end with a beginning color res@mpLandFillColor = 10 ; -------------------------------- ; Tick mark res@gsnMajorLonSpacing = 20 ; change maj lon tm spacing res@gsnMajorLatSpacing = 10 ; change maj lat tm spacing ;res@tmXBTickSpacingF = 20 ;res@tmYBTickSpacingF = 10 res@tmXBLabelFontHeightF = 0.015 ; resize tick labels res@tmYLLabelFontHeightF = 0.015 ; resize tick labels ; -------------------------------- ; Title / labels res@gsnAddCyclic = False ; regional data res@gsnLeftString = "" ; No variable name on the top of the plot ; -------------------------------- ; Zoom on a region to plot res@mpLimitMode = "Corners" ; method to zoom res@mpLeftCornerLatF = lat(0) res@mpLeftCornerLonF = lon(0) res@mpRightCornerLatF = lat(101-1) res@mpRightCornerLonF = lon(131-1) ; -------------------------------- ; Make plot ; uncomment the following two resources if you don't want to set the first plot. ; however, the plot needs to be created to do the getvalues for the fill colors ; there are other ways to do this but this works. ;res@gsnDraw = False ;res@gsnFrame = False plot = gsn_csm_contour_map_ce (wks,Hplot,res) getvalues plot@contour "cnFillColors" : fcols end getvalues fcols(0) = -1 res@cnFillColors = fcols delete(res@cnFillMode) delete(Hplot@_FillValue) res@gsnDraw = True res@gsnFrame = True plot = gsn_csm_contour_map_ce (wks,Hplot,res) end