toddheitmann / PetroPy

A petrophysics python package for geoscience python computing of conventional and unconventional formation evaluation. Reads las files and creates a pandas dataframe of the log data. Includes a basic petrophysical workflow and a simple log viewer based on XML templates.
https://toddheitmann.github.io/PetroPy/
MIT License
177 stars 66 forks source link

LogViewer requires CAL_N #3

Open Geo-C-Data opened 5 years ago

Geo-C-Data commented 5 years ago

Awesome program!

When I try to adapt to my own LAS file, ptr.LogViewer returns a value error that "Curve CAL_N not found in log."

I don't have this trace (although I agree it's pretty fundamental) - required for use or a bug?

toddheitmann commented 5 years ago

I choose to throw an error when using LogViewer templates since I batch process outputs and want to know if something unexpected happens. The idea behind using the template is to crate the xml once and use everywhere. I would recommend creating one based on the current raw template and deleting the CAL_N row.

Here's the text you could save to a file named custom_raw_template.xml where I removed line 4.

<?xml version="1.0" encoding="UTF-8"?>
<graph>
  <track display_name="GAMMA RAY" width="1.5" major_lines="3">
    <curve display_name="GR" curve_name="GR_N" color="#006400" left="0" right="150" fill="left" fill_color_map="Greens" left_color_value="20"/>
  </track>
  <track display_name="DEPTH" number_spacing="50" tick_spacing="10" line_spacing="50" width="0.75">
  </track>
  <track display_name="RESISTIVITY" scale="log" width="2">
    <curve display_name="RESMED" curve_name="RESMED_N" color="#cc0000" left="2" right="2000"/>
    <curve display_name="RESDEEP" curve_name="RESDEEP_N" color="#330000" left="2" right="2000" right_cutoff_fill="20" right_cutoff_fill_color="#ff9994"/>
  </track>
  <track display_name="NEUTRON DENSITY" width="2" major_lines="9">
    <curve display_name="PE" curve_name="PE_N" color="#000000" left="0" right="10" right_cutoff_fill="3" right_cutoff_fill_color="#cde7f0" left_cutoff_fill="3" left_cutoff_fill_color="#ffff99"/>
    <curve display_name="RHOB" curve_name="RHOB_N" color="#FF0000" left="1.95" right="2.95"/>
    <curve display_name="NPHI" curve_name="NPHI_N" color="#0099CC" left="0.45" right="-0.15" line_style="--"/>
  </track>
</graph>

Then call the custom template in your code:

import petropy as ptr
log = ptr.log_data('WFMP')
custom_template = 'path/to/saved/file/custom_raw_template.xml'
viewer = ptr.LogViewer(log, template_xml_path = custom_template)
viewer.show()

On the to-do list is to describe how to create your own templates for viewing data.