[Wrf-users] ncl moiture fluxes

Harnos, Daniel harnos1 at illinois.edu
Tue Jun 12 21:14:09 MDT 2012


Obadias,

You never define the plot array "plot".  For a 4-panel plot, add the following within the time loop but before the pressure level loop:
plot = new(4,graphic)

There is also a warning being produced by your code relating to PanelPlot being improperly used as a map resource.  To get rid of it without impacting your output, delete the following:
mpres at PanelPlot = True      ; Indicate these plots are to be paneled.

Good luck,
~Dan


From: Obadias Cossa <objacoe at hotmail.com<mailto:objacoe at hotmail.com>>
Date: Tuesday, June 12, 2012 5:05 PM
To: WRF USERS <wrf-users at ucar.edu<mailto:wrf-users at ucar.edu>>
Subject: [Wrf-users] ncl moiture fluxes

Hello!
May anyone help on correcting this script. Its showing error on line  plot(0) = wrf_map_overlays(a,wks,(/vector/),pltres,mpres) , but when I check the wrf_map_overlays syntax lookx fine.
See whole script is below!

Obadias

load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
begin
;
; The WRF ARW input file.
; This needs to have a ".nc" appended, so just do it.
  a = addfile("/media/Obedias/medias/DJF_I/DJF_2001.nc","r") ; DJF_2001.nc is a normao wrf_out file.
; We generate plots, but what kind do we prefer?
  type = "pdf"
; type = "pdf"
  wks  = gsn_open_wks(type,"overlay_1")
; Set some Basic Plot options
  res = True
  res at MainTitle                   = "moisture flux trial"
  ;res at Footer = False
  pltres = True
  mpres = True
  mpres at mpGeophysicalLineColor      = "Black"
  mpres at mpNationalLineColor         = "Black"
  mpres at mpUSStateLineColor          = "Black"
  ;mpres at mpGridLineColor             = "Black"
  mpres at mpLimbLineColor             = "Black"
  mpres at mpPerimLineColor            = "Black"
  mpres at mpGeophysicalLineThicknessF = 2.0
  ;mpres at mpGridLineThicknessF        = 1.0
  mpres at mpLimbLineThicknessF        = 2.0
  mpres at mpNationalLineThicknessF    = 2.0
  mpres at mpUSStateLineThicknessF     = 1.0

      pltres at PanelPlot = True      ; Indicate these plots are to be paneled.
      pltres at PanelPlot = True      ; Indicate these plots are to be paneled.
      mpres at PanelPlot = True      ; Indicate these plots are to be paneled.
      mpres at PanelPlot = True      ; Indicate these plots are to be paneled.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; What times and how many time steps are in the data set?
  times  = wrf_user_list_times(a)  ; get times in the file
  ;ntimes = dimsizes(times)         ; number of times in the file.
  ntimes = dimsizes(1)         ; number of times in the file
; The specific pressure levels that we want the data interpolated to.
  pressure_levels = (/ 850., 700., 500., 300./)   ; pressure levels to plot
  nlevels         = dimsizes(pressure_levels)     ; number of pressure levels
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

  do it = 0,ntimes-1,1             ; TIME LOOP
    print("Working on time: " + times(it) )
    ;res at TimeLabel = times(it)   ; Set Valid time to use on plots
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; First get the variables we will need
    u  = wrf_user_getvar(a,"ua",it)        ;
    v  = wrf_user_getvar(a,"va",it)        ;
    p  = wrf_user_getvar(a, "pressure",it) ;
    rh = wrf_user_getvar(a,"rh",it)        ;
   ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    do level = 0,nlevels-1                 ; LOOP OVER LEVELS

      pressure = pressure_levels(level)
       rh_plane = wrf_user_intrp3d(rh,p,"h",pressure,0.,False) ;
      u_plane  = wrf_user_intrp3d( u,p,"h",pressure,0.,False)
      v_plane  = wrf_user_intrp3d( v,p,"h",pressure,0.,False)
      qu_plane = rh_plane*u_plane                            ; for fluxs
      qv_plane= rh_plane*v_plane                             ; for fluxs

      ; Plotting options for Moisture flux
        gsn_define_colormap(wks,"sunshine_9lev")             ; ("BlWhRe")
        ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
        opts = True
        opts at InitTime = False     ;Plot initial time on graphic. If True, the initial time will be extracted from the input file.
        opts at ValidTime= False     ; Plot valid time on graphic. Default is True. A user must set opts at TimeLabel to the correct time.
        opts at vcGlyphStyle     = "CurlyVector"             ; turn on curley vectors
        opts at FieldTitle = "Moiture flux"   ; overwrite Field Title
        opts at NumVectors = 40       ; wind barb density
        vector = wrf_vector(a,wks,qu_plane,qv_plane,opts)
    ;#######Genito########
     pltres at gsnFrame             = False        ; do not advance frame
     mpres at gsnFrame             = False        ; do not advance frame
    ;#########################
      if ( pressure .eq. 850 ) then   ; plot temp, rh, height, wind barbs
         plot(0) = wrf_map_overlays(a,wks,(/vector/),pltres,mpres)
          map0=plot(0) ; keep in the memory
        end if

        if ( pressure .eq. 700 ) then   ; plot temp, height, wind barbs
          plot(1) = wrf_map_overlays(a,wks,(/vector/),pltres,mpres)
          map1=plot(1);
        end if

        if ( pressure .eq. 500 ) then   ; plot temp, height, wind barbs
          plot(2) = wrf_map_overlays(a,wks,(/vector/),pltres,mpres)
          map2=plot(2);
        end if

        if ( pressure .eq. 300 ) then   ; plot windspeed, height, wind barbs
         plot(3) = wrf_map_overlays(a,wks,(/vector/),pltres,mpres)
          map3=plot(3);
         end if
  ;     delete(opts_z)

      pnlres = True
          pnlres at gsnFrame             = False        ; do not advance frame
          pnlres at gsnPanelYWhiteSpacePercent = 5
          pnlres at gsnPanelXWhiteSpacePercent = 5 ; Adds the white space to the panel plot.
          pnlres at gsnPanelFigureStrings= (/"(a)","(b)","(c)","(d)"/)
;      gsn_panel(wks,plot,(/2,2/),pnlres)
;***************************************************************************************
   end do       ; END OF LEVEL LOOP
   end do        ; END OF TIME LOOP

      gsn_panel(wks,(/map0,map1,map2,map3 /),(/2,2/),pnlres)
          frame(wks) ; coloque num frame
end

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/wrf-users/attachments/20120613/cc9f054f/attachment-0001.html 


More information about the Wrf-users mailing list