[Thread Prev][Thread Next][Index]

reshape and get x axis data onto z axis

Dear ferret

I have a netCDF file with a three dimensional field on the x, y, z axes.
I would like to use zaxreplace on the x axis data. (I believe this amazing function is currently only supported on the z-axis.)

I've managed to use RESHAPE to get the z axis data onto the t-axis, but when I try to use RESHAPE to get the x-axis data onto the
now vacant z-axis, it messes up the data. Am I trying to do the impossible?

The manual states:

"For any axis X,Y,Z, or T if the axis is the same in the input and output grids then the region from argument 1 will be preserved in the output.
This implies that when the above technique is used on multi-dimensional input, only the axes which differ between the input and output grids are affected by the RESHAPE operation."

Hence I've attempted to "let ferret know" that I want to move the x-data over to the z-axis, and leave y and t alone, by defining my output grid to have only one dimension in the x-direction,
In particular:

DEFINE AXIS/x=1:1:1 xaxis_normal                                                                                       ! my attempt to make this a normal axis
DEFINE AXIS/z=1:5:1 zaxis_new                                                                                            ! (the old x - axis)
DEFINE GRID/LIKE=old_grid/ x= xaxis_normal/ z=zaxis_new   output_grid                 ! I need to use LIKE to get the y-axis correct because it's irregular.

LET dummie = x[output_grid] * y[output_grid]  * z[output_grid]  *t[output_grid]

LET new_var = RESHAPE(old_var,dummie]

But now
old_var[i=1]      .NE.       new_var[k=1]

Thanks for any advice,

Rob Scott
Research Associate
Institute for Geophysics
University of Texas at Austin
4412 Spicewood Springs Rd.
Building 600
Austin, TX

Office: +1-512-471-0375

[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / PMEL / TMAP

Contact Us | Privacy Policy | Disclaimer | Accessibility Statement