wrf_user_ll_to_ij function

From: Xin Xi <xxi_at_nyahnyahspammersnyahnyah>
Date: Mon Nov 11 2013 - 21:27:25 MST

Hello,
I have a 2D field X from WRF with coordinates lat2d and lon2d. I want to
calculate the sum of subset of X within lat/lon bounds of (min_lat,
max_lat) and (min_lon, max_lon). I tried two different ways, which I
expected the same results but they turn out to be different. Which is the
correct way?

method 1:
X=where(lat2d.lt.min_lat .or. lat2d.gt.max_lat .or. \
              lon2d.lt.min_lon.or.lon2d.gt.max_lon, 0, X)
sum_X=sum(X)
(in fact, the original X is missing value outside the lat/lon bounds, I use
the where function just for precaution).

method 2:
opt=True
loc=wrf_user_ll_to_ij(geo_file,(/min_lon,max_lon/),(/min_lat,max_lat/),opt)
loc=loc-1
subsetX=X(loc(1,0):loc(1,1) , loc(0,0):loc(0,1))
sum_X=sum(subsetX)

The sum_X from method 2 is a lot smaller than method 1. Is it because
wrf_user_ll_to_ij loses some grids at the bounds?

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Nov 11 21:27:38 2013

This archive was generated by hypermail 2.1.8 : Fri Nov 22 2013 - 09:36:32 MST