[ncl-talk] Help Required in plotting average 2m temperature for 24 hours for 30 days in NCL

Muhammad Omer Mughal m.mughal1 at postgrad.curtin.edu.au
Wed Oct 11 02:53:41 MDT 2017


Hi Mary


Kindly see the script below which I use with the bash script to determine the average of 2M TEMPERATURE contained in the whole of WRF out directory. I intend to skip the first 12 hours (spin up time) and I also tend to plot the final average in one plot. Kindly let me know if you can help me out


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/wrf/WRFUserARW.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
load "/data/muhdomer/NSCC/scratch/WRF_myfunc.ncl"
begin

 DATADir = "./"

  FILES   = systemfunc (" ls -1 " + DATADir + "wrfout_d05* ")

  a       = addfiles(FILES+".nc","r")


  tc2 = wrf_user_getvar(a,"T2",-1)
  tc2 = tc2-273.16
  times = a[:]->Times
  ntimes = dimsizes(times)         ; number of times in the file
  ntimes_plot = ntimes(0)        ; abandon the first 12 hours


  lh3d = new((/30,129,210/), float)
  lh2d = new((/129,210/), float)
    c = 0
    do i=time_serie, ntimes_plot-2,24
       lh2d(:,:) = tc2(i,:,:)
       lh3d(c,:,:) = lh2d(:,:)
       c = c + 1
    end do
    lh_avg = dim_avg_n(lh3d,0)
  type = "x11"
wks= gsn_open_wks(type,"temp_"+hour)
    gsn_define_colormap(wks,"spread_15lev")

  res = True
  res at cnLevelSelectionMode = "ExplicitLevels"
  res at cnLevels=(/24,25,26,27,28,29,30,31,32,33,34,35,36/)
  res at InitTime = False
  res at Footer = False
  res at gsnMaximize = True
  res at gsnPaperOrientation = "landscape"
  pltres = True
  pltres at NoTitles = True
  pltres at gsnMaximize = True
  pltres at FramePlot = False
  pltres at PanelPlot = True
  mpres = True
  mpres at mpFillOn = False
  mpres at mpGeophysicalLineColor = "black"
  mpres at mpGeophysicalLineThicknessF       = 0.0   ; for type = "png"
  mpres at mpDataBaseVersion="Ncarg4_1"
  mpres at mpDataSetName="Earth..4"
  mpres at mpDataResolution="Finest"
  mpres at mpOutlineOn=False

  lh_avg at description = "temperature averaged"

  lh_avg at units = "degree C"
       opts = res
      opts at cnFillOn = True
     contour_lh = wrf_contour(a[0],wks,lh_avg,opts)
      delete(opts)
      plot = wrf_map_overlays(a[0],wks,contour_lh,pltres,mpres)

   shape_files = (/"/data/muhdomer/NSCC/scratch/Shapefiles/MYS_adm0.shp","/data/muhdomer/NSCC/scratch/Shapefiles/IDN_adm0.shp","/data/muhdomer/NSCC/scratch/Shapefiles/MP14_REGION_NO_SEA_PL.shp"/)

     plot = add_coastline_sgmyid(shape_files,wks,plot,"black")

     draw(plot)
     frame(wks)
end


Regards


Muhammad Omer

Muhammad Omer Mughal
MSc BSc Mechanical Engineering
PhD  Research Scholar
Remote Sensing and Satellite Research Group
Department of Imaging and Applied Physics
Curtin University

Curtin University
Tel | +61 8 9266 7962
Fax | +61 8 9266 2377
Mobile | 0470 237 525

Email | m.mughal1 at postgrad.curtin.edu.au<mailto:m.lynch at curtin.edu.au>
Web | http://curtin.edu.au<http://curtin.edu.au/>

Curtin University is a trademark of Curtin University of Technology.
CRICOS Provider Code 00301J (WA), 02637B (NSW)


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20171011/212b68ba/attachment.html>


More information about the ncl-talk mailing list