##// END OF EJS Templates
Cambio en los atributos: dataIn, dataOut.
Daniel Valdez -
r179:e4faab4afbdd
parent child
Show More
@@ -0,0 +1,3
1 import jrodata
2 import jrodataIO
3 import jroprocessing
@@ -162,7 +162,7 class JRODataIO:
162 162
163 163 c = 3E8
164 164
165 __isConfig = False
165 isConfig = False
166 166
167 167 basicHeaderObj = BasicHeader()
168 168
@@ -220,7 +220,7 class JRODataIO:
220 220
221 221 datablock = None
222 222
223 dataOutObj = None
223 dataOut = None
224 224
225 225 blocksize = None
226 226
@@ -418,7 +418,7 class JRODataReader(JRODataIO):
418 418
419 419 return directory, filename, year, doy, set
420 420
421 def setup(self,dataOutObj=None,
421 def setup(self,dataOut=None,
422 422 path=None,
423 423 startDate=None,
424 424 endDate=None,
@@ -436,10 +436,10 class JRODataReader(JRODataIO):
436 436 if ext == None:
437 437 ext = self.ext
438 438
439 if dataOutObj == None:
440 dataOutObj = self.createObjByDefault()
439 if dataOut == None:
440 dataOut = self.createObjByDefault()
441 441
442 self.dataOutObj = dataOutObj
442 self.dataOut = dataOut
443 443
444 444 if online:
445 445 print "Searching files in online mode..."
@@ -495,7 +495,7 class JRODataReader(JRODataIO):
495 495
496 496 # self.updateDataHeader()
497 497
498 return self.dataOutObj
498 return self.dataOut
499 499
500 500 def __setNextFileOffline(self):
501 501
@@ -718,8 +718,8 class JRODataReader(JRODataIO):
718 718 self.dtype = datatype_str
719 719 self.ippSeconds = 2 * 1000 * self.radarControllerHeaderObj.ipp / self.c
720 720 self.fileSizeByHeader = self.processingHeaderObj.dataBlocksPerFile * self.processingHeaderObj.blockSize + self.firstHeaderSize + self.basicHeaderSize*(self.processingHeaderObj.dataBlocksPerFile - 1)
721 # self.dataOutObj.channelList = numpy.arange(self.systemHeaderObj.numChannels)
722 # self.dataOutObj.channelIndexList = numpy.arange(self.systemHeaderObj.numChannels)
721 # self.dataOut.channelList = numpy.arange(self.systemHeaderObj.numChannels)
722 # self.dataOut.channelIndexList = numpy.arange(self.systemHeaderObj.numChannels)
723 723 self.getBlockDimension()
724 724
725 725
@@ -780,11 +780,11 class JRODataReader(JRODataIO):
780 780
781 781 def run(self, **kwargs):
782 782
783 if not(self.__isConfig):
783 if not(self.isConfig):
784 784
785 self.dataOutObj = dataOut
785 # self.dataOut = dataOut
786 786 self.setup(**kwargs)
787 self.__isConfig = True
787 self.isConfig = True
788 788
789 789 self.getData()
790 790
@@ -807,7 +807,7 class JRODataWriter(JRODataIO):
807 807
808 808 nWriteBlocks = 0
809 809
810 def __init__(self, dataOutObj=None):
810 def __init__(self, dataOut=None):
811 811 raise ValueError, "Not implemented"
812 812
813 813
@@ -849,8 +849,8 class JRODataWriter(JRODataIO):
849 849 self.basicHeaderObj.version = self.versionFile
850 850 self.basicHeaderObj.dataBlock = self.nTotalBlocks
851 851
852 utc = numpy.floor(self.dataOutObj.utctime)
853 milisecond = (self.dataOutObj.utctime - utc)* 1000.0
852 utc = numpy.floor(self.dataOut.utctime)
853 milisecond = (self.dataOut.utctime - utc)* 1000.0
854 854
855 855 self.basicHeaderObj.utc = utc
856 856 self.basicHeaderObj.miliSecond = milisecond
@@ -879,7 +879,7 class JRODataWriter(JRODataIO):
879 879 self.radarControllerHeaderObj.write(self.fp)
880 880 self.processingHeaderObj.write(self.fp)
881 881
882 self.dtype = self.dataOutObj.dtype
882 self.dtype = self.dataOut.dtype
883 883
884 884 def __setNewBlock(self):
885 885 """
@@ -941,7 +941,7 class JRODataWriter(JRODataIO):
941 941 if self.fp != None:
942 942 self.fp.close()
943 943
944 timeTuple = time.localtime( self.dataOutObj.dataUtcTime)
944 timeTuple = time.localtime( self.dataOut.dataUtcTime)
945 945 subfolder = 'D%4.4d%3.3d' % (timeTuple.tm_year,timeTuple.tm_yday)
946 946
947 947 doypath = os.path.join( path, subfolder )
@@ -1032,11 +1032,11 class JRODataWriter(JRODataIO):
1032 1032
1033 1033 def run(self, dataOut, **kwargs):
1034 1034
1035 if not(self.__isConfig):
1035 if not(self.isConfig):
1036 1036
1037 self.dataOutObj = dataOut
1037 self.dataOut = dataOut
1038 1038 self.setup(**kwargs)
1039 self.__isConfig = True
1039 self.isConfig = True
1040 1040
1041 1041 self.putData()
1042 1042
@@ -1084,15 +1084,15 class VoltageReader(JRODataReader):
1084 1084 ext = ".r"
1085 1085
1086 1086 optchar = "D"
1087 dataOutObj = None
1087 dataOut = None
1088 1088
1089 1089
1090 def __init__(self, dataOutObj=None):
1090 def __init__(self, dataOut=None):
1091 1091 """
1092 1092 Inicializador de la clase VoltageReader para la lectura de datos de voltage.
1093 1093
1094 1094 Input:
1095 dataOutObj : Objeto de la clase Voltage. Este objeto sera utilizado para
1095 dataOut : Objeto de la clase Voltage. Este objeto sera utilizado para
1096 1096 almacenar un perfil de datos cada vez que se haga un requerimiento
1097 1097 (getData). El perfil sera obtenido a partir del buffer de datos,
1098 1098 si el buffer esta vacio se hara un nuevo proceso de lectura de un
@@ -1100,13 +1100,13 class VoltageReader(JRODataReader):
1100 1100 Si este parametro no es pasado se creara uno internamente.
1101 1101
1102 1102 Variables afectadas:
1103 self.dataOutObj
1103 self.dataOut
1104 1104
1105 1105 Return:
1106 1106 None
1107 1107 """
1108 1108
1109 self.__isConfig = False
1109 self.isConfig = False
1110 1110
1111 1111 self.datablock = None
1112 1112
@@ -1265,11 +1265,11 class VoltageReader(JRODataReader):
1265 1265 buffer. Si no hay mas archivos a leer retorna None.
1266 1266
1267 1267 Variables afectadas:
1268 self.dataOutObj
1268 self.dataOut
1269 1269 self.profileIndex
1270 1270
1271 1271 Affected:
1272 self.dataOutObj
1272 self.dataOut
1273 1273 self.profileIndex
1274 1274 self.flagTimeBlock
1275 1275 self.flagIsNewBlock
@@ -1293,59 +1293,59 class VoltageReader(JRODataReader):
1293 1293 #data es un numpy array de 3 dmensiones (perfiles, alturas y canales)
1294 1294
1295 1295 if self.datablock == None:
1296 self.dataOutObj.flagNoData = True
1296 self.dataOut.flagNoData = True
1297 1297 return 0
1298 1298
1299 self.dataOutObj.data = self.datablock[:,self.profileIndex,:]
1299 self.dataOut.data = self.datablock[:,self.profileIndex,:]
1300 1300
1301 self.dataOutObj.dtype = self.dtype
1301 self.dataOut.dtype = self.dtype
1302 1302
1303 self.dataOutObj.nChannels = self.systemHeaderObj.nChannels
1303 self.dataOut.nChannels = self.systemHeaderObj.nChannels
1304 1304
1305 self.dataOutObj.nHeights = self.processingHeaderObj.nHeights
1305 self.dataOut.nHeights = self.processingHeaderObj.nHeights
1306 1306
1307 self.dataOutObj.nProfiles = self.processingHeaderObj.profilesPerBlock
1307 self.dataOut.nProfiles = self.processingHeaderObj.profilesPerBlock
1308 1308
1309 1309 xf = self.processingHeaderObj.firstHeight + self.processingHeaderObj.nHeights*self.processingHeaderObj.deltaHeight
1310 1310
1311 self.dataOutObj.heightList = numpy.arange(self.processingHeaderObj.firstHeight, xf, self.processingHeaderObj.deltaHeight)
1311 self.dataOut.heightList = numpy.arange(self.processingHeaderObj.firstHeight, xf, self.processingHeaderObj.deltaHeight)
1312 1312
1313 self.dataOutObj.channelList = range(self.systemHeaderObj.nChannels)
1313 self.dataOut.channelList = range(self.systemHeaderObj.nChannels)
1314 1314
1315 self.dataOutObj.channelIndexList = range(self.systemHeaderObj.nChannels)
1315 self.dataOut.channelIndexList = range(self.systemHeaderObj.nChannels)
1316 1316
1317 self.dataOutObj.flagTimeBlock = self.flagTimeBlock
1317 self.dataOut.flagTimeBlock = self.flagTimeBlock
1318 1318
1319 self.dataOutObj.utctime = self.basicHeaderObj.utc + self.basicHeaderObj.miliSecond/1000. + self.profileIndex * self.ippSeconds
1319 self.dataOut.utctime = self.basicHeaderObj.utc + self.basicHeaderObj.miliSecond/1000. + self.profileIndex * self.ippSeconds
1320 1320
1321 self.dataOutObj.ippSeconds = self.ippSeconds
1321 self.dataOut.ippSeconds = self.ippSeconds
1322 1322
1323 self.dataOutObj.timeInterval = self.ippSeconds * self.processingHeaderObj.nCohInt
1323 self.dataOut.timeInterval = self.ippSeconds * self.processingHeaderObj.nCohInt
1324 1324
1325 self.dataOutObj.nCohInt = self.processingHeaderObj.nCohInt
1325 self.dataOut.nCohInt = self.processingHeaderObj.nCohInt
1326 1326
1327 self.dataOutObj.flagShiftFFT = False
1327 self.dataOut.flagShiftFFT = False
1328 1328
1329 1329 if self.processingHeaderObj.code != None:
1330 self.dataOutObj.nCode = self.processingHeaderObj.nCode
1330 self.dataOut.nCode = self.processingHeaderObj.nCode
1331 1331
1332 self.dataOutObj.nBaud = self.processingHeaderObj.nBaud
1332 self.dataOut.nBaud = self.processingHeaderObj.nBaud
1333 1333
1334 self.dataOutObj.code = self.processingHeaderObj.code
1334 self.dataOut.code = self.processingHeaderObj.code
1335 1335
1336 1336 self.profileIndex += 1
1337 1337
1338 self.dataOutObj.systemHeaderObj = self.systemHeaderObj.copy()
1338 self.dataOut.systemHeaderObj = self.systemHeaderObj.copy()
1339 1339
1340 self.dataOutObj.radarControllerHeaderObj = self.radarControllerHeaderObj.copy()
1340 self.dataOut.radarControllerHeaderObj = self.radarControllerHeaderObj.copy()
1341 1341
1342 self.dataOutObj.flagNoData = False
1342 self.dataOut.flagNoData = False
1343 1343
1344 # print self.profileIndex, self.dataOutObj.utctime
1344 # print self.profileIndex, self.dataOut.utctime
1345 1345 # if self.profileIndex == 800:
1346 1346 # a=1
1347 1347
1348 return self.dataOutObj.data
1348 return self.dataOut.data
1349 1349
1350 1350
1351 1351 class VoltageWriter(JRODataWriter):
@@ -1361,28 +1361,28 class VoltageWriter(JRODataWriter):
1361 1361 shapeBuffer = None
1362 1362
1363 1363
1364 def __init__(self, dataOutObj=None):
1364 def __init__(self, dataOut=None):
1365 1365 """
1366 1366 Inicializador de la clase VoltageWriter para la escritura de datos de espectros.
1367 1367
1368 1368 Affected:
1369 self.dataOutObj
1369 self.dataOut
1370 1370
1371 1371 Return: None
1372 1372 """
1373 if dataOutObj == None:
1374 dataOutObj = Voltage()
1373 if dataOut == None:
1374 dataOut = Voltage()
1375 1375
1376 if not( isinstance(dataOutObj, Voltage) ):
1377 raise ValueError, "in VoltageReader, dataOutObj must be an Spectra class object"
1376 if not( isinstance(dataOut, Voltage) ):
1377 raise ValueError, "in VoltageReader, dataOut must be an Spectra class object"
1378 1378
1379 self.dataOutObj = dataOutObj
1379 self.dataOut = dataOut
1380 1380
1381 1381 self.nTotalBlocks = 0
1382 1382
1383 1383 self.profileIndex = 0
1384 1384
1385 self.__isConfig = False
1385 self.isConfig = False
1386 1386
1387 1387 self.fp = None
1388 1388
@@ -1484,12 +1484,12 class VoltageWriter(JRODataWriter):
1484 1484 0 : Si no hay data o no hay mas files que puedan escribirse
1485 1485 1 : Si se escribio la data de un bloque en un file
1486 1486 """
1487 if self.dataOutObj.flagNoData:
1487 if self.dataOut.flagNoData:
1488 1488 return 0
1489 1489
1490 1490 self.flagIsNewBlock = 0
1491 1491
1492 if self.dataOutObj.flagTimeBlock:
1492 if self.dataOut.flagTimeBlock:
1493 1493
1494 1494 self.datablock.fill(0)
1495 1495 self.profileIndex = 0
@@ -1498,7 +1498,7 class VoltageWriter(JRODataWriter):
1498 1498 if self.profileIndex == 0:
1499 1499 self.getBasicHeader()
1500 1500
1501 self.datablock[:,self.profileIndex,:] = self.dataOutObj.data
1501 self.datablock[:,self.profileIndex,:] = self.dataOut.data
1502 1502
1503 1503 self.profileIndex += 1
1504 1504
@@ -1537,22 +1537,22 class VoltageWriter(JRODataWriter):
1537 1537
1538 1538
1539 1539 for index in range(len(dtypeList)):
1540 if self.dataOutObj.dtype == dtypeList[index]:
1540 if self.dataOut.dtype == dtypeList[index]:
1541 1541 dtypeValue = datatypeValueList[index]
1542 1542 break
1543 1543
1544 1544 processFlags += dtypeValue
1545 1545
1546 if self.dataOutObj.flagDecodeData:
1546 if self.dataOut.flagDecodeData:
1547 1547 processFlags += PROCFLAG.DECODE_DATA
1548 1548
1549 if self.dataOutObj.flagDeflipData:
1549 if self.dataOut.flagDeflipData:
1550 1550 processFlags += PROCFLAG.DEFLIP_DATA
1551 1551
1552 if self.dataOutObj.code != None:
1552 if self.dataOut.code != None:
1553 1553 processFlags += PROCFLAG.DEFINE_PROCESS_CODE
1554 1554
1555 if self.dataOutObj.nCohInt > 1:
1555 if self.dataOut.nCohInt > 1:
1556 1556 processFlags += PROCFLAG.COHERENT_INTEGRATION
1557 1557
1558 1558 return processFlags
@@ -1573,11 +1573,11 class VoltageWriter(JRODataWriter):
1573 1573 dtypeList = [dtype0, dtype1, dtype2, dtype3, dtype4, dtype5]
1574 1574 datatypeValueList = [1,2,4,8,4,8]
1575 1575 for index in range(len(dtypeList)):
1576 if self.dataOutObj.dtype == dtypeList[index]:
1576 if self.dataOut.dtype == dtypeList[index]:
1577 1577 datatypeValue = datatypeValueList[index]
1578 1578 break
1579 1579
1580 blocksize = int(self.dataOutObj.nHeights * self.dataOutObj.nChannels * self.dataOutObj.nProfiles * datatypeValue * 2)
1580 blocksize = int(self.dataOut.nHeights * self.dataOut.nChannels * self.dataOut.nProfiles * datatypeValue * 2)
1581 1581
1582 1582 return blocksize
1583 1583
@@ -1595,9 +1595,9 class VoltageWriter(JRODataWriter):
1595 1595 None
1596 1596 """
1597 1597
1598 self.systemHeaderObj = self.dataOutObj.systemHeaderObj.copy()
1599 self.systemHeaderObj.nChannels = self.dataOutObj.nChannels
1600 self.radarControllerHeaderObj = self.dataOutObj.radarControllerHeaderObj.copy()
1598 self.systemHeaderObj = self.dataOut.systemHeaderObj.copy()
1599 self.systemHeaderObj.nChannels = self.dataOut.nChannels
1600 self.radarControllerHeaderObj = self.dataOut.radarControllerHeaderObj.copy()
1601 1601
1602 1602 self.getBasicHeader()
1603 1603
@@ -1606,24 +1606,24 class VoltageWriter(JRODataWriter):
1606 1606 self.processingHeaderObj.blockSize = self.__getBlockSize()
1607 1607 self.processingHeaderObj.profilesPerBlock = self.profilesPerBlock
1608 1608 self.processingHeaderObj.dataBlocksPerFile = self.blocksPerFile
1609 self.processingHeaderObj.nWindows = 1 #podria ser 1 o self.dataOutObj.processingHeaderObj.nWindows
1609 self.processingHeaderObj.nWindows = 1 #podria ser 1 o self.dataOut.processingHeaderObj.nWindows
1610 1610 self.processingHeaderObj.processFlags = self.__getProcessFlags()
1611 self.processingHeaderObj.nCohInt = self.dataOutObj.nCohInt
1611 self.processingHeaderObj.nCohInt = self.dataOut.nCohInt
1612 1612 self.processingHeaderObj.nIncohInt = 1 # Cuando la data de origen es de tipo Voltage
1613 1613 self.processingHeaderObj.totalSpectra = 0 # Cuando la data de origen es de tipo Voltage
1614 1614
1615 if self.dataOutObj.code != None:
1616 self.processingHeaderObj.code = self.dataOutObj.code
1617 self.processingHeaderObj.nCode = self.dataOutObj.nCode
1618 self.processingHeaderObj.nBaud = self.dataOutObj.nBaud
1619 codesize = int(8 + 4 * self.dataOutObj.nCode * self.dataOutObj.nBaud)
1615 if self.dataOut.code != None:
1616 self.processingHeaderObj.code = self.dataOut.code
1617 self.processingHeaderObj.nCode = self.dataOut.nCode
1618 self.processingHeaderObj.nBaud = self.dataOut.nBaud
1619 codesize = int(8 + 4 * self.dataOut.nCode * self.dataOut.nBaud)
1620 1620 processingHeaderSize += codesize
1621 1621
1622 1622 if self.processingHeaderObj.nWindows != 0:
1623 self.processingHeaderObj.firstHeight = self.dataOutObj.heightList[0]
1624 self.processingHeaderObj.deltaHeight = self.dataOutObj.heightList[1] - self.dataOutObj.heightList[0]
1625 self.processingHeaderObj.nHeights = self.dataOutObj.nHeights
1626 self.processingHeaderObj.samplesWin = self.dataOutObj.nHeights
1623 self.processingHeaderObj.firstHeight = self.dataOut.heightList[0]
1624 self.processingHeaderObj.deltaHeight = self.dataOut.heightList[1] - self.dataOut.heightList[0]
1625 self.processingHeaderObj.nHeights = self.dataOut.nHeights
1626 self.processingHeaderObj.samplesWin = self.dataOut.nHeights
1627 1627 processingHeaderSize += 12
1628 1628
1629 1629 self.processingHeaderObj.size = processingHeaderSize
@@ -1679,7 +1679,7 class SpectraReader(JRODataReader):
1679 1679
1680 1680 optchar = "P"
1681 1681
1682 dataOutObj = None
1682 dataOut = None
1683 1683
1684 1684 nRdChannels = None
1685 1685
@@ -1688,12 +1688,12 class SpectraReader(JRODataReader):
1688 1688 rdPairList = []
1689 1689
1690 1690
1691 def __init__(self, dataOutObj=None):
1691 def __init__(self, dataOut=None):
1692 1692 """
1693 1693 Inicializador de la clase SpectraReader para la lectura de datos de espectros.
1694 1694
1695 1695 Inputs:
1696 dataOutObj : Objeto de la clase Spectra. Este objeto sera utilizado para
1696 dataOut : Objeto de la clase Spectra. Este objeto sera utilizado para
1697 1697 almacenar un perfil de datos cada vez que se haga un requerimiento
1698 1698 (getData). El perfil sera obtenido a partir del buffer de datos,
1699 1699 si el buffer esta vacio se hara un nuevo proceso de lectura de un
@@ -1701,12 +1701,12 class SpectraReader(JRODataReader):
1701 1701 Si este parametro no es pasado se creara uno internamente.
1702 1702
1703 1703 Affected:
1704 self.dataOutObj
1704 self.dataOut
1705 1705
1706 1706 Return : None
1707 1707 """
1708 1708
1709 self.__isConfig = False
1709 self.isConfig = False
1710 1710
1711 1711 self.pts2read_SelfSpectra = 0
1712 1712
@@ -1804,8 +1804,8 class SpectraReader(JRODataReader):
1804 1804 self.pts2read_CrossSpectra
1805 1805 self.pts2read_DCchannels
1806 1806 self.blocksize
1807 self.dataOutObj.nChannels
1808 self.dataOutObj.nPairs
1807 self.dataOut.nChannels
1808 self.dataOut.nPairs
1809 1809
1810 1810 Return:
1811 1811 None
@@ -1914,7 +1914,7 class SpectraReader(JRODataReader):
1914 1914 1 : Si hizo una buena copia del buffer
1915 1915
1916 1916 Affected:
1917 self.dataOutObj
1917 self.dataOut
1918 1918
1919 1919 self.flagTimeBlock
1920 1920 self.flagIsNewBlock
@@ -1939,60 +1939,60 class SpectraReader(JRODataReader):
1939 1939 #data es un numpy array de 3 dmensiones (perfiles, alturas y canales)
1940 1940
1941 1941 if self.data_dc == None:
1942 self.dataOutObj.flagNoData = True
1942 self.dataOut.flagNoData = True
1943 1943 return 0
1944 1944
1945 1945
1946 self.dataOutObj.data_spc = self.data_spc
1946 self.dataOut.data_spc = self.data_spc
1947 1947
1948 self.dataOutObj.data_cspc = self.data_cspc
1948 self.dataOut.data_cspc = self.data_cspc
1949 1949
1950 self.dataOutObj.data_dc = self.data_dc
1950 self.dataOut.data_dc = self.data_dc
1951 1951
1952 self.dataOutObj.flagTimeBlock = self.flagTimeBlock
1952 self.dataOut.flagTimeBlock = self.flagTimeBlock
1953 1953
1954 self.dataOutObj.flagNoData = False
1954 self.dataOut.flagNoData = False
1955 1955
1956 self.dataOutObj.dtype = self.dtype
1956 self.dataOut.dtype = self.dtype
1957 1957
1958 self.dataOutObj.nChannels = self.nRdChannels
1958 self.dataOut.nChannels = self.nRdChannels
1959 1959
1960 self.dataOutObj.nPairs = self.nRdPairs
1960 self.dataOut.nPairs = self.nRdPairs
1961 1961
1962 self.dataOutObj.pairsList = self.rdPairList
1962 self.dataOut.pairsList = self.rdPairList
1963 1963
1964 self.dataOutObj.nHeights = self.processingHeaderObj.nHeights
1964 self.dataOut.nHeights = self.processingHeaderObj.nHeights
1965 1965
1966 self.dataOutObj.nProfiles = self.processingHeaderObj.profilesPerBlock
1966 self.dataOut.nProfiles = self.processingHeaderObj.profilesPerBlock
1967 1967
1968 self.dataOutObj.nFFTPoints = self.processingHeaderObj.profilesPerBlock
1968 self.dataOut.nFFTPoints = self.processingHeaderObj.profilesPerBlock
1969 1969
1970 self.dataOutObj.nIncohInt = self.processingHeaderObj.nIncohInt
1970 self.dataOut.nIncohInt = self.processingHeaderObj.nIncohInt
1971 1971
1972 1972
1973 1973 xf = self.processingHeaderObj.firstHeight + self.processingHeaderObj.nHeights*self.processingHeaderObj.deltaHeight
1974 1974
1975 self.dataOutObj.heightList = numpy.arange(self.processingHeaderObj.firstHeight, xf, self.processingHeaderObj.deltaHeight)
1975 self.dataOut.heightList = numpy.arange(self.processingHeaderObj.firstHeight, xf, self.processingHeaderObj.deltaHeight)
1976 1976
1977 self.dataOutObj.channelList = range(self.systemHeaderObj.nChannels)
1977 self.dataOut.channelList = range(self.systemHeaderObj.nChannels)
1978 1978
1979 self.dataOutObj.channelIndexList = range(self.systemHeaderObj.nChannels)
1979 self.dataOut.channelIndexList = range(self.systemHeaderObj.nChannels)
1980 1980
1981 self.dataOutObj.utctime = self.basicHeaderObj.utc + self.basicHeaderObj.miliSecond/1000.#+ self.profileIndex * self.ippSeconds
1981 self.dataOut.utctime = self.basicHeaderObj.utc + self.basicHeaderObj.miliSecond/1000.#+ self.profileIndex * self.ippSeconds
1982 1982
1983 self.dataOutObj.ippSeconds = self.ippSeconds
1983 self.dataOut.ippSeconds = self.ippSeconds
1984 1984
1985 self.dataOutObj.timeInterval = self.ippSeconds * self.processingHeaderObj.nCohInt * self.processingHeaderObj.nIncohInt * self.dataOutObj.nFFTPoints
1985 self.dataOut.timeInterval = self.ippSeconds * self.processingHeaderObj.nCohInt * self.processingHeaderObj.nIncohInt * self.dataOut.nFFTPoints
1986 1986
1987 self.dataOutObj.flagShiftFFT = self.processingHeaderObj.shif_fft
1987 self.dataOut.flagShiftFFT = self.processingHeaderObj.shif_fft
1988 1988
1989 1989 # self.profileIndex += 1
1990 1990
1991 self.dataOutObj.systemHeaderObj = self.systemHeaderObj.copy()
1991 self.dataOut.systemHeaderObj = self.systemHeaderObj.copy()
1992 1992
1993 self.dataOutObj.radarControllerHeaderObj = self.radarControllerHeaderObj.copy()
1993 self.dataOut.radarControllerHeaderObj = self.radarControllerHeaderObj.copy()
1994 1994
1995 return self.dataOutObj.data_spc
1995 return self.dataOut.data_spc
1996 1996
1997 1997
1998 1998 class SpectraWriter(JRODataWriter):
@@ -2018,14 +2018,14 class SpectraWriter(JRODataWriter):
2018 2018
2019 2019 data_dc = None
2020 2020
2021 # dataOutObj = None
2021 # dataOut = None
2022 2022
2023 def __init__(self, dataOutObj=None):
2023 def __init__(self, dataOut=None):
2024 2024 """
2025 2025 Inicializador de la clase SpectraWriter para la escritura de datos de espectros.
2026 2026
2027 2027 Affected:
2028 self.dataOutObj
2028 self.dataOut
2029 2029 self.basicHeaderObj
2030 2030 self.systemHeaderObj
2031 2031 self.radarControllerHeaderObj
@@ -2033,15 +2033,15 class SpectraWriter(JRODataWriter):
2033 2033
2034 2034 Return: None
2035 2035 """
2036 if dataOutObj == None:
2037 dataOutObj = Spectra()
2036 if dataOut == None:
2037 dataOut = Spectra()
2038 2038
2039 if not( isinstance(dataOutObj, Spectra) ):
2040 raise ValueError, "in SpectraReader, dataOutObj must be an Spectra class object"
2039 if not( isinstance(dataOut, Spectra) ):
2040 raise ValueError, "in SpectraReader, dataOut must be an Spectra class object"
2041 2041
2042 self.dataOutObj = dataOutObj
2042 self.dataOut = dataOut
2043 2043
2044 self.__isConfig = False
2044 self.isConfig = False
2045 2045
2046 2046 self.nTotalBlocks = 0
2047 2047
@@ -2095,15 +2095,15 class SpectraWriter(JRODataWriter):
2095 2095
2096 2096 Return: None
2097 2097 """
2098 self.shape_spc_Buffer = (self.dataOutObj.nChannels,
2098 self.shape_spc_Buffer = (self.dataOut.nChannels,
2099 2099 self.processingHeaderObj.nHeights,
2100 2100 self.processingHeaderObj.profilesPerBlock)
2101 2101
2102 self.shape_cspc_Buffer = (self.dataOutObj.nPairs,
2102 self.shape_cspc_Buffer = (self.dataOut.nPairs,
2103 2103 self.processingHeaderObj.nHeights,
2104 2104 self.processingHeaderObj.profilesPerBlock)
2105 2105
2106 self.shape_dc_Buffer = (self.dataOutObj.nChannels,
2106 self.shape_dc_Buffer = (self.dataOut.nChannels,
2107 2107 self.processingHeaderObj.nHeights)
2108 2108
2109 2109
@@ -2173,12 +2173,12 class SpectraWriter(JRODataWriter):
2173 2173 1 : Si se escribio la data de un bloque en un file
2174 2174 """
2175 2175
2176 if self.dataOutObj.flagNoData:
2176 if self.dataOut.flagNoData:
2177 2177 return 0
2178 2178
2179 2179 self.flagIsNewBlock = 0
2180 2180
2181 if self.dataOutObj.flagTimeBlock:
2181 if self.dataOut.flagTimeBlock:
2182 2182 self.data_spc.fill(0)
2183 2183 self.data_cspc.fill(0)
2184 2184 self.data_dc.fill(0)
@@ -2187,9 +2187,9 class SpectraWriter(JRODataWriter):
2187 2187 if self.flagIsNewFile == 0:
2188 2188 self.getBasicHeader()
2189 2189
2190 self.data_spc = self.dataOutObj.data_spc
2191 self.data_cspc = self.dataOutObj.data_cspc
2192 self.data_dc = self.dataOutObj.data_dc
2190 self.data_spc = self.dataOut.data_spc
2191 self.data_cspc = self.dataOut.data_cspc
2192 self.data_dc = self.dataOut.data_dc
2193 2193
2194 2194 # #self.processingHeaderObj.dataBlocksPerFile)
2195 2195 if self.hasAllDataInBuffer():
@@ -2227,25 +2227,25 class SpectraWriter(JRODataWriter):
2227 2227
2228 2228
2229 2229 for index in range(len(dtypeList)):
2230 if self.dataOutObj.dtype == dtypeList[index]:
2230 if self.dataOut.dtype == dtypeList[index]:
2231 2231 dtypeValue = datatypeValueList[index]
2232 2232 break
2233 2233
2234 2234 processFlags += dtypeValue
2235 2235
2236 if self.dataOutObj.flagDecodeData:
2236 if self.dataOut.flagDecodeData:
2237 2237 processFlags += PROCFLAG.DECODE_DATA
2238 2238
2239 if self.dataOutObj.flagDeflipData:
2239 if self.dataOut.flagDeflipData:
2240 2240 processFlags += PROCFLAG.DEFLIP_DATA
2241 2241
2242 if self.dataOutObj.code != None:
2242 if self.dataOut.code != None:
2243 2243 processFlags += PROCFLAG.DEFINE_PROCESS_CODE
2244 2244
2245 if self.dataOutObj.nIncohInt > 1:
2245 if self.dataOut.nIncohInt > 1:
2246 2246 processFlags += PROCFLAG.INCOHERENT_INTEGRATION
2247 2247
2248 if self.dataOutObj.data_dc != None:
2248 if self.dataOut.data_dc != None:
2249 2249 processFlags += PROCFLAG.SAVE_CHANNELS_DC
2250 2250
2251 2251 return processFlags
@@ -2266,22 +2266,22 class SpectraWriter(JRODataWriter):
2266 2266 dtypeList = [dtype0, dtype1, dtype2, dtype3, dtype4, dtype5]
2267 2267 datatypeValueList = [1,2,4,8,4,8]
2268 2268 for index in range(len(dtypeList)):
2269 if self.dataOutObj.dtype == dtypeList[index]:
2269 if self.dataOut.dtype == dtypeList[index]:
2270 2270 datatypeValue = datatypeValueList[index]
2271 2271 break
2272 2272
2273 2273
2274 pts2write = self.dataOutObj.nHeights * self.dataOutObj.nFFTPoints
2274 pts2write = self.dataOut.nHeights * self.dataOut.nFFTPoints
2275 2275
2276 pts2write_SelfSpectra = int(self.dataOutObj.nChannels * pts2write)
2276 pts2write_SelfSpectra = int(self.dataOut.nChannels * pts2write)
2277 2277 blocksize = (pts2write_SelfSpectra*datatypeValue)
2278 2278
2279 if self.dataOutObj.data_cspc != None:
2280 pts2write_CrossSpectra = int(self.dataOutObj.nPairs * pts2write)
2279 if self.dataOut.data_cspc != None:
2280 pts2write_CrossSpectra = int(self.dataOut.nPairs * pts2write)
2281 2281 blocksize += (pts2write_CrossSpectra*datatypeValue*2)
2282 2282
2283 if self.dataOutObj.data_dc != None:
2284 pts2write_DCchannels = int(self.dataOutObj.nChannels * self.dataOutObj.nHeights)
2283 if self.dataOut.data_dc != None:
2284 pts2write_DCchannels = int(self.dataOut.nChannels * self.dataOut.nHeights)
2285 2285 blocksize += (pts2write_DCchannels*datatypeValue*2)
2286 2286
2287 2287 blocksize = blocksize #* datatypeValue * 2 #CORREGIR ESTO
@@ -2302,31 +2302,31 class SpectraWriter(JRODataWriter):
2302 2302 None
2303 2303 """
2304 2304
2305 self.systemHeaderObj = self.dataOutObj.systemHeaderObj.copy()
2306 self.systemHeaderObj.nChannels = self.dataOutObj.nChannels
2307 self.radarControllerHeaderObj = self.dataOutObj.radarControllerHeaderObj.copy()
2305 self.systemHeaderObj = self.dataOut.systemHeaderObj.copy()
2306 self.systemHeaderObj.nChannels = self.dataOut.nChannels
2307 self.radarControllerHeaderObj = self.dataOut.radarControllerHeaderObj.copy()
2308 2308
2309 2309 self.getBasicHeader()
2310 2310
2311 2311 processingHeaderSize = 40 # bytes
2312 2312 self.processingHeaderObj.dtype = 0 # Voltage
2313 2313 self.processingHeaderObj.blockSize = self.__getBlockSize()
2314 self.processingHeaderObj.profilesPerBlock = self.dataOutObj.nFFTPoints
2314 self.processingHeaderObj.profilesPerBlock = self.dataOut.nFFTPoints
2315 2315 self.processingHeaderObj.dataBlocksPerFile = self.blocksPerFile
2316 self.processingHeaderObj.nWindows = 1 #podria ser 1 o self.dataOutObj.processingHeaderObj.nWindows
2316 self.processingHeaderObj.nWindows = 1 #podria ser 1 o self.dataOut.processingHeaderObj.nWindows
2317 2317 self.processingHeaderObj.processFlags = self.__getProcessFlags()
2318 self.processingHeaderObj.nCohInt = self.dataOutObj.nCohInt# Se requiere para determinar el valor de timeInterval
2319 self.processingHeaderObj.nIncohInt = self.dataOutObj.nIncohInt
2320 self.processingHeaderObj.totalSpectra = self.dataOutObj.nPairs + self.dataOutObj.nChannels
2318 self.processingHeaderObj.nCohInt = self.dataOut.nCohInt# Se requiere para determinar el valor de timeInterval
2319 self.processingHeaderObj.nIncohInt = self.dataOut.nIncohInt
2320 self.processingHeaderObj.totalSpectra = self.dataOut.nPairs + self.dataOut.nChannels
2321 2321
2322 2322 if self.processingHeaderObj.totalSpectra > 0:
2323 2323 channelList = []
2324 for channel in range(self.dataOutObj.nChannels):
2324 for channel in range(self.dataOut.nChannels):
2325 2325 channelList.append(channel)
2326 2326 channelList.append(channel)
2327 2327
2328 2328 pairsList = []
2329 for pair in self.dataOutObj.pairsList:
2329 for pair in self.dataOut.pairsList:
2330 2330 pairsList.append(pair[0])
2331 2331 pairsList.append(pair[1])
2332 2332 spectraComb = channelList + pairsList
@@ -2335,21 +2335,21 class SpectraWriter(JRODataWriter):
2335 2335 sizeOfSpcComb = len(spectraComb)
2336 2336 processingHeaderSize += sizeOfSpcComb
2337 2337
2338 if self.dataOutObj.code != None:
2339 self.processingHeaderObj.code = self.dataOutObj.code
2340 self.processingHeaderObj.nCode = self.dataOutObj.nCode
2341 self.processingHeaderObj.nBaud = self.dataOutObj.nBaud
2338 if self.dataOut.code != None:
2339 self.processingHeaderObj.code = self.dataOut.code
2340 self.processingHeaderObj.nCode = self.dataOut.nCode
2341 self.processingHeaderObj.nBaud = self.dataOut.nBaud
2342 2342 nCodeSize = 4 # bytes
2343 2343 nBaudSize = 4 # bytes
2344 2344 codeSize = 4 # bytes
2345 sizeOfCode = int(nCodeSize + nBaudSize + codeSize * self.dataOutObj.nCode * self.dataOutObj.nBaud)
2345 sizeOfCode = int(nCodeSize + nBaudSize + codeSize * self.dataOut.nCode * self.dataOut.nBaud)
2346 2346 processingHeaderSize += sizeOfCode
2347 2347
2348 2348 if self.processingHeaderObj.nWindows != 0:
2349 self.processingHeaderObj.firstHeight = self.dataOutObj.heightList[0]
2350 self.processingHeaderObj.deltaHeight = self.dataOutObj.heightList[1] - self.dataOutObj.heightList[0]
2351 self.processingHeaderObj.nHeights = self.dataOutObj.nHeights
2352 self.processingHeaderObj.samplesWin = self.dataOutObj.nHeights
2349 self.processingHeaderObj.firstHeight = self.dataOut.heightList[0]
2350 self.processingHeaderObj.deltaHeight = self.dataOut.heightList[1] - self.dataOut.heightList[0]
2351 self.processingHeaderObj.nHeights = self.dataOut.nHeights
2352 self.processingHeaderObj.samplesWin = self.dataOut.nHeights
2353 2353 sizeOfFirstHeight = 4
2354 2354 sizeOfdeltaHeight = 4
2355 2355 sizeOfnHeights = 4
@@ -2362,10 +2362,10 class SpectraHeisWriter():
2362 2362
2363 2363 i=0
2364 2364
2365 def __init__(self, dataOutObj):
2365 def __init__(self, dataOut):
2366 2366
2367 2367 self.wrObj = FITS()
2368 self.dataOutObj = dataOutObj
2368 self.dataOut = dataOut
2369 2369
2370 2370 def isNumber(str):
2371 2371 """
@@ -2395,9 +2395,9 class SpectraHeisWriter():
2395 2395 self.setFile = 0
2396 2396
2397 2397 def putData(self):
2398 # self.wrObj.writeHeader(nChannels=self.dataOutObj.nChannels, nFFTPoints=self.dataOutObj.nFFTPoints)
2399 #name = self.dataOutObj.utctime
2400 name= time.localtime( self.dataOutObj.utctime)
2398 # self.wrObj.writeHeader(nChannels=self.dataOut.nChannels, nFFTPoints=self.dataOut.nFFTPoints)
2399 #name = self.dataOut.utctime
2400 name= time.localtime( self.dataOut.utctime)
2401 2401 ext=".fits"
2402 2402 #folder='D%4.4d%3.3d'%(name.tm_year,name.tm_yday)
2403 2403 subfolder = 'D%4.4d%3.3d' % (name.tm_year,name.tm_yday)
@@ -2410,20 +2410,20 class SpectraHeisWriter():
2410 2410
2411 2411 filename = os.path.join(self.wrpath,subfolder, file)
2412 2412
2413 # print self.dataOutObj.ippSeconds
2414 freq=numpy.arange(-1*self.dataOutObj.nHeights/2.,self.dataOutObj.nHeights/2.)/(2*self.dataOutObj.ippSeconds)
2415
2416 col1=self.wrObj.setColF(name="freq", format=str(self.dataOutObj.nFFTPoints)+'E', array=freq)
2417 col2=self.wrObj.writeData(name="P_Ch1",format=str(self.dataOutObj.nFFTPoints)+'E',data=10*numpy.log10(self.dataOutObj.data_spc[0,:]))
2418 col3=self.wrObj.writeData(name="P_Ch2",format=str(self.dataOutObj.nFFTPoints)+'E',data=10*numpy.log10(self.dataOutObj.data_spc[1,:]))
2419 col4=self.wrObj.writeData(name="P_Ch3",format=str(self.dataOutObj.nFFTPoints)+'E',data=10*numpy.log10(self.dataOutObj.data_spc[2,:]))
2420 col5=self.wrObj.writeData(name="P_Ch4",format=str(self.dataOutObj.nFFTPoints)+'E',data=10*numpy.log10(self.dataOutObj.data_spc[3,:]))
2421 col6=self.wrObj.writeData(name="P_Ch5",format=str(self.dataOutObj.nFFTPoints)+'E',data=10*numpy.log10(self.dataOutObj.data_spc[4,:]))
2422 col7=self.wrObj.writeData(name="P_Ch6",format=str(self.dataOutObj.nFFTPoints)+'E',data=10*numpy.log10(self.dataOutObj.data_spc[5,:]))
2423 col8=self.wrObj.writeData(name="P_Ch7",format=str(self.dataOutObj.nFFTPoints)+'E',data=10*numpy.log10(self.dataOutObj.data_spc[6,:]))
2424 col9=self.wrObj.writeData(name="P_Ch8",format=str(self.dataOutObj.nFFTPoints)+'E',data=10*numpy.log10(self.dataOutObj.data_spc[7,:]))
2413 # print self.dataOut.ippSeconds
2414 freq=numpy.arange(-1*self.dataOut.nHeights/2.,self.dataOut.nHeights/2.)/(2*self.dataOut.ippSeconds)
2415
2416 col1=self.wrObj.setColF(name="freq", format=str(self.dataOut.nFFTPoints)+'E', array=freq)
2417 col2=self.wrObj.writeData(name="P_Ch1",format=str(self.dataOut.nFFTPoints)+'E',data=10*numpy.log10(self.dataOut.data_spc[0,:]))
2418 col3=self.wrObj.writeData(name="P_Ch2",format=str(self.dataOut.nFFTPoints)+'E',data=10*numpy.log10(self.dataOut.data_spc[1,:]))
2419 col4=self.wrObj.writeData(name="P_Ch3",format=str(self.dataOut.nFFTPoints)+'E',data=10*numpy.log10(self.dataOut.data_spc[2,:]))
2420 col5=self.wrObj.writeData(name="P_Ch4",format=str(self.dataOut.nFFTPoints)+'E',data=10*numpy.log10(self.dataOut.data_spc[3,:]))
2421 col6=self.wrObj.writeData(name="P_Ch5",format=str(self.dataOut.nFFTPoints)+'E',data=10*numpy.log10(self.dataOut.data_spc[4,:]))
2422 col7=self.wrObj.writeData(name="P_Ch6",format=str(self.dataOut.nFFTPoints)+'E',data=10*numpy.log10(self.dataOut.data_spc[5,:]))
2423 col8=self.wrObj.writeData(name="P_Ch7",format=str(self.dataOut.nFFTPoints)+'E',data=10*numpy.log10(self.dataOut.data_spc[6,:]))
2424 col9=self.wrObj.writeData(name="P_Ch8",format=str(self.dataOut.nFFTPoints)+'E',data=10*numpy.log10(self.dataOut.data_spc[7,:]))
2425 2425 #n=numpy.arange((100))
2426 n=self.dataOutObj.data_spc[6,:]
2426 n=self.dataOut.data_spc[6,:]
2427 2427 a=self.wrObj.cFImage(n)
2428 2428 b=self.wrObj.Ctable(col1,col2,col3,col4,col5,col6,col7,col8,col9)
2429 2429 self.wrObj.CFile(a,b)
@@ -51,7 +51,7 class ProcessingUnit:
51 51 objId : identificador del objeto, necesario para ejecutar la operacion
52 52 """
53 53
54 self.object[objId] = object
54 self.objectDict[objId] = object
55 55
56 56 return objId
57 57
@@ -147,10 +147,10 class Operation():
147 147
148 148 """
149 149 Clase base para definir las operaciones adicionales que se pueden agregar a la clase ProcessingUnit
150 y necesiten acumular información previa de los datos a procesar. De preferencia usar un buffer de
150 y necesiten acumular informacion previa de los datos a procesar. De preferencia usar un buffer de
151 151 acumulacion dentro de esta clase
152 152
153 Ejemplo: Integraciones coherentes, necesita la información previa de los n perfiles anteriores (bufffer)
153 Ejemplo: Integraciones coherentes, necesita la informacion previa de los n perfiles anteriores (bufffer)
154 154
155 155 """
156 156
@@ -185,32 +185,32 class VoltageProc(ProcessingUnit):
185 185
186 186
187 187 def __init__(self):
188
188 self.objectDict = {}
189 189 pass
190 190
191 def setup(self, dataInObj=None, dataOutObj=None):
191 def setup(self, dataIn=None, dataOut=None):
192 192
193 self.dataInObj = dataInObj
193 self.dataIn = dataIn
194 194
195 if self.dataOutObj == None:
196 dataOutObj = Voltage()
195 if self.dataOut == None:
196 dataOut = Voltage()
197 197
198 self.dataOutObj = dataOutObj
198 self.dataOut = dataOut
199 199
200 return self.dataOutObj
200 return self.dataOut
201 201
202 202 def init(self):
203 203
204 if self.dataInObj.isEmpty():
204 if self.dataIn.isEmpty():
205 205 return 0
206 206
207 self.dataOutObj.copy(self.dataInObj)
208 # No necesita copiar en cada init() los atributos de dataInObj
207 self.dataOut.copy(self.dataIn)
208 # No necesita copiar en cada init() los atributos de dataIn
209 209 # la copia deberia hacerse por cada nuevo bloque de datos
210 210
211 211 def selectChannels(self, channelList):
212 212
213 if self.dataInObj.isEmpty():
213 if self.dataIn.isEmpty():
214 214 return 0
215 215
216 216 self.selectChannelsByIndex(channelList)
@@ -223,29 +223,29 class VoltageProc(ProcessingUnit):
223 223 channelIndexList : lista sencilla de canales a seleccionar por ej. [2,3,7]
224 224
225 225 Affected:
226 self.dataOutObj.data
227 self.dataOutObj.channelIndexList
228 self.dataOutObj.nChannels
229 self.dataOutObj.m_ProcessingHeader.totalSpectra
230 self.dataOutObj.systemHeaderObj.numChannels
231 self.dataOutObj.m_ProcessingHeader.blockSize
226 self.dataOut.data
227 self.dataOut.channelIndexList
228 self.dataOut.nChannels
229 self.dataOut.m_ProcessingHeader.totalSpectra
230 self.dataOut.systemHeaderObj.numChannels
231 self.dataOut.m_ProcessingHeader.blockSize
232 232
233 233 Return:
234 234 None
235 235 """
236 236
237 237 for channel in channelIndexList:
238 if channel not in self.dataOutObj.channelIndexList:
238 if channel not in self.dataOut.channelIndexList:
239 239 raise ValueError, "The value %d in channelIndexList is not valid" %channel
240 240
241 241 nChannels = len(channelIndexList)
242 242
243 data = self.dataOutObj.data[channelIndexList,:]
243 data = self.dataOut.data[channelIndexList,:]
244 244
245 self.dataOutObj.data = data
246 self.dataOutObj.channelIndexList = channelIndexList
247 self.dataOutObj.channelList = [self.dataOutObj.channelList[i] for i in channelIndexList]
248 self.dataOutObj.nChannels = nChannels
245 self.dataOut.data = data
246 self.dataOut.channelIndexList = channelIndexList
247 self.dataOut.channelList = [self.dataOut.channelList[i] for i in channelIndexList]
248 self.dataOut.nChannels = nChannels
249 249
250 250 return 1
251 251
@@ -433,12 +433,12 class CohInt(Operation):
433 433
434 434 avgdata, avgdatatime = self.integrate(dataOut.data, dataOut.utctime)
435 435
436 # self.dataOutObj.timeInterval *= nCohInt
437 self.dataOutObj.flagNoData = True
436 # self.dataOut.timeInterval *= nCohInt
437 self.dataOut.flagNoData = True
438 438
439 439 if self.__dataReady:
440 dataOutObj.data = avgdata
441 dataOutObj.timeInterval *= self.nCohInt
442 dataOutObj.nCohInt *= self.nCohInt
443 dataOutObj.utctime = avgdatatime
444 dataOutObj.flagNoData = False No newline at end of file
440 dataOut.data = avgdata
441 dataOut.timeInterval *= self.nCohInt
442 dataOut.nCohInt *= self.nCohInt
443 dataOut.utctime = avgdatatime
444 dataOut.flagNoData = False No newline at end of file
General Comments 0
You need to be logged in to leave comments. Login now