;---------------------------------------------------------------------- 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" load "$NCARG_ROOT/lib/ncarg/nclscripts/contrib/cd_string.ncl" load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl" ;load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shapefile_utils.ncl" begin ;---Read data a = addfile("remap-hourly_India.nc","r") filename = "/Volumes/WD-Passport/india/india_state.shp" arr = a->BCSMASS lat = a->lat lon = a->lon ; printVarSummary(arr) timeT = cd_calendar(arr&time,0) time = timeT(:,3) arr_min = dim_minind ( arr(time|:, lat|:, lon|:),0 ) printVarSummary(arr_min) ; printMinMax(arr_min,0) arr_max = dim_maxind ( arr(time|:, lat|:, lon|:),0 ) ; printVarSummary(arr_max) ; printMinMax(arr_max,0) time_min = arr_min ; arr_min contains the indices that were the minimum at each lat/lon point time_max = arr_max ; print(time_min) printVarSummary(time_min) printMinMax(time_min,0) do gg = 0,dimsizes(arr_min&lat)-1 printVarSummary(gg) do hh = 0,dimsizes(arr_min&lon)-1 time_min(gg,hh) = (/ toint(time(arr_min(gg,hh))) /) time_max(gg,hh) = (/ toint(time(arr_max(gg,hh))) /) end do end do ;---Open workstation and change color map wks_type = "png" wks = gsn_open_wks(wks_type, "JJAS_panel_time2aapo") str_abc = "g" str_m = "m" plot = new(2, graphic) ;---Set some resources res = True res@gsnLeftString = "" res@gsnCenterString = "" res@gsnRightString = "" res@gsnMaximize = True ; maximize plot in frame res@gsnDraw = False res@gsnFrame = False res@cnFillOn = True ; turn on contour fill res@cnLinesOn = False ; turn off contour lines res@cnFillMode = "RasterFill" res@cnRasterSmoothingOn = True res@lbBoxLinesOn = False res@lbLabelBarOn = False ; turn off individual cb's res@lbLabelFontHeightF = 0.02 ; last one 0.022 res@lbLabelFont = 21 res@pmLabelBarWidthF = 0.5 ; last one 0.55 res@pmLabelBarHeightF = 0.06 ;adjuct label bar 0.092 res@pmLabelBarOrthogonalPosF = 0.23 ; adjuct position of the label bar res@cnLineLabelsOn = False ; turn off line labels res@tiMainString = "" res@tiMainFontHeightF = 0.02 res@tiMainFont =21 ; sets the font index for the Main title res@tiDeltaF =0.6 ; adjust title position res@lbTitleFontHeightF = 0.015 res@gsnAddCyclic = False res@mpShapeMode = "FreeAspect" res@vpWidthF = 0.38 res@vpHeightF = 0.42 res@mpMinLonF = 68.1 res@mpMaxLonF = 97.5 res@mpMinLatF = 5.0 res@mpMaxLatF = 38.0 res@pmTickMarkDisplayMode = "Always" res@mpGridSpacingF = 2 res@mpGridLineThicknessF = 4.0 res@tmXBLabelFontHeightF = 0.02 res@tmYLLabelFontHeightF = 0.02 res@tmXBLabelFontQuality = "High" res@tmBorderThicknessF = 6 ;---Fix the contor levels for all plots res@cnLevelSelectionMode = "ManualLevels" res@cnMinLevelValF = 0 ; -0.1 res@cnMaxLevelValF = 24 ;60 res@cnLevelSpacingF =0.2 ;0.25 res@cnFillPalette = "BlueRedGray" plot(0) = gsn_csm_contour_map(wks,time_max,res) plot(1) = gsn_csm_contour_map(wks,time_min,res) ;************************************************ ; Attach text to plot using plot coordinates. ;************************************************ txres = True ; text mods desired txres@txFontHeightF = 0.03 ; font smaller. default big txres@txFontThicknessF = 1 txres@txBackgroundFillColor = "white" dum0 = gsn_add_text(wks,plot(0),"Time_max ", 89.20,33.00,txres) dum1 = gsn_add_text(wks,plot(1),"Time_min", 89.20,33.00,txres) ;************************************************ ; create panel ;************************************************ resP = True ; modify the panel plot resP@gsnFrame = False ; don't advance panel plot resP@gsnPanelLabelBar = True ; add common colorbar resP@gsnPanelMainString = "" ; set main title resP@lbTitleOn = True resP@lbTitlePosition = "Bottom" resP@lbTitleString = "Time (UTC)" ; mg/m~S~2~N~/day" resP@lbLabelFontAspectF = 1.5 resP@lbLabelFontHeightF = 0.02 ; last one 0.022 resP@lbLabelFont = 21 resP@pmLabelBarWidthF = 0.5 ; last one 0.55 resP@pmLabelBarHeightF = 0.053 ;adjuct label bar 0.092 resP@pmLabelBarOrthogonalPosF = -0.04 ; adjuct position of the label bar resP@cnLineLabelsOn = False ; turn off line labels resP@lbTitleFontHeightF = 0.015 resP@lbBoxLinesOn = False ;---Resource list for shapefile outlines plres = True plres@gsLineColor = "black" plres@gsLineThicknessF = "5" dumstr = unique_string("poly") id = gsn_add_shapefile_polylines(wks,plot,filename,plres) gsn_panel(wks, plot, (/1,2/), resP) frame(wks) end