cgre-aachen / pynoddy

pynoddy is a python package to write, change, and analyse kinematic geological modelling simulations performed with Noddy.
GNU General Public License v2.0
71 stars 31 forks source link

Unable to plot sections #40

Closed SR-Roweb closed 3 years ago

SR-Roweb commented 3 years ago

Hi, I recently found pynoddy and I am struggling to plot sections of the data as done from notebook 1-Simulation. The following code is given: N1.plot_section('y', figsize = (5,3))

This gives me the error: IndexError: only integers, slices (:), ellipsis (...), numpy.newaxis (None) and integer or boolean arrays are valid indices

I then add an integer xslice = int(0.1*N1.nx) N1.plot_section('y', position = xslice, figsize = (5,3)) To get the error ValueError: 'lower left' is not a valid value for origin; supported values are 'upper', 'lower' or if 0.1 is changed to 1 then IndexError: index 124 is out of bounds for axis 1 with size 94 or ValueError: I/O operation on closed file. The same with 3D plots, I always seem to get AssertionError: Incompatible cell data. 1 cell blocks, but 'triangle' has 59150 blocks.

The I/O error appears to come from the following: ~\Anaconda3\lib\site-packages\pynoddy-1.1-py3.8.egg\pynoddy\output.py in load_geology(self) 198 k = 0 199 self.block = np.ndarray((self.nx, self.ny, self.nz)) --> 200 for line in f.readlines(): 201 if line == '\n': 202 # next z-slice

Any help would be greatly appreciated.

danielsk78 commented 3 years ago

To solve the I/O error you would need to modify the output.py file from pynoddy. Lines 193 to 236 need to be inside the with open(...)

SR-Roweb commented 3 years ago

Great, thank you!

danielsk78 commented 3 years ago

Hi @Crimzo1, Have you tried the changes on issue #41? This solves the problems for me.

The error: ValueError: 'lower left' is not a valid value for origin; supported values are 'upper', 'lower' is a problem of the matplotlib version. Either downgrade or change the root code to replace all 'lower left' to 'lower' Try updating your master branch to the latest version since this is solved there.

SR-Roweb commented 3 years ago

Thanks I'll have a look, I changed the above before but received the integer error, might of missed something.

SR-Roweb commented 3 years ago

Hi @danielsk78 that's worked great, thank you very much!