[ncl-talk] Taking the average of t2 for 3 wrfout files
Dennis Shea
shea at ucar.edu
Tue Aug 9 10:39:11 MDT 2016
Please see the addfiles documentation
diri = "./"
fili = (/ "FOO_1", "FOO_2.nc", "FOO_3.nc" /)
pthi = diri+fili
f = addfiles(pthi, "r")
T2 = f[:]->T2
printVarSummary(T2)
T2_avg = dim_avg_n_Wrap(T2, 0)
printVarSummary(T2_avg)
;======
http://www.ncl.ucar.edu/Document/Functions/Built-in/addfiles.shtml
Good luck
fa = addfile("d03_FEB_YSU_F.nc","r")
t2a = fa->T2
t2a_avg = dim_avg_n_Wrap(t2a, 0)
printVarSummary(t2a_avg) ; south_north | ??] x [west_east | ??]
fb = addfile("d03_Feb_MYJ_f.nc","r")
t2b = fb->T2
t2b_avg = dim_avg_n_Wrap(t2b, 0)
printVarSummary(t2b_avg) ; south_north |??] x [west_east | ??]
On Sat, Aug 6, 2016 at 10:13 AM, Jacob Alberto Garcia <
jacob_garcia at dlsu.edu.ph> wrote:
> Hello,
>
> I want to take the three files and find the time average of the 2 meter
> temperature. I have this script here that calculates the mean difference of
> T2 for the two files given below. What I want to do is instead of just one
> month, I'd like to Average three months for the YSU and three months for
> the MYJ simulations. What do I change in this script?
>
>
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
> ;load "./WRFUserARW.ncl"
>
> fa = addfile("d03_FEB_YSU_F.nc","r")
> t2a = fa->T2
> t2a_avg = dim_avg_n_Wrap(t2a, 0)
> printVarSummary(t2a_avg) ; south_north | ??] x [west_east | ??]
>
> fb = addfile("d03_Feb_MYJ_f.nc","r")
> t2b = fb->T2
> t2b_avg = dim_avg_n_Wrap(t2b, 0)
> printVarSummary(t2b_avg) ; south_north |??] x [west_east | ??]
>
> t2_diff = t2a_avg-t2b_avg
> copy_VarMeta(t2a_avg, t2_diff)
> t2_diff at long_name = "T2 Difference"
> t2_diff at units = t2a at units
> printVarSummary(t2_diff) ; south_north |??] x [west_east | ??]
>
> ; We generate plots, but what kind do we prefer?
> type = "pdf"
> ; type = "pdf"
> ; type = "ps"
> ; type = "ncgm"
>
> wks = gsn_open_wks(type,"plot_DIFF_d03_FEB")
> gsn_define_colormap(wks,"BlueDarkRed18")
>
>
>
> pltres = True
> mpres = True
> res = True
> mpres at mpDataBaseVersion = "HighRes"
> res at MainTitle = "2 meter temperature Difference"
> mpres at mpGridAndLimbOn = False
> res at gsnMaximize = True
> res at cnFillOn = True
> res at gsnSpreadColors = True
> res at cnLinesOn = False
> res at cnLineLabelsOn = False
> mpres at mpGeophysicalLineColor = "Black"
>
>
>
>
> plot = gsn_csm_contour_map(wks,t2_diff,res)
>
> contour_DIFF = wrf_contour(fa,wks,t2_diff,res)
>
> plot = wrf_map_overlays(fa,wks,(/contour_DIFF/),pltres,mpres)
>
> ===========================================================
>
> Would something like this work?
>
>
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
> ;load "./WRFUserARW.ncl"
>
> fa = addfile("d03_DEC_YSU_F.nc","r")
> faa=addfile("d03_JAN_YSU_F.nc",r)
> faaa=addfile('d03_FEB_YSU_F.nc",r)
> t2a = fa->T2
> t2aa = faa->T2
> t2aaa = faaa-> T2
> t2a_avg = dim_avg_n_Wrap(t2a, t2aa, t2aaa, 0)
> printVarSummary(t2a_avg) ; south_north | ??] x [west_east | ??]
>
> fb = addfile("d03_Dec_MYJ_f.nc","r")
> fbb = addfile("d03_Jan_MYJ_f.nc","r")
> fbbb = addfile("d03_Feb_MYJ_f.nc","r")
> t2b = fb->T2
> t2bb = fbb->T2
> t2bbb = fbbb ->T2
> t2b_avg = dim_avg_n_Wrap(t2b, t2bb, t2bbb, 0)
> printVarSummary(t2b_avg) ; south_north |??] x [west_east | ??]
>
> t2_diff = t2a_avg-t2b_avg
> copy_VarMeta(t2a_avg, t2_diff)
> t2_diff at long_name = "T2 Difference"
> t2_diff at units = t2a at units
> printVarSummary(t2_diff) ; south_north |??] x [west_east | ??]
>
> ; We generate plots, but what kind do we prefer?
> type = "pdf"
> ; type = "pdf"
> ; type = "ps"
> ; type = "ncgm"
>
> wks = gsn_open_wks(type,"plot_DIFF_d03_FEB")
> gsn_define_colormap(wks,"BlueDarkRed18")
>
>
>
> pltres = True
> mpres = True
> res = True
> mpres at mpDataBaseVersion = "HighRes"
> res at MainTitle = "2 meter temperature Difference"
> mpres at mpGridAndLimbOn = False
> res at gsnMaximize = True
> res at cnFillOn = True
> res at gsnSpreadColors = True
> res at cnLinesOn = False
> res at cnLineLabelsOn = False
> mpres at mpGeophysicalLineColor = "Black"
>
>
>
>
> plot = gsn_csm_contour_map(wks,t2_diff,res)
>
> contour_DIFF = wrf_contour(fa,wks,t2_diff,res)
>
> plot = wrf_map_overlays(fa,wks,(/contour_DIFF/),pltres,mpres)
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> <http://www.dlsu.edu.ph> <https://www.facebook.com/DLSU.Manila.100>
> <http://instagram.com/dlsu> <https://twitter.com/dlsumanila>
> <http://dlsumanila.tumblr.com/> <http://iblog.lasalle.ph/>
>
> DISCLAIMER AND CONFIDENTIALITY NOTICE
> The information contained in this e-mail, including those in its
> attachments, is confidential and intended only for the person(s) or
> entity(ies) to which it is addressed. If you are not an intended recipient,
> you must not read, copy, store, disclose, distribute this message, or act
> in reliance upon the information contained in it. If you received this
> e-mail in error, please contact the sender and delete the material from any
> computer or system. Any views expressed in this message are those of the
> individual sender and may not necessarily reflect the views of De La Salle
> University.
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160809/10bffb83/attachment.html
More information about the ncl-talk
mailing list