Dear Ncl _talk
I did the average during afternoon time for latent heat flux as the
following code.
But when I plot it out the values are lesser than -30
It does not seem right to me.
Anyone can help me what wrong with my code.
Thanks
dirs = "/usr/rmt_share/tgdata/hrldas/workspace/jam2/india_out/" ;
change directory
filesn = systemfunc("ls " + dirs + "200511*LDASOUT*.nc")
filesn1 = systemfunc("ls " + dirs + "2006*LDASOUT*.nc")
f = addfiles(filesn, "r") ; change to filesn1 if 2006 )
x = f[:]->HFX(:,:,:) ; (Time,
south_north, west_east)
dirk = "/usr/rmt_share/tgdata/hrldas/workspace/jam2/india_gemout/"
filesk = systemfunc("ls " + dirk + "200511*LDASOUT*.nc")
filesk1 = systemfunc("ls " + dirs + "2006*LDASOUT*.nc")
g = addfiles(filesk, "r")
y = g[:]->HFX(:,:,:)
ntim = 700
nStrt = 5
nJump = 3
nSkip = 23
do n = 5,ntim,nSkip
n1 = n
n2 = n1+nJump
print("n1="+n1+" n2="+n2)
x1 = x(n1:n2,:,:)
y1 = y(n1:n2,:,:)
xavg = dim_avg_n(x1,0)
yavg = dim_avg_n(y1,0)
end do
xavg@units = " (a) (Default)"
yavg@units = " (b) (GEM)"
printVarSummary(yavg)
printVarSummary(xavg)
x@lat2d = lat2d
x@lon2d = lon2d
y@lat2d = lat2d
y@lon2d = lon2d
;************************************************
; The file should be examined via: ncdump -v grid_type static.wrsi
; This will print the print type. then enter below.
;************************************************
projection = "LambertConformal"
;************************************************
; create plots
;************************************************
wks = gsn_open_wks("ps" ,"sh_Nov2005avg_noon") ; ps,pdf,x11,ncgm,eps
gsn_define_colormap(wks ,"BlAqGrYeOrReVi200"); choose colormap
res = True ; plot mods desired
res@gsnSpreadColors = True ; use full range of colormap
res@cnFillOn = True ; color plot desired
; res@mpMinLonF = -120 ; set min lon
; res@mpMaxLonF = -85 ; set max lon
; res@mpMinLatF = 30. ; set min lat
res@vpWidthF = 0.9 ; height and width of plot
res@vpHeightF = 0.4
res@cnLinesOn = False ; turn off contour lines
res@cnLineLabelsOn = False ; turn off contour labels
res@lbLabelBarOn = False ; turn off individual lb's
res@cnFillMode = "RasterFill" ; activate raster mode
res@cnLevelSelectionMode = "ManualLevels" ; set manual contour
levels
res@cnMinLevelValF = -50 ; set min contour level
res@cnMaxLevelValF = 200 ; set max contour level
res@cnLevelSpacingF = 20 ; set contour spacing
;************************************************
projection = "Mercator"
res@mpProjection = projection
res@mpLimitMode = "Corners"
res@mpLeftCornerLatF = lat2d(0,0)
res@mpLeftCornerLonF = lon2d(0,0)
res@mpRightCornerLatF = lat2d(nlat-1,mlon-1)
res@mpRightCornerLonF = lon2d(nlat-1,mlon-1)
res@mpCenterLonF = 81.45 ; set center logitude
if (projection.eq."LambertConformal") then
res@mpLambertParallel1F = 30
res@mpLambertParallel2F = 60
res@mpLambertMeridianF = -90
end if
res@mpFillOn = False ; turn off map fill
res@mpOutlineDrawOrder = "PostDraw" ; draw continental outline
last
res@mpOutlineBoundarySets = "National" ; state boundaries
res@tfDoNDCOverlay = False ; True for 'native' grid
res@gsnAddCyclic = False ; data are not cyclic
; res@lbOrientation = "vertical"
;************************************************
; allocate array for 3 plots
;************************************************
plts = new (2,"graphic")
;************************************************
; Tell NCL not to draw or advance frame for individual plots
;************************************************
res@gsnDraw = False ; (a) do not draw
res@gsnFrame = False ; (b) do not advance 'frame'
plts(0) = gsn_csm_contour_map(wks,xavg(:,:),res)
plts(1) = gsn_csm_contour_map(wks,yavg(:,:),res)
;************************************************
; create panel: panel plots have their own set of resources
;************************************************
resP = True ; modify the panel plot
resP@txString = "Avg sensible heat flux (W m-2) Nov 2005"
resP@gsnMaximize = True ; maximize panel area
resP@gsnPanelLabelBar = True ; add common colorbar
resP@lbLabelAutoStride= True ; let NCL figure lb stride
resP@gsnPanelRowSpec = True ; specify 1 top, 2 lower
level
gsn_panel(wks,plts,(/1,2/),resP) ; now draw as one plot
On Mon, Jun 11, 2012 at 5:53 PM, Dennis Shea <shea@ucar.edu> wrote:
> Something like
>
> ntim = dimsizes(time)
>
> nStrt = 5
> nJump = 6
> nSkip = 19
>
> do n=5,ntim-1,nSkip
> n1 = n
> n2 = n1+nJump
> print("n1="+n1+" n2="+n2)
>
> x = f->X(n1:n2,:,:)
> xavg = dim_avg_n(x,0)
> end do
>
>
> On 6/11/12 1:40 PM, mark vogel wrote:
>
>> Hi Dennis
>> I read it but I do not get it about the stride syntax.
>> I want to average the time in the afternoon for the whole month from 05
>> UTC to 11 UTC
>> so I start with array 5 to arry 11 (5:11) and then want to skip 19
>> values and start again at the array 30 to 36 and then skip 19 values
>> again until the end. So I get the values only afternoon out before use
>> the dim_avg_n
>>
>> What syntax I should use?
>> Mark
>>
>> On Mon, Jun 11, 2012 at 3:24 PM, Dennis Shea <shea@ucar.edu
>> <mailto:shea@ucar.edu>> wrote:
>>
>> If you read the documentation for dim_avg,
>>
>> http://www.ncl.ucar.edu/__**Document/Functions/Built-in/__**
>> dim_avg.shtml<http://www.ncl.ucar.edu/__Document/Functions/Built-in/__dim_avg.shtml><
>> http://www.ncl.ucar.edu/**Document/Functions/Built-in/**dim_avg.shtml<http://www.ncl.ucar.edu/Document/Functions/Built-in/dim_avg.shtml>
>> >
>>
>>
>> you will see that it performs the average of the *rightmost* dimension.
>>
>> (Time, south_north, west_east) ; rightmost is 'west_east'
>>
>> It is suggested that you read and use
>>
>> http://www.ncl.ucar.edu/__**Document/Functions/Built-in/__**
>> dim_avg_n.shtml<http://www.ncl.ucar.edu/__Document/Functions/Built-in/__dim_avg_n.shtml>
>>
>> <http://www.ncl.ucar.edu/**Document/Functions/Built-in/**
>> dim_avg_n.shtml<http://www.ncl.ucar.edu/Document/Functions/Built-in/dim_avg_n.shtml>
>> >
>>
>> qavg = dim_avg_n(q, 0)
>> printVarSummary(qavg)
>>
>> or with meta data
>>
>>
>> http://www.ncl.ucar.edu/__**Document/Functions/__**
>> Contributed/dim_avg_n_Wrap.__**shtml<http://www.ncl.ucar.edu/__Document/Functions/__Contributed/dim_avg_n_Wrap.__shtml>
>>
>> <http://www.ncl.ucar.edu/**Document/Functions/**
>> Contributed/dim_avg_n_Wrap.**shtml<http://www.ncl.ucar.edu/Document/Functions/Contributed/dim_avg_n_Wrap.shtml>
>> >
>>
>> qavg = dim_avg_n_Wrap(q, 0)
>> printVarSummary(qavg)
>>
>> --
>> Also, this does not look correct
>>
>>
>> f = addfiles(filesn, "r") ; change to filesn1 if 2006 )
>> x = f[:]->HFX(:,:,:) ;
>> (Time, south_north, west_east)
>> x1 = x(5:10:19,:,:)
>>
>> The 5:10:19 makes no sense. It 'say' to use index values 5 thru 10
>> in strides of 19.
>>
>> Please read about subscripting at:
>>
>>
>> http://www.ncl.ucar.edu/__**Document/Manuals/Ref_Manual/__**
>> NclVariables.shtml#Subscripts<http://www.ncl.ucar.edu/__Document/Manuals/Ref_Manual/__NclVariables.shtml#Subscripts>
>>
>> <http://www.ncl.ucar.edu/**Document/Manuals/Ref_Manual/**
>> NclVariables.shtml#Subscripts<http://www.ncl.ucar.edu/Document/Manuals/Ref_Manual/NclVariables.shtml#Subscripts>
>> >
>>
>>
>>
>>
>>
>> On 6/11/12 1:02 PM, mark vogel wrote:
>>
>> Hi all
>> I used dim avg to do the average for the afternoon time for each
>> lat lon.
>> But I am not sure dim-avg is average for each grid.
>> It look like it averaged from west to east domain.
>> What should I used to average the time in each grid point?
>> Anyone answer me please
>> Mark
>> ---------- Forwarded message ----------
>> From: *mark vogel* <mdvogelii@gmail.com
>> <mailto:mdvogelii@gmail.com> <mailto:mdvogelii@gmail.com
>> <mailto:mdvogelii@gmail.com>>>
>> Date: Mon, Jun 11, 2012 at 1:43 PM
>> Subject: plot dim_avg
>> To: NCL USERS <ncl-talk@ucar.edu <mailto:ncl-talk@ucar.edu>
>> <mailto:ncl-talk@ucar.edu <mailto:ncl-talk@ucar.edu>>>
>>
>>
>> Dear all
>> I try to average data only for daytime and plot it out.
>> After I used dim_avg, then dimesion changed from 3 to 2
>> dimension and
>> when I used
>> gsm_contour_map to plot it out.
>>
>> Please help
>> Mark
>>
>>
>>
>> filesn1 = systemfunc("ls " + dirs + "2006*LDASOUT*.nc")
>> f = addfiles(filesn, "r") ; change to filesn1 if 2006 )
>> x = f[:]->HFX(:,:,:)
>> ; (Time,
>> south_north, west_east)
>> x1 = x(5:10:19,:,:)
>> x1@units = " (a) (Default)"
>> ; print(x)
>> dirk =
>> "/usr/rmt_share/tgdata/hrldas/**__workspace/jam2/india_gemout/**"
>>
>> filesk = systemfunc("ls " + dirk + "200511*LDASOUT*.nc")
>> filesk1 = systemfunc("ls " + dirs + "2006*LDASOUT*.nc")
>>
>> g = addfiles(filesk, "r")
>> y = g[:]->HFX(:,:,:)
>> y1 = y(5:10:19,:,:)
>>
>> y1@units = " (b) (GEM)"
>> xavg = dim_avg_Wrap(x1)
>> yavg = dim_avg_Wrap(y1)
>> ; print(x1)
>> print(yavg)
>> x@lat2d = lat2d
>> x@lon2d = lon2d
>> y@lat2d = lat2d
>> y@lon2d = lon2d
>>
>>
>> res@mpFillOn = False ; turn off map
>> fill
>> res@mpOutlineDrawOrder = "PostDraw" ; draw continental
>> outline last
>> res@mpOutlineBoundarySets = "National" ; state boundaries
>>
>> res@tfDoNDCOverlay = False ; True for
>> 'native' grid
>> res@gsnAddCyclic = False ; data are not
>> cyclic
>> ; res@lbOrientation = "vertical"
>>
>> ;*******************************__*******************
>>
>> ; allocate array for 3 plots
>> ;*******************************__*******************
>>
>> plts = new (2,"graphic")
>>
>> ;*******************************__*******************
>>
>> ; Tell NCL not to draw or advance frame for individual plots
>> ;*******************************__*******************
>>
>> res@gsnDraw = False ; (a) do not draw
>> res@gsnFrame = False ; (b) do not
>> advance 'frame'
>>
>> plts(0) =
>> gsn_csm_contour_map(wks,xavg(:**__,:),res)
>> plts(1) =
>> gsn_csm_contour_map(wks,yavg(:**__,:),res)
>> ;*******************************__*******************
>>
>>
>>
>>
>>
>> ______________________________**___________________
>>
>> ncl-talk mailing list
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/__**mailman/listinfo/ncl-talk<http://mailman.ucar.edu/__mailman/listinfo/ncl-talk>
>> <http://mailman.ucar.edu/**mailman/listinfo/ncl-talk<http://mailman.ucar.edu/mailman/listinfo/ncl-talk>
>> >
>>
>>
>>
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Jun 12 14:06:04 2012
This archive was generated by hypermail 2.1.8 : Fri Jun 15 2012 - 14:51:31 MDT