Hi,
This is simpler than the other case. You want to select the data
within the polygon, average it in the XY direction, and as a result
have data in z (and perhaps T, if the grid has a time axis).
You need to first apply the mask defined by PT_IN_POLY, and take the
xy average on the result after selecting the polygon points. Let me
show an example with a dataset I have access to. This is a 4-D
datast:
yes? use
"http://ferret.pmel.noaa.gov/thredds/dodsC/data/PMEL/WOA05nc/monthly/t0112an1.nc"
yes? show data
currently SET data sets:
1>
http://ferret.pmel.noaa.gov/thredds/dodsC/data/PMEL/WOA05nc/monthly/t0112an1.nc
(default)
name title I
J K L M N
T0112AN1 Temperature 1:360
1:180 1:24 1:12 ... ...
! Define a polygon in a region where the data is not
missing:
yes? let xgp = {56, 73, 73, 74, 80, 80, 71, 71, 68, 65,
60, 56}
yes? let ygp = {11, 10, 9, 9, 7, 4, 0, -1, 0, 5,
7, 11}
yes? shade/x=50:90/y=-5:15/k=1/L=1 t0112an1
yes? plot/vs/over/line/thick xgp, ygp
! Use PT_IN_POLY to define a mask which is 1 at grid
locations inside the polygon.
! The mask is only in XY, so send only an XY grid to
PT_IN_POLY.
yes? let gp = pt_in_poly(t0112an1[d=1,k=1,l=1],xgp, ygp)
! The mask, 1 in the polygon, missing elsewhere
yes? let mask_poly = if gp eq 1 then 1
yes? let temp_data_in_poly = mask_poly* t0112an1[d=1]
! Now average the masked data over all space, and this is
the average of data in the polygon.
yes? let temp_ave_in_poly =
temp_data_in_poly[x=@ave,y=@ave]
yes? plot/L=1 temp_ave_in_poly
yes? list/l=6 temp_ave_in_poly
VARIABLE : TEMP_DATA_IN_POLY[X=@AVE,Y=@AVE]
SUBSET : 24 points (DEPTH (m))
LONGITUDE: 0E to 0E(360)
LATITUDE : 90S to 90N
TIME : 14-JUN 00:00
0 / 1: 29.14
10 / 2: 29.12
20 / 3: 29.09
30 / 4: 29.01
50 / 5: 28.13
75 / 6: 25.42
100 / 7: 21.72
...
On 1/14/2015 7:32 PM, Nitin Patil
wrote:
Do you want to take
the data for variable Optical_Depth_Land_And_Ocean_Mean that is inside the polygon, and
average it over x and y?
- Yes exactly I have to do
that.
This is the other calculation forget rf please consider
new.jnl as a new script. Please take a look on line 15. to
average polygon.
|