@@ -653,7 +653,7 class AMISR: | |||
|
653 | 653 | self.type = "AMISR" |
|
654 | 654 | |
|
655 | 655 | #propiedades para compatibilidad con Voltages |
|
656 |
self.timeZone = |
|
|
656 | self.timeZone = 0#timezone like jroheader, difference in minutes between UTC and localtime | |
|
657 | 657 | self.dstFlag = 0#self.dataIn.dstFlag |
|
658 | 658 | self.errorCount = 0#self.dataIn.errorCount |
|
659 | 659 | self.useLocalTime = True#self.dataIn.useLocalTime |
@@ -684,6 +684,18 class AMISR: | |||
|
684 | 684 | self.nCode = None#self.dataIn.nCode |
|
685 | 685 | self.code = None#self.dataIn.code |
|
686 | 686 | |
|
687 | #consideracion para los Beams | |
|
688 | self.beamCodeDict = None | |
|
689 | self.beamRangeDict = None | |
|
690 | ||
|
691 | def copy(self, inputObj=None): | |
|
692 | ||
|
693 | if inputObj == None: | |
|
694 | return copy.deepcopy(self) | |
|
695 | ||
|
696 | for key in inputObj.__dict__.keys(): | |
|
697 | self.__dict__[key] = inputObj.__dict__[key] | |
|
698 | ||
|
687 | 699 | |
|
688 | 700 | def isEmpty(self): |
|
689 | 701 |
@@ -3425,7 +3425,8 class FitsReader(ProcessingUnit): | |||
|
3425 | 3425 | class RadacHeader(): |
|
3426 | 3426 | def __init__(self, fp): |
|
3427 | 3427 | header = 'Raw11/Data/RadacHeader' |
|
3428 | self.beamCode = fp.get(header+'/BeamCode') | |
|
3428 | self.beamCodeByPulse = fp.get(header+'/BeamCode') | |
|
3429 | self.beamCode = fp.get('Raw11/Data/Beamcodes') | |
|
3429 | 3430 | self.code = fp.get(header+'/Code') |
|
3430 | 3431 | self.frameCount = fp.get(header+'/FrameCount') |
|
3431 | 3432 | self.modeGroup = fp.get(header+'/ModeGroup') |
@@ -3438,6 +3439,7 class RadacHeader(): | |||
|
3438 | 3439 | self.nrecords = self.pulseCount.shape[0] #numero de bloques |
|
3439 | 3440 | self.npulses = self.pulseCount.shape[1] #numero de perfiles |
|
3440 | 3441 | self.nsamples = self.nsamplesPulse[0,0] #numero de alturas |
|
3442 | self.nbeams = self.beamCode.shape[1] #numero de beams | |
|
3441 | 3443 | |
|
3442 | 3444 | |
|
3443 | 3445 | def getIndexRangeToPulse(self, idrecord=0): |
@@ -3492,6 +3494,9 class AMISRReader(ProcessingUnit): | |||
|
3492 | 3494 | self.dataByFrame = None |
|
3493 | 3495 | self.dataset = None |
|
3494 | 3496 | |
|
3497 | self.beamCodeDict = {} | |
|
3498 | self.beamRangeDict = {} | |
|
3499 | ||
|
3495 | 3500 | |
|
3496 | 3501 | def __createObjByDefault(self): |
|
3497 | 3502 | |
@@ -3631,7 +3636,22 class AMISRReader(ProcessingUnit): | |||
|
3631 | 3636 | def __readHeader(self): |
|
3632 | 3637 | self.radacHeaderObj = RadacHeader(self.amisrFilePointer) |
|
3633 | 3638 | self.flagIsNewFile = 1 |
|
3639 | ||
|
3640 | def __getBeamCode(self): | |
|
3641 | self.beamCodeDict = {} | |
|
3642 | self.beamRangeDict = {} | |
|
3643 | ||
|
3644 | for i in range(len(self.radacHeaderObj.beamCode[0,:])): | |
|
3645 | self.beamCodeDict.setdefault(i) | |
|
3646 | self.beamRangeDict.setdefault(i) | |
|
3647 | self.beamCodeDict[i] = self.radacHeaderObj.beamCode[0,i] | |
|
3648 | ||
|
3634 | 3649 | |
|
3650 | just4record0 = self.radacHeaderObj.beamCodeByPulse[0,:] | |
|
3651 | ||
|
3652 | for i in range(len(self.beamCodeDict.values())): | |
|
3653 | xx = numpy.where(just4record0==self.beamCodeDict.values()[i]) | |
|
3654 | self.beamRangeDict[i] = xx[0] | |
|
3635 | 3655 | |
|
3636 | 3656 | |
|
3637 | 3657 | def __setNextFile(self): |
@@ -3642,7 +3662,7 class AMISRReader(ProcessingUnit): | |||
|
3642 | 3662 | return 0 |
|
3643 | 3663 | |
|
3644 | 3664 | self.__readHeader() |
|
3645 | ||
|
3665 | self.__getBeamCode() | |
|
3646 | 3666 | self.readDataBlock() |
|
3647 | 3667 | |
|
3648 | 3668 | |
@@ -3791,6 +3811,10 class AMISRReader(ProcessingUnit): | |||
|
3791 | 3811 | return 1 |
|
3792 | 3812 | return 0 |
|
3793 | 3813 | |
|
3814 | def printUTC(self): | |
|
3815 | print self.dataOut.utctime | |
|
3816 | print '' | |
|
3817 | ||
|
3794 | 3818 | def setObjProperties(self): |
|
3795 | 3819 | self.dataOut.heightList = self.rangeFromFile/1000.0 #km |
|
3796 | 3820 | self.dataOut.nProfiles = self.radacHeaderObj.npulses |
@@ -3798,6 +3822,9 class AMISRReader(ProcessingUnit): | |||
|
3798 | 3822 | self.dataOut.nBaud = None |
|
3799 | 3823 | self.dataOut.nCode = None |
|
3800 | 3824 | self.dataOut.code = None |
|
3825 | ||
|
3826 | self.dataOut.beamCodeDict = self.beamCodeDict | |
|
3827 | self.dataOut.beamRangeDict = self.beamRangeDict | |
|
3801 | 3828 | |
|
3802 | 3829 | def getData(self): |
|
3803 | 3830 |
@@ -1707,7 +1707,7 class ProfileSelector(Operation): | |||
|
1707 | 1707 | |
|
1708 | 1708 | return True |
|
1709 | 1709 | |
|
1710 | def run(self, dataOut, profileList=None, profileRangeList=None): | |
|
1710 | def run(self, dataOut, profileList=None, profileRangeList=None, beam=None): | |
|
1711 | 1711 | |
|
1712 | 1712 | dataOut.flagNoData = True |
|
1713 | 1713 | self.nProfiles = dataOut.nProfiles |
@@ -1728,6 +1728,12 class ProfileSelector(Operation): | |||
|
1728 | 1728 | |
|
1729 | 1729 | self.incIndex() |
|
1730 | 1730 | return 1 |
|
1731 | elif beam != None: | |
|
1732 | if self.isProfileInList(dataOut.beamRangeDict[beam]): | |
|
1733 | dataOut.flagNoData = False | |
|
1734 | ||
|
1735 | self.incIndex() | |
|
1736 | return 1 | |
|
1731 | 1737 | |
|
1732 | 1738 | else: |
|
1733 | 1739 | raise ValueError, "ProfileSelector needs profileList or profileRangeList" |
@@ -2067,4 +2073,60 class IncohInt4SpectraHeis(Operation): | |||
|
2067 | 2073 | |
|
2068 | 2074 | |
|
2069 | 2075 | |
|
2070 | No newline at end of file | |
|
2076 | class AMISRProc(ProcessingUnit): | |
|
2077 | def __init__(self): | |
|
2078 | self.objectDict = {} | |
|
2079 | self.dataOut = AMISR() | |
|
2080 | ||
|
2081 | def init(self): | |
|
2082 | if self.dataIn.type == 'AMISR': | |
|
2083 | self.dataOut.copy(self.dataIn) | |
|
2084 | ||
|
2085 | class BeamSelector(Operation): | |
|
2086 | profileIndex = None | |
|
2087 | # Tamanho total de los perfiles | |
|
2088 | nProfiles = None | |
|
2089 | ||
|
2090 | def __init__(self): | |
|
2091 | ||
|
2092 | self.profileIndex = 0 | |
|
2093 | ||
|
2094 | def incIndex(self): | |
|
2095 | self.profileIndex += 1 | |
|
2096 | ||
|
2097 | if self.profileIndex >= self.nProfiles: | |
|
2098 | self.profileIndex = 0 | |
|
2099 | ||
|
2100 | def isProfileInRange(self, minIndex, maxIndex): | |
|
2101 | ||
|
2102 | if self.profileIndex < minIndex: | |
|
2103 | return False | |
|
2104 | ||
|
2105 | if self.profileIndex > maxIndex: | |
|
2106 | return False | |
|
2107 | ||
|
2108 | return True | |
|
2109 | ||
|
2110 | def isProfileInList(self, profileList): | |
|
2111 | ||
|
2112 | if self.profileIndex not in profileList: | |
|
2113 | return False | |
|
2114 | ||
|
2115 | return True | |
|
2116 | ||
|
2117 | def run(self, dataOut, beam=None): | |
|
2118 | ||
|
2119 | dataOut.flagNoData = True | |
|
2120 | self.nProfiles = dataOut.nProfiles | |
|
2121 | ||
|
2122 | if beam != None: | |
|
2123 | if self.isProfileInList(dataOut.beamRangeDict[beam]): | |
|
2124 | dataOut.flagNoData = False | |
|
2125 | ||
|
2126 | self.incIndex() | |
|
2127 | return 1 | |
|
2128 | ||
|
2129 | else: | |
|
2130 | raise ValueError, "BeamSelector needs beam value" | |
|
2131 | ||
|
2132 | return 0 No newline at end of file |
General Comments 0
You need to be logged in to leave comments.
Login now