[ncl-talk] Taking the average of t2 for 3 wrfout files
Jacob Alberto Garcia
jacob_garcia at dlsu.edu.ph
Sat Aug 6 12:54:27 MDT 2016
I am actually having problems with this as well:
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_JUN_P_10_YSU.nc","r")
t2a = fa->T2
t2a_avg = dim_avg_n_Wrap(t2a, 0)
printVarSummary(t2a_avg) ; south_north | ??] x [west_east | ??]
fb = addfile("d03_JUN_P_16.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_DEC")
gsn_define_colormap(wks,"nrl_sirkes_nowhite")
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"
res at mpFillOn = False
res at mpMaxLatF = 15.43 ; specify the plot domain
res at mpMinLatF = 13.62 ;
res at mpMinLonF = 120.02 ;
res at mpMaxLonF = 121.85 ;
res at mpOutlineOn = True ; turn the map outline on
res at gsnDraw = False ; do not draw the plot
res at gsnFrame = False
plot = gsn_csm_contour_map(wks,t2_diff,res)
draw(plot) ;
frame(wks)
I cannot plot t2_diff the error goes
fatal:ContourPlotInitialize: internal error creating levels, invalid max or
min data value
fatal:ContourPlotInitialize: error getting contour level information
fatal:ContourPlotInitialize: error initializing dynamic arrays
fatal:Unable to initialize layer-Can't Create
fatal:Unable to access object with id:-4
fatal:PID #-4 can't be found in NhlSetValues
(0) spread_colors: invalid plot: defaulting
fatal:PID #-4 can't be found in NhlSetValues
warning:overlay: bad HLU id passed in, ignoring
fatal:["Execute.c":8578]:Execute: Error occurred at or near line 7108 in
file /usr/local/lib/ncarg/nclscripts/csm/gsn_csm.ncl
fatal:["Execute.c":8578]:Execute: Error occurred at or near line 10599 in
file /usr/local/lib/ncarg/nclscripts/csm/gsn_csm.ncl
fatal:["Execute.c":8578]:Execute: Error occurred at or near line 57 in file
Ave_Diff.ncl
fatal:Variable (plot) is undefined
fatal:["Execute.c":8578]:Execute: Error occurred at or near line 59 in file
Ave_Diff.ncl
On Sun, Aug 7, 2016 at 12: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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160807/a6844853/attachment.html
More information about the ncl-talk
mailing list