# Re: Creating 3D grid from scattered data

```hi Mike,

Since it appears that you have only 5 points on your Z axis (?) there is a
simple solution possible:

LET VZ0  = scatter2gridlaplace_xy( **arguments at Z=0** )
LET VZ25 = scatter2gridlaplace_xy( **arguments at Z=25** )
LET VZ50 = ...
LET VZ75 = ...
LET VZ100 = ...

DEF AXIS/Z=0:100:25/DEPTH  zaxis

LET V  = IF K[GZ=zaxis] EQ 1 THEN VZ0  ELSE V2
LET V2 = IF K[GZ=zaxis] EQ 2 THEN VZ25 ELSE V3
LET V3 = IF K[GZ=zaxis] EQ 3 THEN VZ50 ELSE V4
LET V4 = IF K[GZ=zaxis] EQ 4 THEN VZ75 ELSE VZ100

Your variable "V" is now the function of Z that you desire.

This approach is not the ideal solution. Ideally the function
scatter2gridlaplace_xy() should inherit the Z axis from the arguments XPTS,
YPTS, and F. In this case, as long as the variable you provide as "F" is,
itself a function of Z, so, too will the result be. I suspect it was a simple
oversight that the function does not work this way. We will look into fixing
this. Note that the function *does* inherit correctly in this manner on the T
axis.

- steve

===========================================================

"McCann, Mike" wrote:

> Hi,
>
> I have a set of scattered ocean observations that I'd like
> to grid into a 3D volume.  The strategy I'm considering is
>
> 1. Create horizontal sections and grid to a level with
>    scatter2gridlaplace_xy()
>
> 2. Assemble these sections into a 3D volume following the
>    multiple-slab example:
>
> yes? DEF AXIS/x=1:360:1  xaxis
> yes? DEF AXIS/y=1:180:1  yaxis
> yes? DEF AXIS/Z=0:100:25/DEPTH  zaxis
> yes? DEF GRID/X=xaxis/Y=yaxis/Z=zaxis uv_grid
> yes? DEF AXIS/Z=0:0:1  zaxis1
> yes? DEF GRID/LIKE=uv_grid/Z=zaxis1  uv_grid1
> yes? LET/TITLE="My U data"  u1 = u[G=uv_grid]
> yes? LET/TITLE="My V data"  v1 = v[G=uv_grid]
> yes? SAVE/FILE=uv1_5z.cdf/KLIMITS=1:5  u1, v1
> yes? CANCEL DATA uv.data1
> yes? DEF AXIS/Z=25:25:1  zaxis1
> yes? SAVE/FILE=uv1_5z.cdf/APPEND  u1,v1
> . . .
>
> My problem is that I need to get the output of scatter2gridlaplace_xy()
> onto a 3D grid where the Z axis is a single value.  How can I do this?
>
> I tried
> SET VAR/GRID=newgrid <variable_from scatter2gridlaplace_xy()>
> but I get an error.
>
> I think I can list the level out to an ascii file, then read it back
> in onto the 3D grid, but I'd rather not have to do this.  Is there
> a more efficient way?
>
> Mike
>
> --
> Mike McCann   (mccann@mbari.org)
> Group Leader, Information Applications Group
> Monterey Bay Aquarium Research Institute
> Moss Landing, CA 95039-9644
> Voice: (831) 775-1769   Fax: (831) 775-1646 http://www.mbari.org/rd/iag.htm

--

|  NOAA/PMEL               |  ph. (206) 526-6080
Steve Hankin    |  7600 Sand Point Way NE  |  FAX (206) 526-6744
|  Seattle, WA 98115-0070  |  hankin@pmel.noaa.gov

```