load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl" load "./shapefile_utils.ncl" ; shp_filename = "./GolfoNORTE_Project.shp" a = addfile("./FEB200208.nc","r") ; Open a fil shp_filename = addfile("./GolfoNORTE_Project.shp" ,"r") ;We generate plots, but what kind do we prefer? ; type = "x11" type = "pdf" ; type = "ps" ; type = "ncgm" wks = gsn_open_wks(type,"mask") ; Set some Basic Plot options res = True res@MainTitle = "REAL-TIME WRF" pltres = True mpres = True pltres@PanelPlot = True times = wrf_user_getvar(a,"times",-1) ; get all times in the file ntimes = dimsizes(times) ; number of times in the file do it = 0,6 ;ntimes-1 ;Modificado para hacerlo cada3 tiempos TIME LOOP print("Working on time: " + times(it) ) res@TimeLabel = times(it) ; Set Valid time to use on plots ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; First get the variables we will need tc = wrf_user_getvar(a,"tc",it) ; 3D tc var=tc(0,:,:) copy_VarMeta(tc,var) printVarSummary(var) ; Plotting options for T opts = res opts@cnFillOn = True opts@cnLinesOn = True opts@lbLabelBarOn = True opts@lbTitleOn = True opts@lbTitleFontHeightF = 0.00002 opts@lbLabelFontHeightF = 0.04 opts@gsnSpreadColorEnd = -3 ; End third from the last color in color map contour_tc = wrf_contour(a,wks,tc(0,:,:),opts) delete(opts) ;---Set masking options for shapefile_mask_data function opt = True opt@shape_var = "NAME_1" opt@shape_names = "GOLFO" opt@debug = True opt@keep = True data_keep = shapefile_mask_data(var,shp_filename,opt) printMinMax(data_keep,0) ;---Start the graphics res = True res@gsnMaximize = True ; maximize plot in frame res@gsnDraw = False ; don't draw plot res@gsnFrame = False ; don't advance frame res@mpFillOn = False ; Turn these off because we're res@mpOutlineOn = False ; adding our own outlines ;---Zoom in on map if desired ; res@mpMinLatF = minlat ; res@mpMaxLatF = maxlat ; res@mpMinLonF = minlon ; res@mpMaxLonF = maxlon ; res@mpCenterLonF = (res@mpMinLonF + res@mpMaxLonF) / 2. ; res@gsnAddCyclic = False ; res@cnFillOn = True ; res@cnLinesOn = False ; res@cnLineLabelsOn = False ; res@lbLabelBarOn = False ;---Generate nice contour levels mnmxint = nice_mnmxintvl( min(data), max(data), 18, False) res@cnLevelSelectionMode = "ManualLevels" res@cnMinLevelValF = mnmxint(0) res@cnMaxLevelValF = mnmxint(1) res@cnLevelSpacingF = mnmxint(2) ;---Create contour plot over map res@tiMainString = "Original data" plot_orig = gsn_csm_contour_map(wks,data,res) ;---Create a map with the same map limits as previous plot res@tiMainString = "Data over Alaska discarded" plot_mask = gsn_csm_contour_map(wks,data_mask,res) ;---Create a map with the same map limits as previous plot res@tiMainString = "Data over Alaska retained" plot_keep = gsn_csm_contour_map(wks,data_keep,res) ;---Add the outlines to both plots. lnres = True lnres@gsLineColor = "Grey25" dum1 = gsn_add_shapefile_polylines(wks,plot_orig,shp_filename,lnres) dum2 = gsn_add_shapefile_polylines(wks,plot_mask,shp_filename,lnres) dum3 = gsn_add_shapefile_polylines(wks,plot_keep,shp_filename,lnres) ;---Panel three plots for comparison. pres = True pres@gsnMaximize = True pres@gsnPanelLabelBar = True pres@pmLabelBarWidthF = 0.8 pres@lbLabelFontHeightF = 0.015 pres@gsnPanelRowSpec = True gsn_panel(wks,(/plot_orig,plot_mask,plot_keep/),(/1,2/),pres) end do end