Limit height in a meteogram

From: Vanesa Bdm <vane_bdm_at_nyahnyahspammersnyahnyah>
Date: Fri Sep 30 2011 - 09:25:16 MDT

Hello: I'm trying to draw a meteogram, but I want to limit the height in 8km. How should I do this? I attach my script... ; Example series of plotting meteograms with WRF ARW model data ; First let's just get and plot t2 at a point ; Add some inrfto to the plot ; Add slp to the plot ; Add a time-Z plot above slp and t2 ; Use wrf_user_ll_to_ij to get the point of interest ; Clean up the plot ;*********************************************** 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/wrf/WRFUserARW.ncl" ;*********************************************** begin ;*********************************************** a = addfile("wrfout_d01.nc","r") ;----------------------------------------------------------------------- ; Find the ij location for the point if interest   lat = -22.721949   lon = -65.695454   llres = True   llres@ReturnInt = True   ; Return integer values   locij = wrf_user_ll_to_ij(a, lon, lat, llres)   locij = locij - 1        ; array pointers in NCL space   locX = locij(0)   locY = locij(1)   taus = (/ 1., 2., 3., 4., 5., 6., 7., 8., 9., 10., 11., 12., 13., 14., 15., 16., 17., 18., 19., 20., 21., 22., 23., 24., 25., 26., 27., 28., 29., 30., 31., 32., 33., 34., 35., 36., 37., 38., 39., 40., 41., 42., 43., 44., 45., 46., 47., 48., 49. /)       ; create a time reference ; get time information and strip out the day and hour   times_in_file = a->Times   dims = dimsizes(times_in_file)   times = new(dims(0),string)   do i=0,dims(0)-1     times(i) = chartostring(times_in_file(i,8:12))   end do   wks = gsn_open_wks("ps","meteo_abrapampa")    ; open a workstation ;----------------------------------------------------------------------- gsn_define_colormap(wks,"WhBlGrYeRe")   rain_res    = True   t2    = wrf_user_getvar(a,"T2",-1)    ; get t2 for all times   t2=t2-273.15   t2@description="Temp a 2 M"   slp   = wrf_user_getvar(a,"slp",-1)   ; get slp for all times   tc    = wrf_user_getvar(a,"tc",-1)    ; get tc for all times   uvmet = wrf_user_getvar(a,"uvmet",-1) ; get rotated u and v comp of wind   tc    = wrf_user_getvar(a,"tc",-1)    ; get tc for all times   rain_exp = wrf_user_getvar(a,"RAINNC",-1)   rain_con = wrf_user_getvar(a,"RAINC",-1)   rain = rain_exp + rain_con   printVarSummary(t2)   printVarSummary(slp)   printVarSummary(tc)   printVarSummary(uvmet)   printVarSummary(rain)   umet = uvmet(0,:,:,:,:)   vmet = uvmet(1,:,:,:,:) ;-----------------------------------------------------------------------   rain_point  = rain(:,locY,locX)   t2_point  = t2(:,locY,locX)           ; extract a time series at a point   slp_point = slp(:,locY,locX)   tc_point  = tc(:,:,locY,locX)   u_point   = umet(:,:,locY,locX)   v_point   = vmet(:,:,locY,locX)   ; Swap the dimensions as we want to plot time on the X axis later   tt        = tc_point(bottom_top|:,Time|:)   ugrid     = u_point(bottom_top|:,Time|:)   vgrid     = v_point(bottom_top|:,Time|:) ;-----------------------------------------------------------------------   res2D = True                            ; Set basic resources   res2D@gsnDraw              = False      ; Don't draw individual plot.   res2D@gsnFrame             = False      ; Don't advance frame.   res2D@vpXF                 = 0.15       ; x location   res2D@vpYF                 = 0.90       ; y location   res2D@vpWidthF             = 0.65       ; width   res2D@vpHeightF            = 0.30       ; height   res2D@tiXAxisString        = "Dia_Hora"   res2D@tiXAxisFontHeightF   = 0.016   res2D@tmXBMode             = "Explicit"   res2D@tmXBValues           = taus   res2D@tmXBLabels           = times        res2D@tmXBLabelJust        = "CenterCenter"   res2D@tmXBLabelFontHeightF = .012  ; res2D@gsnAddCyclic         = False   res2D@tmLabelAutoStride  = True   tt_res = res2D   tt_res@sfXArray                 = taus   ;tt_res@gsnAddCyclic             = False   tt_res@gsnSpreadColors          = True             ; use full range of colors   tt_res@cnFillOn                 = True             ; turns on color fill   ;tt_res@cnLevelSelectionMode     = "ManualLevels"   ; set levels manually   ;tt_res@cnMinLevelValF           = -60.   ;tt_res@cnMaxLevelValF           = 5.   ;tt_res@cnLevelSpacingF          = 0.5   tt_res@cnLinesOn                = False   tt_res@cnLineLabelsOn           = False   tt_res@cnInfoLabelOn            = False   tt_res@pmLabelBarDisplayMode    = "Always"         ; Add a label bar   tt_res@pmLabelBarSide           = "right" ;  tt_res@lbOrientation              = "vertical"   tt_res@pmLabelBarOrthogonalPosF = -0.05   tt_res@pmLabelBarParallelPosF   = 0.04   tt_res@lbAutoManage             = False   tt_res@lbLabelAutoStride        = True   tt_res@lbOrientation            = "vertical"   tt_res@lbPerimOn                = False   tt_res@lbJustification          = "BottomLeft"   tt_res@lbBoxMinorExtentF        = 0.13   tt_res@lbLabelFontHeightF       = 0.012   tt_res@lbBoxLinesOn             = False   tt_res@tiMainString             = "JUJUY: Abra Pampa"  ; tt_res@gsnAddCyclic         = False   uv_res = res2D   uv_res@vfXArray         = taus   ;uv_res@gsnAddCyclic     = False   uv_res@vcRefAnnoOn      = False         ; turns off the ref vector   uv_res@vcRefLengthF     = 0.040         ; set length of ref vector   uv_res@vcGlyphStyle     = "WindBarb"    ; turn on wind barbs   ;-----------------------------------------------------------------------   res1D = True                            ; Set basic resources both will use   res1D@vpXF              = 0.15          ; The left side of the box location   res1D@vpWidthF          = 0.70          ; The Width of the plot box   res1D@vpHeightF         = 0.10          ; The height of the plot box   res1D@tmXBMode          = "Explicit"    ; Define own tick mark labels.   res1D@tmXBValues        = taus          ; location of explicit labels   res1D@tmXBLabels        = times         ; labels are the locations   res1D@tmXTOn            = False         ; turn off the top tick marks   res1D@xyLineThicknesses = 2             ; increase line thickness   res1D@gsnDraw           = False         ; Don't draw individual plot.   res1D@gsnFrame          = False         ; Don't advance frame. ;  res1D@gsnAddCyclic         = False   res1D@tmLabelAutoStride  = True   slp_res = res1D   slp_res@vpYF            = 0.50          ; The top side of the plot box loc   slp_res@xyLineColor     = "red"         ; set line color   slp_res@tiYAxisString   = "PMSL"        ; set y-axis string   t2_res = res1D   t2_res@vpYF             = 0.35          ; The top side of the plot box loc   t2_res@xyLineColor      = "blue"        ; set line color ;----------------------------------------------------------------------- ;*********************************************** ; rain histogram only resources ;***********************************************   rain_res = res1D   rain_res@vpXF            = 0.15   ; The left side of the box location   rain_res@vpYF            = 0.20   ; The top side of the plot box location   rain_res@vpWidthF        = 0.70   ; The Width of the plot box   rain_res@vpHeightF       = 0.10   ; The height of the plot box   rain_res@tiXAxisString  = ""                ; X axis label.   rain_res@tiYAxisString  = "Precipitacion"  ; Y axis label. ;  rain_res@tmXBMode       = "Explicit" ; Define own tick mark labels.   rain_res@tmXBValues     = taus       ; location of explicit labels   rain_res@tmXBLabels     = times   rain_res@tmXTOn         = False             ; turn off the top tickmarks   rain_res@trYMinF         = 0.0    ; min value on y-axis   rain_res@trXMinF         = 0.0    ; min value on x-axis   rain_res@xyLineThicknesses = 2    rain_res@tmXBMinorOn    = False             ; No minor tick marks.   rain_res@gsnDraw         = False            ; Don't draw individual plot.   rain_res@gsnFrame        = False            ; Don't advance frame.   rain_res@gsnYRefLine     = 0.0              ; create a reference line   rain_res@gsnAboveYRefLineColor = "green"    ; above ref line fill green   rain_res@gsnXYBarChart   = True             ; turn on bar chart     ;-----------------------------------------------------------------------   ttfill    = gsn_contour(wks,tt,tt_res)   windlayer = gsn_vector(wks,ugrid,vgrid,uv_res)   overlay(ttfill,windlayer)   slp_plot  = gsn_csm_xy(wks,taus,slp_point,slp_res)   t2_plot  = gsn_csm_xy(wks,taus,t2_point,t2_res)   rain_plot  = gsn_csm_xy(wks,taus,rain_point,rain_res)   draw(ttfill)   draw(slp_plot)   draw(t2_plot)   draw(rain_plot)   frame(wks)                            ; now frame the plot   ;----------------------------------------------------------------------- end

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Sep 30 09:25:23 2011

This archive was generated by hypermail 2.1.8 : Sun Oct 09 2011 - 13:05:26 MDT