[ncl-talk] How to define date for WRF-chem to get average daily of a variable ?

Setareh Rahimi setareh.rahimi at gmail.com
Wed Oct 5 09:29:45 MDT 2022


Dear NCL users,

I am trying to plot the daily average of AOD (aerosol optical depth) from
WRF-chem outputs. However, I can not define the time so that NCL plots the
daily average of AOD.(the script has been attached, and the model output is
too large and I just used ncdump to show the header of some varibles ).
I tried the following commands:


times = wrf_user_getvar(f,"times",-1)
printVarSummary(times)
print(times)
ymdh = cd_calendar(a2&times, -2)
  print(ymdh)

but faced an error.
Would you please kindly advise me on how can I calculate the daily average
of AOD from the hourly output of WRF-chem?
Many thanks in advance,
Best wishes,
-- 
S.Rahimi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20221005/afd2d70e/attachment.htm>
-------------- next part --------------
;*************************************************
; WRF: DUST_5
;************************************************
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/WRF_contributed.ncl"

begin

f = addfile ("wrfout_d01_2011-07-01_00/00/12", "r")
wks = gsn_open_wks("pdf" ,"WRF_aod") ; ps,pdf,x11,ncgm,eps 
gsn_define_colormap(wks,"BlAqGrYeOrReVi200") ; select color map



res = True    ; plot mods desired
res at cnConstFEnableFill =  True
res at gsnMaximize = True
res at gsnSpreadColors = True
res at cnFillOn = True
res at cnLinesOn = False
res at cnLineLabelsOn = False
WRF_map_c(f, res, 0)
res at tfDoNDCOverlay = True
res at pmTickMarkDisplayMode = "Always"

opt_sd = True
opt_sd at PrintStat = True
stat_x = stat_dispersion(x1, opt_sd )
print("-----")


a2 = f->TAUAER2
aDay = calculate_daily_values (a2, "avg", 0, opt)
   printVarSummary(aDay)
   printMinMax (aDay,1)

 b3 = f->TAUAER3
 bDay = calculate_daily_values (b3, "avg", 0, opt)
  printVarSummary(bDay)
     printMinMax (bDay,1)
;----------------------------------------------------------------------
times = wrf_user_getvar(f,"times",-1)
printVarSummary(times)
print(times)
ntimes = dimsizes(times)

ymdh = cd_calendar(a2&times, -2)
  print(ymdh)

;-----------------------------------------------------------------------
angstrom_exponent = -(log(aDay)-log(bDay))/log(400/600)
 printVarSummary(angstrom_exponent)

AOD550_3D = aDay * ((400/550)^angstrom_exponent)
printVarSummary(AOD550_3D)

AOD550_2D = dim_sum_n_Wrap(AOD550_3D,0)

if (any(isnan_ieee(AOD550_2D))) then
	value = 9.96921e+36
	replace_ieeenan (AOD550_2D,value,0)
	AOD550_2D at _FillValue = value
end if

 printVarSummary(AOD550_2D)
   printMinMax (AOD550_2D,1)

res at tiMainString = "WRF-CHEM (aod_550) " + times(nt)
res at gsnLeftString = a2 at description

plot = gsn_csm_contour_map(wks,AOD550_2D(:,:),res)

end

-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screen Shot 1401-07-13 at 6.56.43 PM.png
Type: image/png
Size: 162605 bytes
Desc: not available
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20221005/afd2d70e/attachment.png>


More information about the ncl-talk mailing list