[ncl-talk] How to plot two data set completely similar to each-other ?

Setareh Rahimi setareh.rahimi at gmail.com
Wed May 15 04:23:48 MDT 2024


Dear NCL users,
I would like to make a comparison between simulated precipitation from
WRF-Chem and GPM data.

I plotted precipitation from the WRF-Chem and the GPM (attached). However,
the plotted precipitation from the GPM is not completely similar to the one
for the WRF-Chem (label bars, and zooming). So I need your help to make the
plotted precipitation from the GPM completely similar to the plotted
precipitation from the WRF-Chem.

Please kindly advise me to sort this issue out.
Thanks.
Kind regards,


-- 
S.Rahimi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20240515/e6cba5a1/attachment-0001.htm>
-------------- next part --------------
begin
;
; Open file 
; Read U10 and V10, Cumulus (rinc) and Non-cumulus (rainnc) prc
;

  ;f       = addfile ("wrfout_d01_2021-03-10_13:00:00","r")
  f       = addfile ("wrfout_d01_2021-03-06_19:00:00","r")
 
  rainc  = f->RAINC                 ; (Time, south_north, west_east)
  rainnc  = f->RAINNC  
   
  u10     = f->U10(148:173,:,:)                   ; (Time, south_north, west_east)
  v10     = f->V10(148:173,:,:)         



 u = dim_avg_n_Wrap (u10, 0)
 v = dim_avg_n_Wrap (v10,0) 
 ;-------------------------------------------------------
;---------------------------------------------------------
  times   = wrf_user_getvar(f,"times",-1)
  ntim    = dimsizes(times)          ; # time steps
  print(times)

  ;---Set the two lat/lon corners that we want to zoom in on.
  
  minlat =   34.6
  maxlat =   36.6
  minlon =   49.7
  maxlon =   53.6


  lats = (/ minlat, maxlat /)
  lons = (/ minlon, maxlon /)
  loc  = wrf_user_ll_to_xy(f, lons, lats, True)

; Use NCL operator > to make sure all values >=0.0
; Sum components and assign attributes
;
  rainc  = rainc  > 0.0         
  rainnc  = rainnc > 0.0

  
  rainTot = rainc + rainnc
  
 
 ;printVarSummary(rainTot)
  
      
  rainTot at description = "Total Precipitation"
  rainTot at units       =  rainc at units

  wks = gsn_open_wks("png","prc-13")

           
  
  res                       = True             ; plot mods desired
  res at gsnMaximize           = True             ; maximize size
  res at gsnScalarContour      = True               ; contours desired
  res at gsnLeftString         = "Totall precipitation (mm)"
  res at gsnRightString        = "2021/03/13"

  res at cnFillPalette         = "BlAqGrYeOrReVi200" ; select color map
  res at cnFillOn              = True             ; color plot desired
  ;res at cnFillPalette         = colors           ; define colors for contour plot
  res at cnLinesOn             = False            ; turn off contour lines
  res at cnLineLabelsOn        = False            ; turn off contour labels
  res at cnFillMode            = "AreaFill"     
  ;res at cnLevelSelectionMode  = "ExplicitLevels" ; explicit [unequal] cn levels
  ;res at cnLevels              = (/0,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64,66,68,70,72,74,76,78,80,82/)
  ;res at cnLevels              = (/0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20/)  

  res at cnLevelSelectionMode = "ManualLevels"     ; set manual contour levels
  res at cnMinLevelValF       =  0             ; set min contour level
  res at cnMaxLevelValF       = 20  ; set max contour level
  res at cnLevelSpacingF      = 1         ; set contour spacing




  res at vcGlyphStyle          = "WindBarb"
  res at vcRefLengthF          = 0.025            ; ref vec length
  res at vcMinDistanceF        = 0.025            ; larger means sparser
  res at vcWindBarbTickLengthF = 0.4              ; default 0.3
  res at vcRefAnnoOn           = False
  
  res = wrf_map_resources(f,res)
  res at gsnAddCyclic          = False            ; regional data: not cyclic 
  res at tfDoNDCOverlay        = True

  res at mpFillOn                    = False
  res at mpGeophysicalLineColor      = "black"    ; wrf_map_resources uses "gray"
  res at mpUSStateLineColor          = "black"
  res at mpGeophysicalLineThicknessF = 2.0        ; wrf_map_resources uses 0.5
  res at mpUSStateLineThicknessF     = 2.0

;;;----------------------------------------------------------

  res1        = res         ; Make copy of common resource list

  res1 at ZoomIn = True        ; These five resources are required
  res1 at Xstart = loc(0,0)    ; when zooming in on WRF data and
  res1 at Xend   = loc(0,1)    ; keeping the same map projection.
  res1 at Ystart = loc(1,0)
  res1 at Yend   = loc(1,1)


  res1 = wrf_map_resources(f, res1)
  res1 at tfDoNDCOverlay              = True            ; Tells NCL this is a native projection
; res1 at tfDoNDCOverlay              = "NDCViewport"   ; NCL V6.5.0 or later

;---Overwrite some of the resources set by wrf_map_resources.
  res1 at mpUSStateLineColor          = "black"
  res1 at mpNationalLineColor         = "black"
  res1 at mpGeophysicalLineColor      = "black"
  res1 at mpUSStateLineThicknessF     = 2.0
  res1 at mpNationalLineThicknessF    = 2.0
  res1 at mpGeophysicalLineThicknessF = 2.0
;;;---------------------------------------------------------- 


  h = (rainTot(173,:,:) - rainTot(148,:,:)) 
 
  printVarSummary(h)

 plot = gsn_csm_vector_scalar_map(wks,u,v,h(loc(1,0):loc(1,1),loc(0,0):loc(0,1)),res1) 

  shapefile_name1 = "Ostan.shp"
  shapefile_name2 = "City-Poligon6.shp"
  lnres = True
  lnres at gsLineThicknessF = 6.0
  lnres at gsLineColor = "Black"
  shape1 = gsn_add_shapefile_polylines(wks,plot,shapefile_name1,lnres)
  shape2 = gsn_add_shapefile_polylines(wks,plot,shapefile_name2,lnres)



  res at gsnDraw = False
  res at gsnFrame= False


draw(plot)
frame(wks)



end

-------------- next part --------------
A non-text attachment was scrubbed...
Name: GPM-12.png
Type: image/png
Size: 90132 bytes
Desc: not available
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20240515/e6cba5a1/attachment-0002.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: WRF-12.png
Type: image/png
Size: 212887 bytes
Desc: not available
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20240515/e6cba5a1/attachment-0003.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gpm
Type: application/octet-stream
Size: 1860 bytes
Desc: not available
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20240515/e6cba5a1/attachment-0001.obj>


More information about the ncl-talk mailing list