def test_01(self): """TestXMLMatches.test_01(): Which XML LgFormat files can plot LAS file, single TripleCombo XML file.""" myLasFile = LASRead.LASRead( io.StringIO(TestPlotLASData.LAS_00_200_FEET_DOWN)) # Assume the formats/ directory relative to this module d = os.path.join(os.path.dirname(__file__), 'formats') filmMap = XMLMatches.fileCurveMap(myLasFile, d) # Actual curves in this LAS file: # ['BMIN', 'BMNO', 'CALI', 'DEPT', 'DPHI', 'DRHO', 'GR', 'ILD', 'ILM', 'NPHI', 'PEF', 'RHOB', 'SFLU', 'SP', 'TNPH'] # # In XML file: # ['AHT10', 'AHT20', 'AHT30', 'AHT60', 'AHT90', 'APDC', 'APLC', 'APSC', 'ATR', 'BS', 'C1', 'C2', 'CALI', 'CMFF', 'CMRP', 'DPHB', 'DPHI', 'DPHZ', 'DPOR_CDN', 'DSOZ', 'ENPH', 'GR', 'HCAL', 'HMIN', 'HMNO', 'ILD', 'ILM', 'LLD', 'LLM', 'MSFL', 'NPHI', 'NPOR', 'PCAL', 'PEFZ', 'PSR', 'RLA0', 'RLA1', 'RLA2', 'RLA3', 'RLA4', 'RLA5', 'ROP5', 'RSOZ', 'RXO', 'RXOZ', 'SFL', 'SNP', 'SP', 'SPHI', 'TENS', 'TNPB', 'TNPH', 'TNPH_CDN', 'TPHI'] # # Alleged result: # ['CALI', 'DPHI', 'GR ', 'ILD ', 'ILM ', 'NPHI', 'SP ', 'TNPH'] # # Formated, sorted. # ----------------- # Actual curves in this LAS file: # ['BMIN', 'BMNO', 'CALI', 'DEPT', 'DPHI', 'DRHO', 'GR', 'ILD', 'ILM', # 'NPHI', 'PEF', 'RHOB', 'SFLU', 'SP', 'TNPH'] # # In XML file: # ['AHT10', 'AHT20', 'AHT30', 'AHT60', 'AHT90', 'APDC', 'APLC', 'APSC', # 'ATR', 'BS', 'C1', 'C2', 'CALI', 'CMFF', 'CMRP', 'DPHB', 'DPHI', 'DPHZ', # 'DPOR_CDN', 'DSOZ', 'ENPH', 'GR', 'HCAL', 'HMIN', 'HMNO', 'ILD', 'ILM', # 'LLD', 'LLM', 'MSFL', 'NPHI', 'NPOR', 'PCAL', 'PEFZ', 'PSR', 'RLA0', # 'RLA1', 'RLA2', 'RLA3', 'RLA4', 'RLA5', 'ROP5', 'RSOZ', 'RXO', 'RXOZ', # 'SFL', 'SNP', 'SP', 'SPHI', 'TENS', 'TNPB', 'TNPH', 'TNPH_CDN', 'TPHI'] # # Result, note SFL is achieved by substitution of an alternate: # ['CALI', 'DPHI', 'GR ', 'ILD ', 'ILM ', 'NPHI', 'SFL ', 'SP ', 'TNPH'] print() pprint.pprint(filmMap) self.assertEqual(1, len(filmMap)) self.assertTrue('Triple_Combo' in filmMap) # pprint.pprint(sorted([m.pStr() for m in filmMap['Triple_Combo']])) self.assertEqual( [ Mnem.Mnem(o) for o in [ 'CALI', 'DPHI', 'GR ', 'ILD ', 'ILM ', 'NPHI', 'SFL ', 'SP ', 'TNPH' ] ], sorted(filmMap['Triple_Combo']), )
def setUp(self): myFi = io.StringIO("""~VERSION INFORMATION VERS. 2.0: CWLS LOG ASCII STANDARD - VERSION 2 WRAP. NO: One line per depth step ~Well Information Section #MNEM.UNIT Data Type Information #--------- ------------- ------------------------------ STRT.M 635.0000: STOP.M 400.0000: STEP.M -0.1250: NULL. -999.25: COMP. ANY OIL COMPANY INC.: COMPANY WELL. ANY ET AL A9-16-49-20: WELL FLD . EDAM: FIELD LOC . A9-16-49-20W3M: LOCATION PROV. SASKATCHEWAN: PROVINCE SRVC. ANY LOGGING COMPANY INC.: SERVICE COMPANY DATE. 13-DEC-86: LOG DATE UWI . 100091604920W300: UNIQUE WELL ID LAT . 38.53915: Latitude North (KGS,LEO3.6) LON . 98.95341: LONGITUDE WEST (KGS, LEO3.6) ~Parameter Information Section #MNEM.UNIT Value Description #--------- ------------- ------------------------------ BHT .DEGC 24.0000: Bottom Hole Temperature BS .MM 222.0000: Bit Size FD .K/M3 999.9999: Fluid Density MDEN.K/M3 2650.0000: Logging Matrix Density MATR. 1.0000: Neutron Matrix (1=Sand) FNUM. 1.0000: Tortuosity Constant Archie's (a) FEXP. 2.0000: Cementation Exponent Archie's (m) DFD .K/M3 1200.0000: Mud Weight DFV .S 50.0000: Mud Viscosity DFL .C3 8.0000: Mud Fluid Loss DFPH. 10.0000: Mud pH RMFS.OHMM 2.8200: Mud Filtrate Resistivity EKB .M 566.9700: Elevation Kelly Bushing EGL .M 563.6799: Elevation Ground Level DL .M 635.0000: Depth Logger """) self._lasFile = LASRead.LASRead(myFi, 'MyID')
def _processFile(self, fp): """Process a single file. Returns the size of the file and the time taken to process.""" rSize = os.path.getsize(fp) clkStart = time.clock() try: myLr = LASRead.LASRead(fp) self._cntrs['byte'] += rSize self._cntrs['sect'] += len(myLr) self._cntrs['fram'] += myLr.numFrames() self._cntrs['data'] += myLr.numDataPoints() self._procLAS(myLr) except LASRead.ExceptionLASRead as err: logging.error('File: "{:s}", Error: {:s}'.format(fp, err)) self._cntrs['erro'] += 1 except Exception as err: logging.critical('File: "{:s}", Error [{:s}]: {:s}'.format(fp, type(err), err)) logging.critical(traceback.format_exc()) self._cntrs['crit'] += 1 self._cntrs['file'] += 1 return rSize, time.clock() - clkStart