-
Notifications
You must be signed in to change notification settings - Fork 132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeError 0 is not a string (plotting well imported from welly-generated LAS) #126
Comments
Triage findings: The break occurs between v0.4.1 and v0.4.2. It looks like the error is triggered by the following change in welly/fields.py This seems to be revealing the problem rather than triggering the problem:
At the level of Lasio.read() a las file containing Some possible solutions are:
DC |
work aroundUsing the built-in w = Well.from_las('STAT1990__30-1__15-9-19_SR__COMPOSITE__1.LAS')
w.plot()
w.to_las('out.las')
# Add transform function(s) -----------------
def str_none_to_none(value):
if value == 'None':
return None
transform_functions = {
'TD': str_none_to_none,
}
# z = Well.from_las('out.las')
z = Well.from_las('myout.las', funcs=transform_functions)
# -------------------------------------------
z.plot() |
Would the underlying problem here be that lasio/welly is writing the python object None to |
Thats a good point! I'll look at that today. Step one it to see whether the internal value is the same between Lasio and Welly just before writing. Also it will be useful to see if there is a difference between Lasio and Welly about what gets written. If it is a fundamental read/write issue, then design-wise it would be nice to handle it in Lasio. There is also a question of whether this should be kept specific to the 'TD' mnemonic, or be configurable for a set of mnemonics, or be handled in a general way. It does feel like Lasio and Welly should each have a match of their original las object data after a cycle of read(las), write(new.las), read(new.las). |
Yes, Lasio is writing the python None object to the string 'None' when writing to a file. If we write nothing, lasio.read(...) will interpret that as a empty string "". That would be more correct than 'None' because an empty string is a more common and standard object than a 'None' string. Potentially lasio.read() could be changed to transform all HeaderItem empty string values to NoneType objects. That seems to make sense. However, it could have an impact on current apps that use Lasio. I'll make Lasio Issue to continue this.. |
Related Lasio Issue: Related Laisio Pull-Request (Merged to master 2c5b7ba) |
I believe this is fixed in |
Problem:
When trying to plot a well, imported from a Welly-generated .LAS file, I get "TypeError 0 is not a string" which is raised against "axes[0].set_ylim([lower, upper])".
Follow the steps below to import > export > import the LAS file.
LAS file (from the Volve data set) and full error message attached.
Welly bug report.zip
To reproduce:
w = Well.from_las('STAT1990__30-1__15-9-19_SR__COMPOSITE__1.LAS')
w.plot()
w.to_las('out.las')
z = Well.from_las('out.las')
z.plot()
Expected:
Welly can plot the original LAS file, so should be expected to plot after running .to_las() then .from_las().
The text was updated successfully, but these errors were encountered: