[Thread Prev][Thread Next][Index]

Re: [ferret_users] samplexy_curv function



Hello again,
I've just looked more closely at your script. It looks like there is an error in the definition of the variables lonrct and latrct.
define axis/x=46:55:0.0555 xaxrct !163
define axis/y=36:48:0.0450 yaxrct !268
let lonrct=x[gx=xaxrct]
let latrct=y[gy=yaxrct]

lonrct has 163 points, and latrct has 268. Do you in fact want to sample the data at all of the intersections of xaxrct and yaxrct? If so, you might want to look into the curvilinear regridding functions CURV_TO_RECT_MAP and CURV_TO_RECT .

Or, to use samplexy_curv, you need to define the x and y sample points in both dimentions as

let lonrct=x[gx=xaxrct] + 0*y[gy=yaxrct]
let latrct= 0*x[gx=xaxrct + y[gy=yaxrct]
( To see what this does, try the command "yes? plot/vs lonrct, latrct")

and then use reshape or xsequence before calling the function.

Ansley

Ansley Manke wrote:

Hi Munrat,
I don't see anything wrong with what you've done, but a simpler way to put your x and y points on a one-dimensional grid is to use XSEQUENCE function. This unravels a variable onto an abstract x axis. Try it this way:

....
file/var="lon,lat,depth"/grid=outgrid/col=3 "grid_x162_y267.dat"

let myxpts=xsequence(lonrct) !one dimensional list
let myypts=xsequence(latrct)

let temprect=SAMPLEXY_CURV(temp,lon[d=1],lat[d=1],myxpts,myypts)

fill temprect[k=10,l=1]


Murat Gunduz wrote:


Dear Ferret users,

I have a POM model output file in curvilinear grid. I wan to convert it in
rectilinear coordinate and plot the variables. I am using SAMPLEXY_CURV function
for this purpose.

My variable`s dimensions in curvilinear coordinate are

yes? show grid temp
GRID GRX5
name axis # pts start end
X X 162 r 1 162
Y Y 267 r 1 267
Z Z 16 r 1 16
TIME TIME 5 r 02-JAN-2000 00:00 06-JAN-2000 00:00

I am geting Curvilinear latitude and longitude of this variable from an ascii file as below.
define axis/x=1:162:1 xax
define axis/y=1:267:1 yax
let outgrid=x[gx=xax]+y[gy=yax]
file/var="lon,lat,depth"/grid=outgrid/col=3 "grid_x162_y267.dat"


I generate new rectilinear coordinate by
define axis/x=46:55:0.0555 xaxrct !163
define axis/y=36:48:0.0450 yaxrct !268
let lonrct=x[gx=xaxrct]
let latrct=y[gy=yaxrct]
define axis/x=1:`163*268`:1 xyrct
let outgridxy=x[gx=xyrct]
let myxpts=reshape(lonrct,outgridxy) !one dimensional list
let myypts=reshape(latrct,outgridxy)

and using samplexy_curv function
let temprect=SAMPLEXY_CURV(temp,lon[d=1],lat[d=1],myxpts,myypts)

when I fill the temprect
fill temprect[k=10,l=1]

it gives the below error:

Bailing out of external function "samplexy_curv":
Arguments 4 and 5 must be 1-dimensional lists of equal length
**ERROR: : error in external function


Do you know, what can be the reason?, Thank you very much in advance.
Regards,
Murat



[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / PMEL / TMAP

Contact Us | Privacy Policy | Disclaimer | Accessibility Statement