agilescientific / welly

Welly helps with well loading, wireline logs, log quality, data science
https://code.agilescientific.com/welly
Apache License 2.0
312 stars 132 forks source link

plot not showing when used in .py file #223

Open gbene opened 1 year ago

gbene commented 1 year ago

Hi! I was trying out this library and I can't seem to plot the well data when using it in a script (in jupyter notebook works).

By following the documentation both

from welly import Well

well = Well.from_las('./data/A10.las')

perm = well.data['PERM']

perm.plot()

and

from welly import Well

well = Well.from_las('./data/A10.las')

well.plot()

should work.

For me it does not work, the plots do not show up and the script terminates without any errors. Am I doing something wrong?

Thanks!

kwinkunks commented 1 year ago

Please try instantiating the plot in your script and passing the Axes object to welly to plot into, like:

import matplotlib.pyplot as plt

fig, ax = plt.subplots()
ax = well.plot(ax=ax)
plt.show()
gbene commented 1 year ago

Yes sorry, I did try that too. It returns an empty plot

image

kwinkunks commented 1 year ago

Hm, that does seem like a bug. I'm afraid the quickest thing will be to loop over the well.data dictionary and construct the plot yourself one curve at a time.

gbene commented 1 year ago

All right, thanks! I am encountering the same problem in the striplog package (e.g. striplog.plot() does nothing). I don't know if this information helps in any way.

Have a nice day!

rselover commented 1 year ago

I'd have to double-check the use case, but you can run .ipynb's from the command line - see answer #4 in this thread:

https://stackoverflow.com/questions/35545402/how-to-run-an-ipynb-jupyter-notebook-from-terminal

ipython -c "%run your_script.ipynb"