##// END OF EJS Templates
-Parameters Plot corrected...
Julio Valdez -
r832:2ef6a65d9dbc
parent child
Show More
@@ -498,15 +498,18 class Voltage(JROData):
498
498
499 class Spectra(JROData):
499 class Spectra(JROData):
500
500
501 #data es un numpy array de 2 dmensiones (canales, perfiles, alturas)
501 #data spc es un numpy array de 2 dmensiones (canales, perfiles, alturas)
502 data_spc = None
502 data_spc = None
503
503
504 #data es un numpy array de 2 dmensiones (canales, pares, alturas)
504 #data cspc es un numpy array de 2 dmensiones (canales, pares, alturas)
505 data_cspc = None
505 data_cspc = None
506
506
507 #data es un numpy array de 2 dmensiones (canales, alturas)
507 #data dc es un numpy array de 2 dmensiones (canales, alturas)
508 data_dc = None
508 data_dc = None
509
509
510 #data power
511 data_pwr = None
512
510 nFFTPoints = None
513 nFFTPoints = None
511
514
512 # nPairs = None
515 # nPairs = None
@@ -678,6 +681,15 class Spectra(JROData):
678
681
679 return timeInterval
682 return timeInterval
680
683
684 def getPower(self):
685
686 factor = self.normFactor
687 z = self.data_spc/factor
688 z = numpy.where(numpy.isfinite(z), z, numpy.NAN)
689 avg = numpy.average(z, axis=1)
690
691 return 10*numpy.log10(avg)
692
681 def setValue(self, value):
693 def setValue(self, value):
682
694
683 print "This property should not be initialized"
695 print "This property should not be initialized"
@@ -1094,6 +1106,8 class Correlation(JROData):
1094
1106
1095 class Parameters(JROData):
1107 class Parameters(JROData):
1096
1108
1109 experimentInfo = None #Information about the experiment
1110
1097 #Information from previous data
1111 #Information from previous data
1098
1112
1099 inputUnit = None #Type of data to be processed
1113 inputUnit = None #Type of data to be processed
@@ -2,7 +2,7 import os
2 import datetime
2 import datetime
3 import numpy
3 import numpy
4
4
5 from figure import Figure, isRealtime
5 from figure import Figure, isRealtime, isTimeInHourRange
6 from plotting_codes import *
6 from plotting_codes import *
7
7
8 class MomentsPlot(Figure):
8 class MomentsPlot(Figure):
@@ -566,9 +566,214 class WindProfilerPlot(Figure):
566 thisDatetime=thisDatetime,
566 thisDatetime=thisDatetime,
567 update_figfile=update_figfile)
567 update_figfile=update_figfile)
568
568
569 class ParametersPlot(Figure):
570
571 __isConfig = None
572 __nsubplots = None
573
574 WIDTHPROF = None
575 HEIGHTPROF = None
576 PREFIX = 'param'
577
578 nplots = None
579 nchan = None
580
581 def __init__(self):
582
583 self.timerange = None
584 self.isConfig = False
585 self.__nsubplots = 1
586
587 self.WIDTH = 800
588 self.HEIGHT = 180
589 self.WIDTHPROF = 120
590 self.HEIGHTPROF = 0
591 self.counter_imagwr = 0
592
593 self.PLOT_CODE = RTI_CODE
594
595 self.FTP_WEI = None
596 self.EXP_CODE = None
597 self.SUB_EXP_CODE = None
598 self.PLOT_POS = None
599 self.tmin = None
600 self.tmax = None
601
602 self.xmin = None
603 self.xmax = None
604
605 self.figfile = None
606
607 def getSubplots(self):
608
609 ncol = 1
610 nrow = self.nplots
611
612 return nrow, ncol
613
614 def setup(self, id, nplots, wintitle, show=True):
615
616 self.nplots = nplots
617
618 ncolspan = 1
619 colspan = 1
620
621 self.createFigure(id = id,
622 wintitle = wintitle,
623 widthplot = self.WIDTH + self.WIDTHPROF,
624 heightplot = self.HEIGHT + self.HEIGHTPROF,
625 show=show)
626
627 nrow, ncol = self.getSubplots()
628
629 counter = 0
630 for y in range(nrow):
631 for x in range(ncol):
632
633 if counter >= self.nplots:
634 break
635
636 self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan, colspan, 1)
637
638 counter += 1
639
640 def run(self, dataOut, id, wintitle="", channelList=None, paramIndex = 0, colormap=True,
641 xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None, timerange=None,
642 showSNR=False, SNRthresh = -numpy.inf, SNRmin=None, SNRmax=None,
643 save=False, figpath='./', lastone=0,figfile=None, ftp=False, wr_period=1, show=True,
644 server=None, folder=None, username=None, password=None,
645 ftp_wei=0, exp_code=0, sub_exp_code=0, plot_pos=0):
646
647 """
648
649 Input:
650 dataOut :
651 id :
652 wintitle :
653 channelList :
654 showProfile :
655 xmin : None,
656 xmax : None,
657 ymin : None,
658 ymax : None,
659 zmin : None,
660 zmax : None
661 """
662
663 if colormap:
664 colormap="jet"
665 else:
666 colormap="RdBu_r"
667
668 if not isTimeInHourRange(dataOut.datatime, xmin, xmax):
669 return
670
671 if channelList == None:
672 channelIndexList = dataOut.channelIndexList
673 else:
674 channelIndexList = []
675 for channel in channelList:
676 if channel not in dataOut.channelList:
677 raise ValueError, "Channel %d is not in dataOut.channelList"
678 channelIndexList.append(dataOut.channelList.index(channel))
679
680 x = dataOut.getTimeRange1(dataOut.paramInterval)
681 y = dataOut.getHeiRange()
682 z = dataOut.data_param[channelIndexList,paramIndex,:]
683
684 if showSNR:
685 #SNR data
686 SNRarray = dataOut.data_SNR[channelIndexList,:]
687 SNRdB = 10*numpy.log10(SNRarray)
688 ind = numpy.where(SNRdB < SNRthresh)
689 z[ind] = numpy.nan
690
691 thisDatetime = dataOut.datatime
692 # thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[0])
693 title = wintitle + " Parameters Plot" #: %s" %(thisDatetime.strftime("%d-%b-%Y"))
694 xlabel = ""
695 ylabel = "Range (Km)"
696
697 update_figfile = False
698
699 if not self.isConfig:
569
700
701 nchan = len(channelIndexList)
702 self.nchan = nchan
703 self.plotFact = 1
704 nplots = nchan
570
705
571 class ParametersPlot(Figure):
706 if showSNR:
707 nplots = nchan*2
708 self.plotFact = 2
709 if SNRmin == None: SNRmin = numpy.nanmin(SNRdB)
710 if SNRmax == None: SNRmax = numpy.nanmax(SNRdB)
711
712 self.setup(id=id,
713 nplots=nplots,
714 wintitle=wintitle,
715 show=show)
716
717 if timerange != None:
718 self.timerange = timerange
719
720 self.xmin, self.xmax = self.getTimeLim(x, xmin, xmax, timerange)
721
722 if ymin == None: ymin = numpy.nanmin(y)
723 if ymax == None: ymax = numpy.nanmax(y)
724 if zmin == None: zmin = dataOut.abscissaList[0]
725 if zmax == None: zmax = dataOut.abscissaList[-1]
726
727 self.FTP_WEI = ftp_wei
728 self.EXP_CODE = exp_code
729 self.SUB_EXP_CODE = sub_exp_code
730 self.PLOT_POS = plot_pos
731
732 self.name = thisDatetime.strftime("%Y%m%d_%H%M%S")
733 self.isConfig = True
734 self.figfile = figfile
735 update_figfile = True
736
737 self.setWinTitle(title)
738
739 for i in range(self.nchan):
740 index = channelIndexList[i]
741 title = "Channel %d: %s" %(dataOut.channelList[index], thisDatetime.strftime("%Y/%m/%d %H:%M:%S"))
742 axes = self.axesList[i*self.plotFact]
743 z1 = z[i,:].reshape((1,-1))
744 axes.pcolorbuffer(x, y, z1,
745 xmin=self.xmin, xmax=self.xmax, ymin=ymin, ymax=ymax, zmin=zmin, zmax=zmax,
746 xlabel=xlabel, ylabel=ylabel, title=title, rti=True, XAxisAsTime=True,
747 ticksize=9, cblabel='', cbsize="1%",colormap=colormap)
748
749 if showSNR:
750 title = "Channel %d SNR: %s" %(dataOut.channelList[index], thisDatetime.strftime("%Y/%m/%d %H:%M:%S"))
751 axes = self.axesList[i*self.plotFact + 1]
752 SNRdB1 = SNRdB[i,:].reshape((1,-1))
753 axes.pcolorbuffer(x, y, SNRdB1,
754 xmin=self.xmin, xmax=self.xmax, ymin=ymin, ymax=ymax, zmin=SNRmin, zmax=SNRmax,
755 xlabel=xlabel, ylabel=ylabel, title=title, rti=True, XAxisAsTime=True,
756 ticksize=9, cblabel='', cbsize="1%",colormap='jet')
757
758
759 self.draw()
760
761 if dataOut.ltctime >= self.xmax:
762 self.counter_imagwr = wr_period
763 self.isConfig = False
764 update_figfile = True
765
766 self.save(figpath=figpath,
767 figfile=figfile,
768 save=save,
769 ftp=ftp,
770 wr_period=wr_period,
771 thisDatetime=thisDatetime,
772 update_figfile=update_figfile)
773
774
775
776 class Parameters1Plot(Figure):
572
777
573 __isConfig = None
778 __isConfig = None
574 __nsubplots = None
779 __nsubplots = None
@@ -547,15 +547,20 class RTIPlot(Figure):
547 raise ValueError, "Channel %d is not in dataOut.channelList"
547 raise ValueError, "Channel %d is not in dataOut.channelList"
548 channelIndexList.append(dataOut.channelList.index(channel))
548 channelIndexList.append(dataOut.channelList.index(channel))
549
549
550 factor = dataOut.normFactor
550 if hasattr(dataOut, 'normFactor'):
551 factor = dataOut.normFactor
552 else:
553 factor = 1
554
555 # factor = dataOut.normFactor
551 x = dataOut.getTimeRange()
556 x = dataOut.getTimeRange()
552 y = dataOut.getHeiRange()
557 y = dataOut.getHeiRange()
553
558
554 z = dataOut.data_spc/factor
559 # z = dataOut.data_spc/factor
555 z = numpy.where(numpy.isfinite(z), z, numpy.NAN)
560 # z = numpy.where(numpy.isfinite(z), z, numpy.NAN)
556 avg = numpy.average(z, axis=1)
561 # avg = numpy.average(z, axis=1)
557
562 # avgdB = 10.*numpy.log10(avg)
558 avgdB = 10.*numpy.log10(avg)
563 avgdB = dataOut.getPower()
559
564
560 thisDatetime = dataOut.datatime
565 thisDatetime = dataOut.datatime
561 # thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[0])
566 # thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[0])
General Comments 0
You need to be logged in to leave comments. Login now