<commit_before>import numpy as np
import struct

from geoprobe import utilities
from volume import volume

"""
Geoprobe horizons
  Reverse engineered by JDK, Feb. 2009
Format descrip:
    1 ascii line w/ version (terminated with newline)
    There are two "sections" in every file. 
    The first section contains x,y,z points making a "filled" surface
        (This is basically a sparse matrix)
    The second section contains lines (manual picks)
    Both section types have a 4 byte header (seems to be >I?)
        The actual values in this header seem to be complelely meaningless (??)
    subsections
        if surface:
            info: (>I) Number of points
        if line:
            info: (>4fI) xdir,ydir,zdir,ID,numPoints
    Point Format in all sections: (>4f3B)
        x,y,z,confidence,type,heridity,tileSize
"""

_pointFormat = ('>f', '>f', '>f', '>f', '>B', '>B', '>B')
_pointNames = ('x', 'y', 'z', 'conf', 'type', 'herid', 'tileSize')
_lineHdrFmt = '>4f'

class horizon(object):
    def __init__(self, input):
        """Takes either a filename or a numpy array"""

        if type(input) == type('String'):
            self._readHorizon(input)    
        else:
            # For the moment, just assume it's a numpy array
            # Possibly pass a list of recarrays for lines?
            raise TypeError('Only reading is suppored at this time.  Input must be a valid file name')

        # For gridding:
        self.nodata = -9999

        # Read horizon and initalize various properties
        self.x = self.data.x
        self.y = self.data.y
        self.z = self.data.z
        self.xmin = self.x.min()
        self.ymin = self.y.min()
        self.zmin = self.z.min()<commit_msg>Fixed horizon.x,y,z to not use np.recarray syntax when assigning<commit_after>import numpy as np
import struct

from geoprobe import utilities
from volume import volume

"""
Geoprobe horizons
  Reverse engineered by JDK, Feb. 2009
Format descrip:
    1 ascii line w/ version (terminated with newline)
    There are two "sections" in every file. 
    The first section contains x,y,z points making a "filled" surface
        (This is basically a sparse matrix)
    The second section contains lines (manual picks)
    Both section types have a 4 byte header (seems to be >I?)
        The actual values in this header seem to be complelely meaningless (??)
    subsections
        if surface:
            info: (>I) Number of points
        if line:
            info: (>4fI) xdir,ydir,zdir,ID,numPoints
    Point Format in all sections: (>4f3B)
        x,y,z,confidence,type,heridity,tileSize
"""

_pointFormat = ('>f', '>f', '>f', '>f', '>B', '>B', '>B')
_pointNames = ('x', 'y', 'z', 'conf', 'type', 'herid', 'tileSize')
_lineHdrFmt = '>4f'

class horizon(object):
    def __init__(self, input):
        """Takes either a filename or a numpy array"""

        if type(input) == type('String'):
            self._readHorizon(input)    
        else:
            # For the moment, just assume it's a numpy array
            # Possibly pass a list of recarrays for lines?
            raise TypeError('Only reading is suppored at this time.  Input must be a valid file name')

        # For gridding:
        self.nodata = -9999

        # Read horizon and initalize various properties
        self.x = self.data['x']
        self.y = self.data['y']
        self.z = self.data['z']
        self.xmin = self.x.min()
        self.ymin = self.y.min()
        self.zmin = self.z.min()
{'fraction_non_alphanumeric': 0.11082474226804123, 'fraction_numerical': 0.008018327605956471, 'mean_word_length': 2.5211693548387095, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '614530', 'n_tokens_mistral': 1116, 'n_tokens_neox': 1060, 'n_words': 397}