Re : Help

From: Rolande Tchouaken <tnrolande_at_nyahnyahspammersnyahnyah>
Date: Thu Nov 12 2009 - 02:07:07 MST

Goog morning sir,

I have a problem with my pannel of wrf model. I want to plot in the same map contour of sea level pression and temperature, and put data observation of NCEP in this same pannel (put side by side map of wrf model and map of NCEP).

My problem is that : figure of my pannel have only temperature instead of temperaure and sea level pression. I don't know what is the problem.

This is my script:
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/csm/shea_util.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
;load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"

 
load "gsn_code_new.ncl"  
load "WRFUserARW_new.ncl"

;;************************************************
begin
;************************************************
; read in netCDF file
;************************************************
;;;;;;;;;;;;;;;;;pr lire les fichiers de 6h ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
a1  = addfile("/media/disk/simulation_rolande/wrfprd_cu1_mp6_blp1_ssp1_ralw1_rasw1_180709/wrfout_d01_2009-07-18_00:00:00.nc","r")
a2  = addfile("/media/disk/simulation_rolande/wrfprd_cu1_mp6_blp1_ssp1_ralw1_rasw1_180709/wrfout_d01_2009-07-18_06:00:00.nc","r")
a3  = addfile("/media/disk/simulation_rolande/wrfprd_cu1_mp6_blp1_ssp1_ralw1_rasw1_180709/wrfout_d01_2009-07-18_12:00:00.nc","r")

;;;;;;;;;;;;pr lire les fichiers de 12h ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 a4  = addfile("/media/disk/simulation_rolande/wrfprd_cu1_mp6_blp1_ssp1_ralw1_rasw1_180709/wrfout_d01_2009-07-18_18:00:00.nc","r")

 a5  = addfile("/media/disk/simulation_rolande/air_day.nc","r")

a6 = addfile("/media/disk/simulation_rolande/slp_day.nc","r")

tempwrf0= wrf_user_getvar(a1,"T2",0)
tempwrf0 = tempwrf0 - 273
slpwrf0= wrf_user_getvar(a1,"slp",0)
;print(slpwrf0)

tempwrf6= wrf_user_getvar(a2,"T2",0)
tempwrf6 =tempwrf6 -273
slpwrf6= wrf_user_getvar(a2,"slp",0)

tempwrf12= wrf_user_getvar(a3,"T2",0)
tempwrf12 = tempwrf12 - 273
slpwrf12= wrf_user_getvar(a3,"slp",0)

tempwrf18= wrf_user_getvar(a4,"T2",0)
tempwrf18 = tempwrf18 - 273
slpwrf18= wrf_user_getvar(a4,"slp",0)

tempncep1 =short2flt(a5->air)
tempncep = tempncep1 - 273
copy_VarCoords(tempncep1,tempncep)

slpncep1 =short2flt(a6->slp)
slpncep = slpncep1 /100
copy_VarCoords(slpncep1,slpncep)

wks = gsn_open_wks("ps" ,"tp18") 
gsn_define_colormap(wks,"gui_default")
pltres = True
  mpres = True
res = True
opts_r = True
 res@gsnDraw              = False              ; don't draw
  res@gsnFrame             = False              ; don't advance frame
res@gsnSpreadColors      = True               ; use full range of colors
res@gsnSpreadColorStart  = 7
res@gsnSpreadColorEnd  = 101
res@cnLevelSelectionMode = "ExplicitLevels"
res@cnLevels             = (/  18., 20.,22., 24.,26.,28.,30., 32, 34,36, 38,40,42/)
;res@cnLevelSelectionMode = "ManualLevels"     ; set manual contour levels
 ; res@cnMinLevelValF       = 17;290.                ; set min contour level
 ; res@cnMaxLevelValF       =  42                ; set max contour level
 ; res@cnLevelSpacingF      =  2               ; set contour spacing

       res@lbLabelBarOn        = False         ; turn off individual cb's
    res@cnFillOn               = True
   
    res@NoTitles = True   
   
       res@cnLineLabelDensityF      = 1.5
   
       res@lbLabelBarOn        = False         ; turn off individual cb's
      res@UnitLabel            = ""
res@mpMinLonF            = 0.2               ; select a subregion
  res@mpMaxLonF            = 22
  res@mpMinLatF            = 0.1
  res@mpMaxLatF            =  14
 res@mpFillOn          = False
;;;;;;;;;;;;;;;;;;;;;;;;draw national boundery map;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Map stuff                                                                        ;
 res@mpDataBaseVersion            = "Ncarg4_0"    ; use finer database             ;
  res@mpOutlineOn                 = True                                           ;
  res@mpFillOn                    = False        ; turn off gray fill              ;
 res@mpOutlineBoundarySets        = "National"   ; turn on country boundaries      ;

  res@mpNationalLineColor          = "Black"     ;"Red"
  res@mpNationalLineDashPattern    = 0                 ;1 ;for dashpattern
  res@mpNationalLineThicknessF     = 1.5
 
  res@mpGeophysicalLineColor       = "Black"       ; color of cont. outlines        ;
  res@mpGeophysicalLineThicknessF  = 1.5         ; thickness of outlines;;         ;

   res@cnFillOn = True
  res@cnFillDrawOrder  = "Predraw"   
;;;;;;;;;;;;;;;to add national boundary country;;;;;;;;;;;;;;;;;;;;;;;;;;;;;,,,,,,

 resm = True

       resm@mpOutlineBoundarySets       = "National"   ; turn on country boundaries
        resm@mpGeophysicalLineColor      = "Black"       ; color of cont. outlines
        resm@mpGeophysicalLineThicknessF = 1.5       ; thickness of outlines
     resm@gsLineDashPattern                          = 1.8  
  resm@mpDataBaseVersion           = "Ncarg4_1"    ; use finer database             ;
  resm@mpOutlineOn                 = True                                           ;
  resm@mpFillOn                    = False        ; turn off gray fill              ;
  resm@mpOutlineBoundarySets       = "National"   ; turn on country boundaries      ;

  resm@mpNationalLineColor          = "Black"     ;"Red"
  resm@mpNationalLineDashPattern    = 0                 ;1 ;for dashpattern
  resm@mpNationalLineThicknessF     = 1.5

;;;;;;;;;;;;;;;;;;;;to select my region;;;;;;;;;;;;;;;;;;;;;;;;;;;, 
  resm@mpLeftCornerLatF            = 0.1
    resm@mpLeftCornerLonF            = 0.2
   resm@mpRightCornerLatF           = 14
    resm@mpRightCornerLonF           = 22

res@vpWidthF = .870    ;7*.118  ;0.2
 res@vpHeightF =13.6  ;8*.09 ;0.8

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;pr la dimension des cartes;;;;;;;;;;;;;;;;;;;;;;;;;
;resm@vpWidthF = .870    ;7*.118  ;0.2
 ;resm@vpHeightF =7.8    ;8*.09 ;0.8
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;  resource for my first plot;;;;;;;;;;;;;;;,,,,
res = res
res@cnFillon = True
tempwrf0@description = ""
cont_tempwrf0 = wrf_contour(a1,wks, tempwrf0, res)

;;;;;;;;;;;;;;;;;;;;;;;res for my second plot;;;;;;;;;;;;;;;;;;;;;;;;;,
res2 = res
tempwrf6@description = ""
res2@cnFillon = True
cont_tempwrf6 = wrf_contour(a1,wks, tempwrf6, res2)

;;;;;;;;;;;;;;;;;;;resource for my third plot;;;;;;;;;;;;;;;;;,,,

res3 = res
tempwrf12@description = ""
res3@cnFillon = True
cont_tempwrf12= wrf_contour(a1,wks, tempwrf12, res3)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;resource for my four plot;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;,

res4 = res
tempwrf18@description = ""
 res4@cnFillon = True
cont_tempwrf18 = wrf_contour(a1,wks, tempwrf18, res4)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
        opts_psl = res     
    opts_psl@cnLevelSelectionMode = "ExplicitLevels"     ; set manual contour levels
  opts_psl@cnMinLevelValF       = 990.              ; set min contour level
  opts_psl@cnMaxLevelValF       =  1050.              ; set max contour level
  opts_psl@cnLevelSpacingF      =  1.              ; set contour spacing
       opts_psl@cnLineColor       = "Blue"
       opts_psl@cnInfoLabelOn     = False
        opts_psl@cnLineLabelFontHeightF = 0.01
        opts_psl@cnLineLabelPerimOn = False
        opts_psl@gsnContourLineThicknessesScale = 1.5
       ;  opts_psl@UnitLabel            = ""
;opts_psl@cnLineLabelsOn       = True
 ; opts_psl@gsnContourZeroLineThicknessF = 2.     ; doubles thickness of zero contour
 ; opts_psl@gsnContourNegLineDashPattern = 1     ; sets negative contours to dash pattern 1
; opts_psl@cnLevelSelectionMode = "ManualLevels"     ; set manual contour levels
;  opts_psl@cnMinLevelValF       = 900.              ; set min contour level
;  opts_psl@cnMaxLevelValF       =  1100.              ; set max contour level
;  opts_psl@cnLevelSpacingF      =  1.              ; set contour spacing
;  opts_psl@cnLineColor          = "Blue"
;  opts_psl@cnLineLabelsOn       = True
  opts_psl@gsnContourZeroLineThicknessF = 2.     ; doubles thickness of zero contour
  opts_psl@gsnContourNegLineDashPattern = 1     ; sets negative contours to dash pattern 1
       ; delete(opts_psl)

      

res5 = res; opts_psl
slpwrf0@description = ""
  slpwrf0@UnitLabel            = ""
slpwrf0@cnFillon = True
cont_slpwrf0 = wrf_contour(a1,wks, slpwrf0,res5)

res6 =res; opts_psl
slpwrf6@description = ""
res6@cnFillon = True
cont_slpwrf6 = wrf_contour(a1,wks, slpwrf6, res6)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
res7 = res;opts_psl
slpwrf12@description = ""
res7@cnFillon = True
cont_slpwrf12 = wrf_contour(a1,wks, slpwrf12, res7)

res8 =res; opts_psl
slpwrf18@description = ""
res8@cnFillon = True
cont_slpwrf18= wrf_contour(a1,wks, slpwrf18, res8)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;,
  res@mpOutlineBoundarySets       = "National"   ; turn on country boundaries
  res@mpGeophysicalLineColor      = "Black"       ; color of cont. outlines
  res@mpGeophysicalLineThicknessF = 1.5       ; thickness of outlines
  res@gsLineDashPattern                          = 1.8  
  res@mpDataBaseVersion           = "Ncarg4_1"    ; use finer database             ;
  res@mpOutlineOn                 = True                                           ;
  res@mpFillOn                    = False        ; turn off gray fill              ;
  res@mpOutlineBoundarySets       = "National"   ; turn on country boundaries      ;
  res@mpNationalLineColor          = "Black"     ;"Red"
  res@mpNationalLineDashPattern    = 0                 ;1 ;for dashpattern
  res@mpNationalLineThicknessF     = 1.5
 
 ;res@mpLimitMode                 = "Corners"  
 ;res@mpLeftCornerLatF            = 0.1
 ;res@mpLeftCornerLonF            = 0.2
 ;res@mpRightCornerLatF           = 14
 ;res@mpRightCornerLonF           = 22
; res@gsnAddCyclic                =False             ; regional data

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;,,
 res9 =res
 
 map4=gsn_csm_contour_map_overlay(wks,tempncep(0,{1000},:,:),slpncep(0,:,:),res,opts_psl)
; draw(map4)
;  frame(wks)   
 res0 =res
 map5=gsn_csm_contour_map_overlay(wks,tempncep(1, {1000}, :, :),slpncep(1, :, :),res,opts_psl)  ; create plot ;object
; draw(map5)
;  frame(wks)   
 
 res1 =res
 map6=gsn_csm_contour_map_overlay(wks,tempncep(2, {1000}, :, :),slpncep(2, :, :),res,opts_psl)
; draw(map6)
;  frame(wks)   
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 res2 =res
 map7=gsn_csm_contour_map_overlay(wks,tempncep(3, {1000}, :, :),slpncep(3, :, :),res,opts_psl)
; draw(map7)
 ; frame(wks)   
 

; Generate maps.
  resm = True
map = new(8,graphic)
 map0 = wrf_map(wks,a1,resm)
  map1 = wrf_map(wks,a1,resm)
  map2 = wrf_map(wks,a1,resm)
  map3 = wrf_map(wks,a1,resm)

 res@tmXBLabelsOn          =True
 res@tmXBTickSpacingF      = 2.
 res@tmYLLabelsOn         =True
res@tmYLTickSpacingF     = 2.

res@mpGridAndLimbOn   = True              ; turn on lat/lon lines
  res@mpPerimOn         = False             ; turn off box around plot
 ; pltres@mpGridLatSpacingF = 2.               ; spacing for lat lines
  ;pltres@mpGridLonSpacingF = 2.               ; spacing for lon lines

 wrfres           = True
  wrfres@PanelPlot = True      ; Indicate these plots are to be paneled.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;,,
   wrf_map_overlay(wks,map0,(/cont_tempwrf0,cont_slpwrf0/),wrfres)
 
  wrf_map_overlay(wks,map1,((/cont_tempwrf6,cont_slpwrf6/)),wrfres)
 
   wrf_map_overlay(wks,map2,((/cont_tempwrf12,cont_slpwrf12/)),wrfres)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 wrf_map_overlay(wks,map3,((/cont_tempwrf18,cont_slpwrf18/)),wrfres) 

    pnlres = True
pnlres@pmLabelBarOrthogonalPosF = -0.01
   pnlres@gsnMaximize         = True
  pnlres@txString   = ""
  pnlres@gsnPanelXWhiteSpacePercent = 10.
  pnlres@gsnPanelYF                 = (/0.95,0.95,5.5,5.5/)
  pnlres@gsnPanelLabelBar          = True                    ; add common colorbar
  ;pnlres@txString         = "cumul 6 heures du 18 au 19 juillet 2009"       ; add common title
   pnlres@gsnPanelBottom   = 0.10                   ; add space at bottom
  pnlres@pmLabelBarWidthF           = .6
   pnlres@tmYRLabelsOn         = False              ; no right labels
    pnlres@tmYROn               = False              ; no right tickmarks
   pnlres@amJust       = "BottomLeft"
;pnlres@lbTitleOn        = True                  ; turn on title
 pnlres@lbTitlePosition  = "Bottom" 
 ; pnlres@lbTitleString    = "(°C)"
  pnlres@lbTitleFontHeightF= .015                 ; make title smaller

  pnlres@gsnPanelFigureStringsFontHeightF = 0.008
 ;pnlres@gsnPanelFigureStrings= (/"BMJ 00h-06h","KF 00h-06h","GD 00h-06h","PER 00h-06h","BMJ 06h-12h","KF 06h-12h","GD 06h-12h","PER 06h-12h","BMJ 12h-18h",\
;"KF 12h-18h","GD 12h-18h","PER 12h-18h","BMJ 18h-00h","KF 18h-00h","GD 18h-00h","PER 18h-00h"/)

gsn_panel(wks,(/map0,map4,map1,map5,map2,map6,map3,map7/),(/4,2/),pnlres)

end

Thank for your comprehension.

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Nov 12 02:06:24 2009

This archive was generated by hypermail 2.1.8 : Sat Nov 14 2009 - 12:49:36 MST