Hi - Yes, this isn't hard to do. I'll get this into the next release.
But looking at what you're doing, I think what you really want is the curvilinear-to-rectilinear gridding functions. The process is a two-step one: first give Ferret the curvilinear x and y coordinates and an output rectilinear xy grid, and the function CURV_TO_RECT_MAP computes a mapping between the two grids. Save the mapping, and then in a much faster operation CURV_TO_RECT applies the map to convert the data field to the new grid. yes? show function curv_to_rect* CURV_TO_RECT_MAP(lon_in,lat_in,grid_out,radius) Compute mapping for regridding: curvilinear to rectangular grid. lon_in: Source grid longitudes (2-D) (degrees) lat_in: Source grid latitudes (2-D) (degrees) grid_out: Any variable on destination Longitude-Latitude grid, Lon and Lat (degrees) radius: Source points falling within radius are included in mapping to destination point (degrees) CURV_TO_RECT(V,mapping) Apply mapping to regrid from curvilinear to rectangular grid V: Variable to regrid, on curvilinear grid V(x,y,z,t) mapping: mapping computed by curv_to_rect_MAP Stephen Guimond wrote: Ansley, Thank you for your help. A 50,000 point limit seems rather low. I routinely work with datasets well over this limit so dynamically allocated memory seems like the way to go. Will you make this updated scat2gridlaplace available in the next FERRET release? Steve ----- Original Message ----- From: Ansley Manke <Ansley.B.Manke@xxxxxxxx> Date: Tuesday, August 26, 2008 12:04 pm Subject: Re: [ferret_users] scat2gridgauss not functioning properly To: guimond@xxxxxxxxxxxxx Cc: jaison@xxxxxxxxxxxxxx, oar.pmel.ferret_users@xxxxxxxxHi Stephen, The underlying code that scat2gridlaplace calls to do the gridding operation has some work space that's hardwired in size to 50,000 points. Your data is 960*367 = 352367 points so the code eventually overwrites memory and causes the crash. We should at least put in a test for that limit being exceeded so you'd get a useful error message - but I should be able to set up the work space with dynamically-allocated memory so it'd work correctly. Ansley Stephen Guimond wrote:Hi Jaison, Thank you for your response, using a 1-D axis for x and y inputvalues worked. I suppose the "objective_analysis_demo" script should be fixed because it shows 2-D axes for x and y input.Another thing I found was that using "scat2gridlaplace" causes acrash of FERRET. I used similar input as I did with "scat2gridgauss", but with cay and nrng both equal to 5. I am using FERRET v6.1 for 32-bit Linux. Have you found anything similar?Thanks, Steve ----- Original Message ----- From: jaison@xxxxxxxxxxxxxx Date: Wednesday, August 20, 2008 9:51 pm Subject: Re: [ferret_users] scat2gridgauss not functioning properly To: guimond@xxxxxxxxxxxxx Cc: ferret_users@xxxxxxxxHi Steve, According to documentation (and from experience), the first two input arguments to SCAT2GRIDGAUSS function should be defined on either X (and ZT) or Y (and ZT) axis, but NOT on both X and Y at the sametime.>> (see Ch3 Sec2.3.37. SCAT2GRIDGAUSS_XY). In your script add thefollowinglines let xx1D = XSEQUENCE(xx) let yy1D = XSEQUENCE(yy) then use these variables in SCAT2GRIDGAUSS function as let sgrid = scat2gridgauss_xy(xx1D, yy1D, .........) Ok. The last argument (9th one) is not used in newer versions of Ferret.The 3 arguments before that, XSCALE, YSCALE and CUTOFFneedto be chosen to match your destination grid. Read the documentation carefullyfor>> CUTOFF. You can try few different values to choose between high-data loss (smaller SCALE and CUTOFF) and high-smoothing (higher SCALE and CUTOFF),with respect to the destination grid. For example, if CUTOFF is 2, then XSCALE can be dx (of destination grid) and YSCALE can be dy. Also note that, it is always a good habit to add proper units while defining axis, and use proper names (xlon, ylat or xkm, ykm etc). Please let me know if you have any questions. Thanks and Regards, JaisonHello Ferreters, I am trying to put scattered data onto a regular grid and triedwith the scat2gridgaussfunction. Here is my code: ! the scattered data axes... def axis/x=1:960:1 x;def axis/y=1:367:1 y;def grid/x=x/y=y g file/format=stream/grid=g/var="xx,yy,zz,dbz" output.dat ! the regular grid axes... def axis/x=-240:240:0.5 nx;def axis/y=-240:240:0.5 ny let sgrid = scat2gridgauss_xy(xx, yy, dbz, x[gx=nx], y[gy=ny],2.,2.,2.,0)>The result does not work (toying with the last few parametersmakes no difference),although it does have the grid I expect. I'm assuming the samewill be true for thescat2gridlaplace functions as well. Any ideas? Thanks, Steve ======================================================= Stephen R. Guimond Graduate Research Assistant Florida State University Center for Ocean-Atmospheric Prediction Studies (COAPS) ============================================================================================================== Stephen R. Guimond Graduate Research Assistant Florida State University Center for Ocean-Atmospheric Prediction Studies (COAPS) ============================================================================================================== Stephen R. Guimond Graduate Research Assistant Florida State University Center for Ocean-Atmospheric Prediction Studies (COAPS) ======================================================= |