I have plotted snow cover data and I have attached lat and lon to it and
when I plot I get this image
Here is my code:-
;*******************************************
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"
a =addfile("~/Documents/Snow_cover_IMS/nhsce_v01r01_19661004_20140602.nc
","r")
sce=a->snow_cover_extent(0,:,:)
lat=a->latitude(:,:)
print(lat(:,1))
lon=a->longitude(:,:)
;print(sce)
;print("Hello")
;printVarSummary(sce)
;printVarSummary(lat)
;printVarSummary(lon)
delete_VarAtts(sce, -1)
;Attaching variables
sce!0="lat2d"
sce!1="lon2d"
sce@lat2d=lat
sce@lon2d=lon
printVarSummary(sce)
; Plotting code
wks = gsn_open_wks("ps","sce_ims")
gsn_define_colormap(wks,"default")
res = True
res@cnFillOn = True
res@cnLinesOn = False
res@cnLineLabelsOn = False
res@cnFillMode = "rasterfill"
res@cnMissingValFillColor = 28 ; "gray"
;
; Since the data is categorical, values between the categories need to be
; excluded. Use Explicit level selection to accomplish this.
;
res@cnLevelSelectionMode = "explicitlevels"
res@cnLevels = (/ 0.99,1.99, 2.99, 3.99, 4.99 /)
res@cnFillColors = (/ 1, 4, 19, 6, 0, 1 /) ; (/"black", "blue", "green",
"yellow", "white", "black" /)
res@lbLabelAlignment = "boxcenters"
res@lbLabelStrings = (/ "water", "land", "ice", "snow" /)
;
; First draw the plot without projecting into map coordinates.
; This has the drawback that only index values are used as tick marks
; but it is fast
;
res@gsnPolar = "NH" ; specify the hemisphere
plot = gsn_csm_contour_map_polar(wks,sce,res) ; create the plot
What is missing?
Received on Sat Jul 19 12:04:49 2014
This archive was generated by hypermail 2.1.8 : Wed Jul 23 2014 - 15:33:46 MDT