@@ -2,6 +2,7 import numpy | |||||
2 |
|
2 | |||
3 | from jroproc_base import ProcessingUnit, Operation |
|
3 | from jroproc_base import ProcessingUnit, Operation | |
4 | from model.data.jrodata import Voltage |
|
4 | from model.data.jrodata import Voltage | |
|
5 | from Carbon.Fonts import times | |||
5 |
|
6 | |||
6 | class VoltageProc(ProcessingUnit): |
|
7 | class VoltageProc(ProcessingUnit): | |
7 |
|
8 | |||
@@ -97,8 +98,13 class VoltageProc(ProcessingUnit): | |||||
97 | raise ValueError, "The value %d in channelIndexList is not valid" %channelIndex |
|
98 | raise ValueError, "The value %d in channelIndexList is not valid" %channelIndex | |
98 |
|
99 | |||
99 | # nChannels = len(channelIndexList) |
|
100 | # nChannels = len(channelIndexList) | |
100 |
|
101 | if dataOut.flagDataAsBlock: | ||
101 | data = self.dataOut.data[channelIndexList,:] |
|
102 | """ | |
|
103 | Si la data es obtenida por bloques, dimension = [nChannels, nProfiles, nHeis] | |||
|
104 | """ | |||
|
105 | data = self.dataOut.data[channelIndexList,:,:] | |||
|
106 | else: | |||
|
107 | data = self.dataOut.data[channelIndexList,:] | |||
102 |
|
108 | |||
103 | self.dataOut.data = data |
|
109 | self.dataOut.data = data | |
104 | self.dataOut.channelList = [self.dataOut.channelList[i] for i in channelIndexList] |
|
110 | self.dataOut.channelList = [self.dataOut.channelList[i] for i in channelIndexList] | |
@@ -185,7 +191,13 class VoltageProc(ProcessingUnit): | |||||
185 | # nHeights = maxIndex - minIndex + 1 |
|
191 | # nHeights = maxIndex - minIndex + 1 | |
186 |
|
192 | |||
187 | #voltage |
|
193 | #voltage | |
188 | data = self.dataOut.data[:,minIndex:maxIndex+1] |
|
194 | if dataOut.flagDataAsBlock: | |
|
195 | """ | |||
|
196 | Si la data es obtenida por bloques, dimension = [nChannels, nProfiles, nHeis] | |||
|
197 | """ | |||
|
198 | data = self.dataOut.data[:,minIndex:maxIndex+1,:] | |||
|
199 | else: | |||
|
200 | data = self.dataOut.data[:,minIndex:maxIndex+1] | |||
189 |
|
201 | |||
190 | # firstHeight = self.dataOut.heightList[minIndex] |
|
202 | # firstHeight = self.dataOut.heightList[minIndex] | |
191 |
|
203 | |||
@@ -196,37 +208,69 class VoltageProc(ProcessingUnit): | |||||
196 |
|
208 | |||
197 |
|
209 | |||
198 | def filterByHeights(self, window, axis=1): |
|
210 | def filterByHeights(self, window, axis=1): | |
|
211 | ||||
199 | deltaHeight = self.dataOut.heightList[1] - self.dataOut.heightList[0] |
|
212 | deltaHeight = self.dataOut.heightList[1] - self.dataOut.heightList[0] | |
200 |
|
213 | |||
201 | if window == None: |
|
214 | if window == None: | |
202 | window = (self.dataOut.radarControllerHeaderObj.txA/self.dataOut.radarControllerHeaderObj.nBaud) / deltaHeight |
|
215 | window = (self.dataOut.radarControllerHeaderObj.txA/self.dataOut.radarControllerHeaderObj.nBaud) / deltaHeight | |
203 |
|
216 | |||
204 | newdelta = deltaHeight * window |
|
217 | newdelta = deltaHeight * window | |
205 |
r = self.dataOut. |
|
218 | r = self.dataOut.nHeights % window | |
206 | if axis == 1: |
|
|||
207 | buffer = self.dataOut.data[:,0:self.dataOut.data.shape[axis]-r] |
|
|||
208 | buffer = buffer.reshape(self.dataOut.data.shape[0],self.dataOut.data.shape[axis]/window,window) |
|
|||
209 | buffer = numpy.sum(buffer,axis+1) |
|
|||
210 |
|
||||
211 | elif axis == 2: |
|
|||
212 | buffer = self.dataOut.data[:, :, 0:self.dataOut.data.shape[axis]-r] |
|
|||
213 | buffer = buffer.reshape(self.dataOut.data.shape[0],self.dataOut.data.shape[1],self.dataOut.data.shape[axis]/window,window) |
|
|||
214 | buffer = numpy.sum(buffer,axis+1) |
|
|||
215 |
|
219 | |||
216 | else: |
|
220 | if dataOut.flagDataAsBlock: | |
217 | raise ValueError, "axis value should be 1 or 2, the input value %d is not valid" % (axis) |
|
221 | """ | |
|
222 | Si la data es obtenida por bloques, dimension = [nChannels, nProfiles, nHeis] | |||
|
223 | """ | |||
|
224 | buffer = self.dataOut.data[:, :, 0:self.dataOut.nHeights-r] | |||
|
225 | buffer = buffer.reshape(self.dataOut.nChannels,self.dataOut.nHeights,self.dataOut.nHeights/window,window) | |||
|
226 | buffer = numpy.sum(buffer,3) | |||
218 |
|
227 | |||
|
228 | else: | |||
|
229 | buffer = self.dataOut.data[:,0:self.dataOut.nHeights-r] | |||
|
230 | buffer = buffer.reshape(self.dataOut.nChannels,self.dataOut.nHeights/window,window) | |||
|
231 | buffer = numpy.sum(buffer,2) | |||
|
232 | ||||
219 | self.dataOut.data = buffer.copy() |
|
233 | self.dataOut.data = buffer.copy() | |
220 | self.dataOut.heightList = numpy.arange(self.dataOut.heightList[0],newdelta*(self.dataOut.nHeights-r)/window,newdelta) |
|
234 | self.dataOut.heightList = numpy.arange(self.dataOut.heightList[0],newdelta*(self.dataOut.nHeights-r)/window,newdelta) | |
221 | self.dataOut.windowOfFilter = window |
|
235 | self.dataOut.windowOfFilter = window | |
222 |
|
236 | |||
223 | return 1 |
|
237 | return 1 | |
224 |
|
238 | |||
225 | def deFlip(self): |
|
239 | def deFlip(self, channelList = []): | |
226 | self.dataOut.data *= self.flip |
|
240 | ||
227 | self.flip *= -1. |
|
241 | data = self.dataOut.data.copy() | |
|
242 | ||||
|
243 | if self.dataOut.flagDataAsBlock: | |||
|
244 | flip = self.flip | |||
|
245 | profileList = range(self.dataOut.nProfiles) | |||
|
246 | ||||
|
247 | if channelList == []: | |||
|
248 | for thisProfile in profileList: | |||
|
249 | data[:,thisProfile,:] = data[:,thisProfile,:]*flip | |||
|
250 | flip *= -1.0 | |||
|
251 | else: | |||
|
252 | for thisChannel in channelList: | |||
|
253 | for thisProfile in profileList: | |||
|
254 | data[thisChannel,thisProfile,:] = data[thisChannel,thisProfile,:]*flip | |||
|
255 | flip *= -1.0 | |||
|
256 | ||||
|
257 | self.flip = flip | |||
|
258 | ||||
|
259 | else: | |||
|
260 | if channelList == []: | |||
|
261 | data[:,:] = data[:,:]*self.flip | |||
|
262 | else: | |||
|
263 | for thisChannel in channelList: | |||
|
264 | data[thisChannel,:] = data[thisChannel,:]*self.flip | |||
|
265 | ||||
|
266 | self.flip *= -1. | |||
|
267 | ||||
|
268 | self.dataOut.data = data | |||
|
269 | ||||
|
270 | ||||
228 |
|
271 | |||
229 | def setRadarFrequency(self, frequency=None): |
|
272 | def setRadarFrequency(self, frequency=None): | |
|
273 | ||||
230 | if frequency != None: |
|
274 | if frequency != None: | |
231 | self.dataOut.frequency = frequency |
|
275 | self.dataOut.frequency = frequency | |
232 |
|
276 | |||
@@ -413,6 +457,7 class CohInt(Operation): | |||||
413 | return avgdata, avgdatatime |
|
457 | return avgdata, avgdatatime | |
414 |
|
458 | |||
415 | def integrateByBlock(self, dataOut): |
|
459 | def integrateByBlock(self, dataOut): | |
|
460 | ||||
416 | times = int(dataOut.data.shape[1]/self.n) |
|
461 | times = int(dataOut.data.shape[1]/self.n) | |
417 | avgdata = numpy.zeros((dataOut.nChannels, times, dataOut.nHeights), dtype=numpy.complex) |
|
462 | avgdata = numpy.zeros((dataOut.nChannels, times, dataOut.nHeights), dtype=numpy.complex) | |
418 |
|
463 | |||
@@ -436,7 +481,10 class CohInt(Operation): | |||||
436 | self.setup(**kwargs) |
|
481 | self.setup(**kwargs) | |
437 | self.isConfig = True |
|
482 | self.isConfig = True | |
438 |
|
483 | |||
439 | if self.byblock: |
|
484 | if dataOut.flagDataAsBlock: | |
|
485 | """ | |||
|
486 | Si la data es leida por bloques, dimension = [nChannels, nProfiles, nHeis] | |||
|
487 | """ | |||
440 | avgdata, avgdatatime = self.integrateByBlock(dataOut) |
|
488 | avgdata, avgdatatime = self.integrateByBlock(dataOut) | |
441 | else: |
|
489 | else: | |
442 | avgdata, avgdatatime = self.integrate(dataOut.data, dataOut.utctime) |
|
490 | avgdata, avgdatatime = self.integrate(dataOut.data, dataOut.utctime) | |
@@ -448,7 +496,7 class CohInt(Operation): | |||||
448 | dataOut.data = avgdata |
|
496 | dataOut.data = avgdata | |
449 | dataOut.nCohInt *= self.n |
|
497 | dataOut.nCohInt *= self.n | |
450 | dataOut.utctime = avgdatatime |
|
498 | dataOut.utctime = avgdatatime | |
451 | dataOut.timeInterval = dataOut.ippSeconds * dataOut.nCohInt |
|
499 | # dataOut.timeInterval = dataOut.ippSeconds * dataOut.nCohInt | |
452 | dataOut.flagNoData = False |
|
500 | dataOut.flagNoData = False | |
453 |
|
501 | |||
454 | class Decoder(Operation): |
|
502 | class Decoder(Operation): | |
@@ -468,10 +516,10 class Decoder(Operation): | |||||
468 |
|
516 | |||
469 | self.times = None |
|
517 | self.times = None | |
470 | self.osamp = None |
|
518 | self.osamp = None | |
471 | self.__setValues = False |
|
519 | # self.__setValues = False | |
472 |
|
|
520 | self.isConfig = False | |
473 |
|
521 | |||
474 |
def setup(self, code, s |
|
522 | def setup(self, code, osamp, dataOut): | |
475 |
|
523 | |||
476 | self.__profIndex = 0 |
|
524 | self.__profIndex = 0 | |
477 |
|
525 | |||
@@ -480,17 +528,23 class Decoder(Operation): | |||||
480 | self.nCode = len(code) |
|
528 | self.nCode = len(code) | |
481 | self.nBaud = len(code[0]) |
|
529 | self.nBaud = len(code[0]) | |
482 |
|
530 | |||
483 |
if |
|
531 | if (osamp != None) and (osamp >1): | |
484 | self.times = times |
|
|||
485 |
|
||||
486 | if ((osamp != None) and (osamp >1)): |
|
|||
487 | self.osamp = osamp |
|
532 | self.osamp = osamp | |
488 | self.code = numpy.repeat(code, repeats=self.osamp,axis=1) |
|
533 | self.code = numpy.repeat(code, repeats=self.osamp, axis=1) | |
489 | self.nBaud = self.nBaud*self.osamp |
|
534 | self.nBaud = self.nBaud*self.osamp | |
490 |
|
535 | |||
491 | if len(shape) == 2: |
|
536 | self.__nChannels = dataOut.nChannels | |
492 | self.__nChannels, self.__nHeis = shape |
|
537 | self.__nProfiles = dataOut.nProfiles | |
|
538 | self.__nHeis = dataOut.nHeights | |||
|
539 | ||||
|
540 | if dataOut.flagDataAsBlock: | |||
493 |
|
541 | |||
|
542 | self.ndatadec = self.__nHeis - self.nBaud + 1 | |||
|
543 | ||||
|
544 | self.datadecTime = numpy.zeros((self.__nChannels, self.__nProfiles, self.ndatadec), dtype=numpy.complex) | |||
|
545 | ||||
|
546 | else: | |||
|
547 | ||||
494 | __codeBuffer = numpy.zeros((self.nCode, self.__nHeis), dtype=numpy.complex) |
|
548 | __codeBuffer = numpy.zeros((self.nCode, self.__nHeis), dtype=numpy.complex) | |
495 |
|
549 | |||
496 | __codeBuffer[:,0:self.nBaud] = self.code |
|
550 | __codeBuffer[:,0:self.nBaud] = self.code | |
@@ -499,16 +553,8 class Decoder(Operation): | |||||
499 |
|
553 | |||
500 | self.ndatadec = self.__nHeis - self.nBaud + 1 |
|
554 | self.ndatadec = self.__nHeis - self.nBaud + 1 | |
501 |
|
555 | |||
502 | self.datadecTime = numpy.zeros((self.__nChannels, self.ndatadec), dtype=numpy.complex) |
|
556 | self.datadecTime = numpy.zeros((self.__nChannels, self.ndatadec), dtype=numpy.complex) | |
503 | else: |
|
|||
504 | self.__nChannels, self.__nProfiles, self.__nHeis = shape |
|
|||
505 |
|
||||
506 | self.ndatadec = self.__nHeis - self.nBaud + 1 |
|
|||
507 |
|
||||
508 | self.datadecTime = numpy.zeros((self.__nChannels, self.__nProfiles, self.ndatadec), dtype=numpy.complex) |
|
|||
509 |
|
||||
510 |
|
557 | |||
511 |
|
||||
512 | def convolutionInFreq(self, data): |
|
558 | def convolutionInFreq(self, data): | |
513 |
|
559 | |||
514 | fft_code = self.fft_code[self.__profIndex].reshape(1,-1) |
|
560 | fft_code = self.fft_code[self.__profIndex].reshape(1,-1) | |
@@ -543,9 +589,12 class Decoder(Operation): | |||||
543 | return self.datadecTime |
|
589 | return self.datadecTime | |
544 |
|
590 | |||
545 | def convolutionByBlockInTime(self, data): |
|
591 | def convolutionByBlockInTime(self, data): | |
546 | junk = numpy.lib.stride_tricks.as_strided(self.code, (self.times, self.code.size), (0, self.code.itemsize)) |
|
592 | ||
|
593 | repetitions = self.__nProfiles / self.nCode | |||
|
594 | ||||
|
595 | junk = numpy.lib.stride_tricks.as_strided(self.code, (repetitions, self.code.size), (0, self.code.itemsize)) | |||
547 | junk = junk.flatten() |
|
596 | junk = junk.flatten() | |
548 |
code_block = numpy.reshape(junk, (self.nCode* |
|
597 | code_block = numpy.reshape(junk, (self.nCode*repetitions, self.nBaud)) | |
549 |
|
598 | |||
550 | for i in range(self.__nChannels): |
|
599 | for i in range(self.__nChannels): | |
551 | for j in range(self.__nProfiles): |
|
600 | for j in range(self.__nProfiles): | |
@@ -554,53 +603,49 class Decoder(Operation): | |||||
554 | return self.datadecTime |
|
603 | return self.datadecTime | |
555 |
|
604 | |||
556 | def run(self, dataOut, code=None, nCode=None, nBaud=None, mode = 0, times=None, osamp=None): |
|
605 | def run(self, dataOut, code=None, nCode=None, nBaud=None, mode = 0, times=None, osamp=None): | |
557 |
|
||||
558 | if code == None: |
|
|||
559 | code = dataOut.code |
|
|||
560 | else: |
|
|||
561 | code = numpy.array(code).reshape(nCode,nBaud) |
|
|||
562 |
|
||||
563 |
|
606 | |||
564 |
|
||||
565 | if not self.isConfig: |
|
607 | if not self.isConfig: | |
566 |
|
608 | |||
567 | self.setup(code, dataOut.data.shape, times, osamp) |
|
609 | if code == None: | |
|
610 | code = dataOut.code | |||
|
611 | else: | |||
|
612 | code = numpy.array(code).reshape(nCode,nBaud) | |||
568 |
|
613 | |||
569 | dataOut.code = code |
|
614 | self.setup(code, osamp, dataOut) | |
570 | dataOut.nCode = nCode |
|
|||
571 | dataOut.nBaud = nBaud |
|
|||
572 | dataOut.radarControllerHeaderObj.code = code |
|
|||
573 | dataOut.radarControllerHeaderObj.nCode = nCode |
|
|||
574 | dataOut.radarControllerHeaderObj.nBaud = nBaud |
|
|||
575 |
|
615 | |||
576 | self.isConfig = True |
|
616 | self.isConfig = True | |
|
617 | ||||
|
618 | if dataOut.flagDataAsBlock: | |||
|
619 | """ | |||
|
620 | Decoding when data have been read as block, | |||
|
621 | """ | |||
|
622 | datadec = self.convolutionByBlockInTime(dataOut.data) | |||
577 |
|
623 | |||
578 | if mode == 0: |
|
624 | else: | |
579 | datadec = self.convolutionInTime(dataOut.data) |
|
625 | """ | |
580 |
|
626 | Decoding when data have been read profile by profile | ||
581 |
|
|
627 | """ | |
582 | datadec = self.convolutionInFreq(dataOut.data) |
|
628 | if mode == 0: | |
583 |
|
629 | datadec = self.convolutionInTime(dataOut.data) | ||
584 | if mode == 2: |
|
630 | ||
585 | datadec = self.convolutionInFreqOpt(dataOut.data) |
|
631 | if mode == 1: | |
|
632 | datadec = self.convolutionInFreq(dataOut.data) | |||
586 |
|
633 | |||
587 |
if mode == |
|
634 | if mode == 2: | |
588 |
datadec = self.convolution |
|
635 | datadec = self.convolutionInFreqOpt(dataOut.data) | |
589 |
|
636 | |||
590 | if not(self.__setValues): |
|
637 | dataOut.code = code | |
591 |
|
|
638 | dataOut.nCode = nCode | |
592 |
|
|
639 | dataOut.nBaud = nBaud | |
593 | dataOut.nBaud = self.nBaud |
|
640 | dataOut.radarControllerHeaderObj.code = code | |
594 |
|
|
641 | dataOut.radarControllerHeaderObj.nCode = nCode | |
595 |
|
|
642 | dataOut.radarControllerHeaderObj.nBaud = nBaud | |
596 | dataOut.radarControllerHeaderObj.nBaud = self.nBaud |
|
|||
597 | #self.__setValues = True |
|
|||
598 |
|
643 | |||
599 | dataOut.data = datadec |
|
644 | dataOut.data = datadec | |
600 |
|
645 | |||
601 | dataOut.heightList = dataOut.heightList[0:self.ndatadec] |
|
646 | dataOut.heightList = dataOut.heightList[0:self.ndatadec] | |
602 |
|
647 | |||
603 |
dataOut.flagDecodeData = True #asumo q la data |
|
648 | dataOut.flagDecodeData = True #asumo q la data esta decodificada | |
604 |
|
649 | |||
605 | if self.__profIndex == self.nCode-1: |
|
650 | if self.__profIndex == self.nCode-1: | |
606 | self.__profIndex = 0 |
|
651 | self.__profIndex = 0 | |
@@ -645,17 +690,22 class ProfileConcat(Operation): | |||||
645 | if not self.isConfig: |
|
690 | if not self.isConfig: | |
646 | self.setup(dataOut.data, m, 1) |
|
691 | self.setup(dataOut.data, m, 1) | |
647 | self.isConfig = True |
|
692 | self.isConfig = True | |
|
693 | ||||
|
694 | if dataOut.flagDataAsBlock: | |||
|
695 | ||||
|
696 | raise ValueError, "ProfileConcat can only be used when voltage have been read profile by profiel, getBlock = False" | |||
648 |
|
697 | |||
649 | self.concat(dataOut.data) |
|
698 | else: | |
650 | self.times += 1 |
|
699 | self.concat(dataOut.data) | |
651 |
|
|
700 | self.times += 1 | |
652 | dataOut.data = self.buffer |
|
701 | if self.times > m: | |
653 | self.reset() |
|
702 | dataOut.data = self.buffer | |
654 | dataOut.flagNoData = False |
|
703 | self.reset() | |
655 | # se deben actualizar mas propiedades del header y del objeto dataOut, por ejemplo, las alturas |
|
704 | dataOut.flagNoData = False | |
656 | deltaHeight = dataOut.heightList[1] - dataOut.heightList[0] |
|
705 | # se deben actualizar mas propiedades del header y del objeto dataOut, por ejemplo, las alturas | |
657 | xf = dataOut.heightList[0] + dataOut.nHeights * deltaHeight * 5 |
|
706 | deltaHeight = dataOut.heightList[1] - dataOut.heightList[0] | |
658 |
|
|
707 | xf = dataOut.heightList[0] + dataOut.nHeights * deltaHeight * 5 | |
|
708 | dataOut.heightList = numpy.arange(dataOut.heightList[0], xf, deltaHeight) | |||
659 |
|
709 | |||
660 | class ProfileSelector(Operation): |
|
710 | class ProfileSelector(Operation): | |
661 |
|
711 | |||
@@ -692,48 +742,66 class ProfileSelector(Operation): | |||||
692 | return True |
|
742 | return True | |
693 |
|
743 | |||
694 | def run(self, dataOut, profileList=None, profileRangeList=None, beam=None, byblock=False): |
|
744 | def run(self, dataOut, profileList=None, profileRangeList=None, beam=None, byblock=False): | |
|
745 | ||||
|
746 | """ | |||
|
747 | ProfileSelector: | |||
695 |
|
|
748 | ||
|
749 | """ | |||
|
750 | ||||
696 | dataOut.flagNoData = True |
|
751 | dataOut.flagNoData = True | |
697 | self.nProfiles = dataOut.nProfiles |
|
752 | self.nProfiles = dataOut.nProfiles | |
698 |
|
753 | |||
699 | if byblock: |
|
754 | if dataOut.flagDataAsBlock: | |
700 |
|
755 | """ | ||
|
756 | data dimension = [nChannels, nProfiles, nHeis] | |||
|
757 | """ | |||
701 | if profileList != None: |
|
758 | if profileList != None: | |
702 | dataOut.data = dataOut.data[:,profileList,:] |
|
759 | dataOut.data = dataOut.data[:,profileList,:] | |
703 | pass |
|
760 | dataOut.nProfiles = len(profileList) | |
704 | else: |
|
761 | else: | |
705 | pmin = profileRangeList[0] |
|
762 | pmin = profileRangeList[0] | |
706 | pmax = profileRangeList[1] |
|
763 | pmax = profileRangeList[1] | |
707 | dataOut.data = dataOut.data[:,pmin:pmax+1,:] |
|
764 | dataOut.data = dataOut.data[:,pmin:pmax+1,:] | |
|
765 | dataOut.nProfiles = pmax - pmin + 1 | |||
|
766 | ||||
|
767 | ||||
708 | dataOut.flagNoData = False |
|
768 | dataOut.flagNoData = False | |
709 | self.profileIndex = 0 |
|
769 | self.profileIndex = 0 | |
710 |
|
|
770 | ||
711 |
|
771 | return True | ||
712 | if profileList != None: |
|
772 | ||
713 | if self.isProfileInList(profileList): |
|
773 | else: | |
714 | dataOut.flagNoData = False |
|
774 | """ | |
715 |
|
775 | data dimension = [nChannels, nHeis] | ||
716 |
|
|
776 | ||
717 |
|
|
777 | """ | |
718 |
|
778 | if profileList != None: | ||
719 |
|
||||
720 | elif profileRangeList != None: |
|
|||
721 | minIndex = profileRangeList[0] |
|
|||
722 | maxIndex = profileRangeList[1] |
|
|||
723 | if self.isProfileInRange(minIndex, maxIndex): |
|
|||
724 | dataOut.flagNoData = False |
|
|||
725 |
|
779 | |||
726 | self.incIndex() |
|
780 | if self.isProfileInList(profileList): | |
727 | return 1 |
|
781 | dataOut.flagNoData = False | |
728 | elif beam != None: #beam is only for AMISR data |
|
782 | ||
729 | if self.isProfileInList(dataOut.beamRangeDict[beam]): |
|
783 | self.incIndex() | |
730 | dataOut.flagNoData = False |
|
784 | return 1 | |
|
785 | ||||
|
786 | ||||
|
787 | if profileRangeList != None: | |||
731 |
|
788 | |||
732 | self.incIndex() |
|
789 | minIndex = profileRangeList[0] | |
733 | return 1 |
|
790 | maxIndex = profileRangeList[1] | |
734 |
|
791 | if self.isProfileInRange(minIndex, maxIndex): | ||
735 | else: |
|
792 | dataOut.flagNoData = False | |
736 | raise ValueError, "ProfileSelector needs profileList or profileRangeList" |
|
793 | ||
|
794 | self.incIndex() | |||
|
795 | return 1 | |||
|
796 | ||||
|
797 | if beam != None: #beam is only for AMISR data | |||
|
798 | if self.isProfileInList(dataOut.beamRangeDict[beam]): | |||
|
799 | dataOut.flagNoData = False | |||
|
800 | ||||
|
801 | self.incIndex() | |||
|
802 | return 1 | |||
|
803 | ||||
|
804 | raise ValueError, "ProfileSelector needs profileList or profileRangeList" | |||
737 |
|
805 | |||
738 | return 0 |
|
806 | return 0 | |
739 |
|
807 | |||
@@ -748,6 +816,12 class Reshaper(Operation): | |||||
748 |
|
816 | |||
749 | def run(self, dataOut, shape): |
|
817 | def run(self, dataOut, shape): | |
750 |
|
818 | |||
|
819 | if not dataOut.flagDataAsBlock: | |||
|
820 | raise ValueError, "Reshaper can only be used when voltage have been read as Block, getBlock = True" | |||
|
821 | ||||
|
822 | if len(shape) != 3: | |||
|
823 | raise ValueError, "shape len should be equal to 3, (nChannels, nProfiles, nHeis)" | |||
|
824 | ||||
751 | shape_tuple = tuple(shape) |
|
825 | shape_tuple = tuple(shape) | |
752 | dataOut.data = numpy.reshape(dataOut.data, shape_tuple) |
|
826 | dataOut.data = numpy.reshape(dataOut.data, shape_tuple) | |
753 | dataOut.flagNoData = False |
|
827 | dataOut.flagNoData = False | |
@@ -757,6 +831,11 class Reshaper(Operation): | |||||
757 | old_nheights = dataOut.nHeights |
|
831 | old_nheights = dataOut.nHeights | |
758 | new_nheights = dataOut.data.shape[2] |
|
832 | new_nheights = dataOut.data.shape[2] | |
759 | factor = 1.0*new_nheights / old_nheights |
|
833 | factor = 1.0*new_nheights / old_nheights | |
|
834 | ||||
760 | deltaHeight = dataOut.heightList[1] - dataOut.heightList[0] |
|
835 | deltaHeight = dataOut.heightList[1] - dataOut.heightList[0] | |
|
836 | ||||
761 | xf = dataOut.heightList[0] + dataOut.nHeights * deltaHeight * factor |
|
837 | xf = dataOut.heightList[0] + dataOut.nHeights * deltaHeight * factor | |
762 | dataOut.heightList = numpy.arange(dataOut.heightList[0], xf, deltaHeight) No newline at end of file |
|
838 | ||
|
839 | dataOut.heightList = numpy.arange(dataOut.heightList[0], xf, deltaHeight) | |||
|
840 | ||||
|
841 | dataOut.nProfiles = dataOut.data.shape[1] No newline at end of file |
General Comments 0
You need to be logged in to leave comments.
Login now