;---------------------------------------------------------------------- ; Concepts illustrated: ; - Drawing contours over a map using a native lat,lon grid ; - Zooming in on a particular area on a map ;---------------------------------------------------------------------- ; These files are loaded by default in NCL V6.2.0 and newer ; load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" ; load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" begin ;---Read data and start graphics a = addfile("GRISO_Vaia.nc","r") ;DEBUG ;printVarSummary(a) ;print(a) ;exit ;--------------------- EXAMPLES ------------------------------------- ;For example, the following NCL statements assign two coordinate variables to a temperature variable. ;; create the temperature variable ( a 5x4 array of data) ;temp = new((/5,4/), float) ; ;; assign dimension names ;temp!0 = "lon" ;temp!1 = "lat" ; ;; initialize the values in the coordinate arrays ;lon_coordinates = (/-90, -85, -80, -75, -70/) ;lat_coordinates = (/0, 20, 40, 60/) ; ;; assign the coordinate arrays to the variable ;; Note that the coordinate variables must have the same name and ;; size as their corresponding dimension. ;temp&lon = lon_coordinates ;temp&lat = lat_coordinates ;--------------------- END EXAMPLES ------------------------------------- time = a->Time_GRISO lat = a->lat ; Needed only for projection information lon = a->lon prec = a->PR_GRISO ; assign dimension names prec!0="time" prec!1="lon" prec!2="lat" ; initialize the values in the coordinate arrays prec&lat= lat(:,0) prec&lon= lon(0,:) ; assign the coordinate arrays to the variable prec&lat@units="degrees_north" prec&lon@units="degrees_east" ;DEBUG ;printVarSummary(time) ;print(temp) ;printVarSummary(lat) ;print(lat) ;printVarSummary(lon) ;print(lon) ;printVarSummary(prec) ;printVarSummary(prec&lon) ;printVarSummary(prec&lat) ;print(prec) ;exit type = "x11" wks = gsn_open_wks(type,"dataonmap_native") ;---Set some resources res = True res@gsnMaximize = True ; maximize plot in frame res@cnFillOn = True ; turn on contour fill res@cnLinesOn = False ; turn off contour lines res@cnLineLabelsOn = False ; turn off contour line labels res@tfDoNDCOverlay = True ; REQUIRED for plotting on native grid res@gsnAddCyclic = False ; res@tfDoNDCOverlay = "NDCViewport" ; NCL V6.5.0 or later ; res@mpLimitMode = "Corners" ; choose range of map ; res@mpLeftCornerLatF = lat@corners(0) ; res@mpLeftCornerLonF = lon@corners(0) ; res@mpRightCornerLatF = lat@corners(2) ; res@mpRightCornerLonF = lon@corners(2) ; ; res@mpProjection = lat@mpProjection ; res@mpLambertMeridianF = lat@mpLambertMeridianF ; res@mpLambertParallel1F = lat@mpLambertParallel1F ; res@mpLambertParallel2F = lat@mpLambertParallel2F ; ; res@pmTickMarkDisplayMode = "Always" ; better map tickmarks ; ; res@tiMainString = "Plotting data on its native grid" ;---Make contour plot plot = gsn_csm_contour_map(wks,prec(0,:,:),res) end