[ncl-talk] Fwd: request
ali mughal
mughalali655 at gmail.com
Fri Feb 25 16:26:50 MST 2022
Hi all
I am not sure if the following email was received by NCL community.
Can anyone kindly let me know if the following email and the associated
attachment can be seen in the group ?
Thanks and Regards
---------- Forwarded message ----------
From: *ali mughal* <mughalali655 at gmail.com>
Date: Saturday, February 19, 2022
Subject: request
To: Ncl-talk <ncl-talk at ucar.edu>
Dear Ncl users
I would be grateful if someone can reply to my following inquiry posted a
few days ago.
---------- Forwarded message ----------
From: *ali mughal* <mughalali655 at gmail.com>
Date: Tuesday, February 15, 2022
Subject: request
To: Ncl-talk <ncl-talk at ucar.edu>
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/20220226/2a131254/attachment-0001.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