Hi,
What I'd do is make lists of the coordinates and the data, just in
the polygon region. Then turn those into 1-D lists using XSEQUENCE,
and then use COMPRESSI to get the valid data at the start of the
list. Here are your commands:
use rain.nc
let xci =
{77,79,79,83,83,84,84,83,83,82,82,80,80,79,79,76,76,73,73,72,72,74,74,75,75,77,77}
let yci =
{27,27,25,25,24,24,21,20,20,19,18,18,17,17,16,16,15,15,15,18,21,21,23,23,24,24,24}
let ci = pt_in_poly(rf,xci, yci)
let ci_data = if ci eq 1 then ci*rf[l=1]
list/norowlab/nohead/append/format=(f10.3)/file=try.txt
ci_data
! The x coordinates at each grid point, and
! the y coordinates at each grid point:
yes? let xlon = x[gx=rf] + 0*y[gy=rf]
yes? let ylat = 0* x[gx=rf] + y[gy=rf]
! Apply the mask, to get x and y coordinates in the
polygon region:
yes? let x_data = if ci eq 1 then ci*xlon
yes? let y_data = if ci eq 1 then ci*ylat
! Make these into 1-D lists,
yes? let xlist = xsequence(x_data)
yes? let ylist = xsequence(y_data)
yes? let clist = xsequence(ci_data)
! Move valid data to the start. You can give these
! variables units and titles, if you want Ferret to
make
! a nice labeled header
yes? let xout = compressi(xlist)
yes? let yout = compressi(ylist)
yes? let cout = compressi(clist)
yes? let np = `cout[i=@ngd]`
yes? list/i=1:`np` xout, yout, cout
There might be some details I have wrong here - I'm just typing
commands.
For the call to pt_in_poly, I would suggest that you give the range
of the points in the function call, which will tell Ferret to always
use the entire list of values:
pt_in_poly(rf,xci[i=1:27], yci[i=1:27])
-Ansley
On 12/3/2014 8:24 PM, Nitin Patil
wrote:
Dear All,
Thanks for your feedback.
I am attaching the files with output generated. The issue is
when i am listing the are of interest defined to save in txt
file it is listing the adjoint grids as ******** in the output
file, but I need only the values comes under set
polygon/region.
I am attaching my script for reference.
|