;************************************************* ; Mankendall_2.ncl ; ; Concepts illustrated: ; - Calculating the mankendall trend at each grid point for four season ; - Copying attributes from one variable to another ; - Drawing color-filled contours ; ;************************************************* ; ; 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" ; load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl" ;============================================================= begin ;************************************************************* ;open file and read data ;************************************************************** diri = "./" fili = "anojjashadsst_1950-2019.nc" in = addfile(diri+fili, "r") sst = in->sst printVarSummary(sst) ;************************************************************** ;*************************************************************************** ; Mankendall trend ;************************************************************************** p=trend_manken(sst,False,0) copy_VarCoords(sst(0,:,:),p(0,:,:)) p!0 = "prob_trend" printVarSummary(p) ; ************************************************ ; plotting parameters ;************************************************ ;************************************************ ; resource list for first data array ;************************************************ wks = gsn_open_wks("png","mankendall_trendjjas") ; send graphics to PNG file res = True res@mpFillOn = False res@mpMaxLatF = 30. ; specify the plot domain res@mpMinLatF = -30. ; res@mpMinLonF = 40. ; res@mpMaxLonF = 120. ; res@mpOutlineOn = True ; turn the map outline on res@gsnDraw = False ; do not draw the plot res@gsnFrame = False ; do not advance the frame res@cnLevelSelectionMode = "ManualLevels" ; use explicit levels res@cnMinLevelValF = -0.02 res@cnMaxLevelValF = 0.02 res@cnLevelSpacingF = 0.001 res@cnLineLabelsOn = False ; do not use line labels res@cnFillOn = True ; color fill res@cnLinesOn = False ; do not draw contour lines res@cnFillPalette = "MPL_RdylGn" res@tiMainString = "SST_Trend_JF" ; set the main title sres = True ; set up a second resource list sres@gsnDraw = False ; do not draw the plot sres@gsnFrame = False ; do not advance the frame sres@cnLevelSelectionMode = "ManualLevels" ; use explicit levels sres@cnMinLevelValF = 0 sres@cnMaxLevelValF = 0.05 plot = gsn_csm_contour_map(wks,p(1,:,:),res) ; create the temperature plot plot_ov = gsn_csm_contour(wks,p(0,:,:),sres) ; create the U-wind plot overlay(plot,plot_ov) ; overlay the U-wind plot on the temperature plot draw(plot) ; draw the temperature plot (with the U-wind plot overlaid) frame(wks) ; advance the frame end