Hi Plotly,

We are working on an oil-dwelling project. In that, we need to represent my survey data as 3 dimensional View. Here we have three axes East – X-axis, North-- Y-Axis, TVD-Z-Axis. Now I am considering these values as X, Y, Z. We are using the below formulas to find the values for all the required.

North-Y-Axis = MD/2 * [Sin(I1) * Cos(Az1) + Sin(I2) * Cos(Az2)] * RF

East-X-Axes = MD/2 * [Sin(I1) * Sin(Az1) + Sin(I2) * Sin(Az2)] * RF

TVD-Z-Axes = MD/2 * [Cos(I1) + Cos(I2)] * RF

β (beta) = (Cos Inverse)cos -1 [ Cos(I2 - I1) - (Sin (I1) * Sin (I2) * (1-Cos (A1-A1))]

RF = 2/ β * tan (β/2)

β (beta) must be in radians

Where;

MD = Measured Depth between surveys in ft

I1 = Inclination (angle) of an upper survey in degrees

I2 = Inclination (angle) of lower in degrees

Az1= Azimuth direction of upper survey

Az2 = Azimuth direction of lower survey RF = Ratio Factor R is the dog-leg angle.

On the Equations above,

North => X

East => Y

TVD => Z

The inputs you need for Obtaining (X, Y, Z) were **Measured Depth** (MD), **Inclination** (I1, I2), **Azimuth** (A1, A2) from the survey data.

In streamtube 3D plots, required attributes include x, y, and z, which set the coordinates of the vector field, and u, v, and w, which set the x, y, and z components of the vector field. And we are using the below formulas to calculate the value of u.v, and w.

u(x,y,z) = Asin(z) + Ccos(y)

v(x,y, z) = Bsin(x) + Acos(z)

w(x,y,z) = Csin(y) + Bcos(x)

where, A=1, B= sqrt(2/3), C= sqrt(1/3)

But still, we are not able to plot the stream tube in the 3D graph with my data. We have also tested on the online Plotly chart studio Online Graph Maker · Plotly Chart Studio but didn’t get any success.

Please find the below source code that we are using to calculate all the required axes.

function ProcessExcel(data) {

var workbook = XLSX.read(data, {

type: ‘binary’

});

var firstSheet = workbook.SheetNames[1];

```
var exceldata = XLSX.utils.sheet_to_json(workbook.Sheets[firstSheet], { raw: true });
var z_data = [];
var data;
for (var i = 0; i <= exceldata.length - 1; i++) {
let MD = exceldata[i].Measured_Depth;
let I1 = degrees_to_radians(exceldata[i].Inclination);
let I2 = degrees_to_radians(exceldata[i+1].Inclination);
let Az1 = degrees_to_radians(exceldata[i].Azimuth);
let Az2 = degrees_to_radians(exceldata[i+1].Azimuth);
let beta_cal = degrees_to_radians(Math.acos(Math.cos(I1 - I2) - Math.sin(I1) * Math.sin(I2) * 1 - Math.cos(Az2 - Az1)));
if (beta_cal == 0) {
beta_cal = degrees_to_radians(Math.pow(10, -100));
}
let RF_cal = (2 / beta_cal) * Math.tan(beta_cal / 2);
let x_axis_North_cal = (MD / 2) * ((Math.sin(I2) * Math.cos(Az1) + Math.sin(I2) * Math.cos(Az2)) * RF_cal);
let y_axis_East_cal = (MD / 2) * ((Math.sin(I2) * Math.sin(Az1) + Math.sin(I2) * Math.sin(Az2)) * RF_cal);
let Z_axis_TVD_cal = (MD / 2) * ((Math.cos(I1) * Math.cos(I2)) * RF_cal);
let u_axis_cal = 1 * Math.sin(Z_axis_TVD_cal) + Math.sqrt(1.0 / 3) * Math.cos(y_axis_East_cal);
let v_axis_cal = Math.sqrt(2.0 / 3) * Math.sin(x_axis_North_cal) + 1 * Math.cos(Z_axis_TVD_cal);
let w_axis_cal = Math.sqrt(1.0 / 3) * Math.sin(y_axis_East_cal) + Math.sqrt(2.0 / 3) * Math.cos(x_axis_North_cal);
var coordinates = [x_axis_North_cal, y_axis_East_cal, Z_axis_TVD_cal, u_axis_cal, v_axis_cal, w_axis_cal];
z_data.push(coordinates);
}
```

Please find the below google drive link for the survey data:

We need to show the data as a stream tube only. Let us know for any additional information

Thanks and Regards.