コード例 #1
0
ファイル: PlotLogs.py プロジェクト: 07012220/logio
 def _retUniqueIdS(self, theLpOrLasFile):
     """Returns a list of UniqueID strings depending on my constructor."""
     assert (not self.usesInternalRecords)
     if self._lgFormatMinCurves > 0:
         # Filter out those that have fewer curves than self._lgFormatMinCurves
         myMap = XMLMatches.fileCurveMap(theLpOrLasFile)
         myLgUidS = []
         for u, i in myMap.items():
             if len(i) > self._lgFormatMinCurves \
             and (len(self._lgFormatS) == 0 or u in self._lgFormatS):
                 myLgUidS.append(u)
         return myLgUidS
     return self._lgFormatS
コード例 #2
0
 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']),
     )
コード例 #3
0
 def test_02(self):
     """TestXMLMatchesRHDT.test_01(): Which XML LgFormat files with RPS1 (RepCode 130, 80 bytes) channel and a LIS LogPass."""
     # DIPMETER_EDIT_TAPE_REP_CODE
     myF = self._retFileSinglePr(
         # LRH for DFSR
         bytes([64, 0])
         # EB 4, up/down value 0 (down)
         + bytes([4, 1, 66, 0])
         # EB 12, absent value -153.0
         + bytes([12, 4, 68]) + b'\xbb\xb3\x80\x00'
         # EB 0 terminates read
         + bytes([0, 1, 66, 0])
         #
         # Sensor 0
         # Mnemonic  Service ID  Serv ord No    Units   API 45,310,01,1       File No: 256
         + b'DEPT' + b'ServID' + b'ServOrdN' + b'FEET' +
         b'\x02\xb3\x60\x3b' + bytes([1, 0])
         # 4 LIS bytes     Pad      1 super  Rep code     Process indicators
         + bytes([0, 4]) + b'000' + b'\x01' + bytes([
             68,
         ]) + bytes([0, 1, 2, 3, 4])
         # Sensor 1
         + b'RPS1' + b'ServID' + b'ServOrdN' + b'    ' +
         b'\x02\xb3\x60\x3b' + bytes([1, 0]) + bytes([0, 80]) + b'000' +
         b'\x01' + bytes([
             130,
         ]) + bytes([0, 1, 2, 3, 4])
         # Sensor 2
         + b'P1AZ' + b'ServID' + b'ServOrdN' + b'    ' +
         b'\x02\xb3\x60\x3b' + bytes([1, 0]) + bytes([0, 4]) + b'000' +
         b'\x01' + bytes([
             68,
         ]) + bytes([0, 1, 2, 3, 4])
         # Sensor 3
         + b'DEVI' + b'ServID' + b'ServOrdN' + b'    ' +
         b'\x02\xb3\x60\x3b' + bytes([1, 0]) + bytes([0, 4]) + b'000' +
         b'\x01' + bytes([
             68,
         ]) + bytes([0, 1, 2, 3, 4])
         # Sensor 4
         + b'HAZI' + b'ServID' + b'ServOrdN' + b'    ' +
         b'\x02\xb3\x60\x3b' + bytes([1, 0]) + bytes([0, 4]) + b'000' +
         b'\x01' + bytes([
             68,
         ]) + bytes([0, 1, 2, 3, 4])
         # Sensor 5
         + b'C1  ' + b'ServID' + b'ServOrdN' + b'    ' +
         b'\x02\xb3\x60\x3b' + bytes([1, 0]) + bytes([0, 4]) + b'000' +
         b'\x01' + bytes([
             68,
         ]) + bytes([0, 1, 2, 3, 4])
         # Sensor 6
         + b'C2  ' + b'ServID' + b'ServOrdN' + b'    ' +
         b'\x02\xb3\x60\x3b' + bytes([1, 0]) + bytes([0, 4]) + b'000' +
         b'\x01' + bytes([
             68,
         ]) + bytes([0, 1, 2, 3, 4])
         # Sensor 7
         + b'FEP ' + b'ServID' + b'ServOrdN' + b'    ' +
         b'\x02\xb3\x60\x3b' + bytes([1, 0]) + bytes([0, 4]) + b'000' +
         b'\x01' + bytes([
             68,
         ]) + bytes([0, 1, 2, 3, 4])
         # Sensor 8
         + b'RB  ' + b'ServID' + b'ServOrdN' + b'    ' +
         b'\x02\xb3\x60\x3b' + bytes([1, 0]) + bytes([0, 4]) + b'000' +
         b'\x01' + bytes([
             68,
         ]) + bytes([0, 1, 2, 3, 4]))
     myLp = LogPass.LogPass(LogiRec.LrDFSRRead(myF), 'FileID')
     myFilmCfg = FILMCfgXML.FilmCfgXMLRead('')
     myFilmCfg.addXMLRoot(etree.fromstring(
         TestLgFormatXMLData.LGFORMAT_HDT))
     filmMap = XMLMatches.fileCurveMapFromFILM(myLp, myFilmCfg)
     #        print()
     #        print('myLp._chMap:')
     #        pprint.pprint(myLp._chMap)
     #        print(myLp.longStr())
     #        pprint.pprint(sorted(myLp.outpMnemS()))
     #        print('filmMap:')
     #        pprint.pprint(filmMap)
     #        pprint.pprint(sorted(filmMap['HDT']))
     self.assertEqual(
         [
             Mnem.Mnem(b'C1\x00\x00'),
             Mnem.Mnem(b'C2\x00\x00'),
             Mnem.Mnem(b'DEPT'),
             Mnem.Mnem(b'DEVI'),
             #                Mnem.Mnem(b'EMEX'),
             Mnem.Mnem(b'FC0\x00'),
             Mnem.Mnem(b'FC1\x00'),
             Mnem.Mnem(b'FC2\x00'),
             Mnem.Mnem(b'FC3\x00'),
             Mnem.Mnem(b'FC4\x00'),
             Mnem.Mnem(b'FEP\x00'),
             #                Mnem.Mnem(b'FEP1'),
             #                Mnem.Mnem(b'FEP2'),
             Mnem.Mnem(b'HAZI'),
             Mnem.Mnem(b'P1AZ'),
             #                Mnem.Mnem(b'PADP'),
             #                Mnem.Mnem(b'RAC1'),
             #                Mnem.Mnem(b'RAC2'),
             Mnem.Mnem(b'RB\x00\x00'),
             #                Mnem.Mnem(b'REF\x00'),
             #                Mnem.Mnem(b'REFC'),
             #                Mnem.Mnem(b'STAT'),
             #                Mnem.Mnem(b'TEMP'),
         ],
         sorted(myLp.outpMnemS()),
     )
     self.assertEqual(1, len(filmMap))
     self.assertTrue('HDT' in filmMap)
     self.assertEqual([
         Mnem.Mnem(b'C1\x00\x00'),
         Mnem.Mnem(b'C2\x00\x00'),
         Mnem.Mnem(b'DEVI'),
         Mnem.Mnem(b'FC0\x00'),
         Mnem.Mnem(b'FC1\x00'),
         Mnem.Mnem(b'FC2\x00'),
         Mnem.Mnem(b'FC3\x00'),
         Mnem.Mnem(b'FC4\x00'),
         Mnem.Mnem(b'HAZI'),
         Mnem.Mnem(b'P1AZ'),
         Mnem.Mnem(b'RB\x00\x00'),
     ], sorted(filmMap['HDT']))