[ncl-talk] request
ali mughal
mughalali655 at gmail.com
Tue Feb 15 08:07:07 MST 2022
Dear NCL users
In the attached script all values of TA_Average are equal to 0.
But when I individually calculate t2a_sub2_avg and t2b _sub2_avg and
evaluate the difference then the values are not 0. Can any one tell me what
could be the reason and how to write the output correctly in to a csv or a
text format.
I will be grateful for the support.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20220215/56793dd1/attachment.html>
-------------- next part --------------
b=addfile("wrfout_d05_2016-03-31_00:00:00","r")
a=addfile("../../wrfout_d05_2016-03-31_00:00:00","r")
lat2d = wrf_user_getvar(a,"XLAT", 0)
lon2d = wrf_user_getvar(a,"XLONG",0)
min_lat = 1.281
max_lat = 1.296
min_lon = 103.629
max_lon = 103.643
;t2 at _FillValue = default_fillvalue(typeof(t2))
lon2d at _FillValue = default_fillvalue(typeof(lon2d))
lat2d at _FillValue = default_fillvalue(typeof(lat2d))
lats = (/ min_lat, max_lat /)
lons = (/ min_lon, max_lon /)
loc = wrf_user_ll_to_ij(a, lons, lats, True)
loc = loc-1
ilt1 = loc(1,0)
ilt2 = loc(1,1)
iln1 = loc(0,0)
iln2 = loc(0,1)
lat_sub2 = lat2d(ilt1:ilt2 , iln1:iln2)
lon_sub2 = lon2d(ilt1:ilt2 , iln1:iln2)
ntimes = dimsizes(times)
do it = 0,ntimes-1
TA_MEAN_IND = wrf_user_getvar(a,"TA_MEAN",it)
t2a=TA_MEAN_IND(0,:,:)
TA_MEAN_NO_IND = wrf_user_getvar(b,"TA_MEAN",it)
t2b=TA_MEAN_IND(0,:,:)
t2a at _FillValue = default_fillvalue(typeof(t2a))
t2a_sub2 = t2a ; make a copy
t2a_sub2 = t2a_sub2 at _FillValue ; set to all missing
t2a_sub2(ilt1:ilt2,iln1:iln2) = t2a(ilt1:ilt2, iln1:iln2)
t2a_sub2_avg = avg(t2a_sub2)
t2b at _FillValue = default_fillvalue(typeof(t2b))
t2b_sub2 = t2b ; make a copy
t2b_sub2 = t2b_sub2 at _FillValue ; set to all missing
t2b_sub2(ilt1:ilt2,iln1:iln2) = t2b(ilt1:ilt2, iln1:iln2)
t2b_sub2_avg = avg(t2b_sub2)
T_avg=t2a_sub2_avg-t2b_sub2_avg
print ("time="+times(it)+" TA_Average="+T_avg)
end do
More information about the ncl-talk
mailing list