2

I have some data of soil's moisture content (Theta) in the form of 3D-domain points (CSV file of the columns x, y, z, Theta). I want to take cross sections from the 3D domain in some specific positions (section ABCD in the figure). I want to calculate the value of Theta in a 5*5 grid in the cross-section, but the points around each node of the grid are not coplanar with the unknown point. I did this before for 2D domains in python, but the 3D domains seem more complicated for me. I found that plotly can make something like that in its virtual environment but I want this to output a numpy array or pandas DataFrame to draw it as a contour in the jupyter notebook. enter image description here

I know that finding the grid involves finding the value of each point like P0 in the figure by interpolation or gridding from its neighbors, then to draw the cross section using matplotlib, but I don' know how to do it.

Related question, Is slicing 2D grids from 3D grids available in matplotlib or similar libraries?

Thanks for all help.

Mohammad ElNesr
  • 2,477
  • 4
  • 27
  • 44

2 Answers2

1

The underlying problem is 3D interpolation. There are numerous packages which can do this type of thing, or you can write your own (using, e.g. KDE, which is basically just a type of smoothing/binning). There is a lot of material on the topic, like

DilithiumMatrix
  • 17,795
  • 22
  • 77
  • 119
0

Have you tried playing with pyugrid? It's a library specifically for manipulating unstructured grids, so it sounds like it might be of some use to you. Check out these example notebooks.

  • Thanks for your suggestion, but it seems that pyugrid uses 2D grids (Latitude and Longitude), and the third is the value of the wave (heat, pressure, etc.), While I use 3 coordinates for x, y, z in addition to a value of the moisture. I found no way to feed such a library with 3D grid AND a Value vector. – Mohammad ElNesr Dec 18 '17 at 12:46