##// END OF EJS Templates
cambio
Erick Valdez -
r870:bd8def453202
parent child
Show More
@@ -4,8 +4,7 import numpy
4
4
5 from figure import Figure, isRealtime, isTimeInHourRange
5 from figure import Figure, isRealtime, isTimeInHourRange
6 from plotting_codes import *
6 from plotting_codes import *
7
7 from numpy import NaN
8 import matplotlib.pyplot as plt
9
8
10 class MomentsPlot(Figure):
9 class MomentsPlot(Figure):
11
10
@@ -446,34 +445,38 class WindProfilerPlot(Figure):
446 #
445 #
447 # tmin = None
446 # tmin = None
448 # tmax = None
447 # tmax = None
449
448
450 x = dataOut.getTimeRange1(dataOut.outputInterval)
449
451 y = dataOut.heightList
450 x = dataOut.getTimeRange()
451 y = dataOut.getHeiRange()
452 #x = dataOut.getTimeRange1(dataOut.outputInterval)
453 #y = dataOut.heightList
454
452 z = dataOut.data_output.copy()
455 z = dataOut.data_output.copy()
456 #print 'dataOut_JI',z
453 nplots = z.shape[0] #Number of wind dimensions estimated
457 nplots = z.shape[0] #Number of wind dimensions estimated
454
455 nplotsw = nplots
458 nplotsw = nplots
459
456
460
457 #If there is a SNR function defined
461 #If there is a SNR function defined
458 if dataOut.data_SNR is not None:
462 if dataOut.data_SNR is not None:
459 nplots += 1
463 nplots += 1
460 SNR = dataOut.data_SNR
464 SNR = dataOut.data_SNR
461 SNRavg = numpy.average(SNR, axis=0)
465 SNRavg = numpy.average(SNR, axis=0)
462
466
463 SNRdB = 10*numpy.log10(SNR)
467 SNRdB = 10*numpy.log10(SNR)
464 SNRavgdB = 10*numpy.log10(SNRavg)
468 SNRavgdB = 10*numpy.log10(SNRavg)
465
469
466 if SNRthresh == None: SNRthresh = -5.0
470 if SNRthresh == None: SNRthresh = -5.0
467 ind = numpy.where(SNRavg < 10**(SNRthresh/10))[0]
471 ind = numpy.where(SNRavg < 10**(SNRthresh/10))[0]
468
472
469 for i in range(nplotsw):
473 for i in range(nplotsw):
470 z[i,ind] = numpy.nan
474 z[i,ind] = numpy.nan
471
475
472
476
473 # showprofile = False
477 # showprofile = False
474 # thisDatetime = dataOut.datatime
478 # thisDatetime = dataOut.datatime
475 #thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.ltctime)
479 thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.ltctime)
476 thisDatetime = datetime.datetime.now()
477 title = wintitle + "Wind"
480 title = wintitle + "Wind"
478 xlabel = ""
481 xlabel = ""
479 ylabel = "Height (km)"
482 ylabel = "Height (km)"
@@ -492,8 +495,8 class WindProfilerPlot(Figure):
492
495
493 self.xmin, self.xmax = self.getTimeLim(x, xmin, xmax, timerange)
496 self.xmin, self.xmax = self.getTimeLim(x, xmin, xmax, timerange)
494
497
495 #if ymin == None: ymin = numpy.nanmin(y)
498 if ymin == None: ymin = numpy.nanmin(y)
496 #if ymax == None: ymax = numpy.nanmax(y)
499 if ymax == None: ymax = numpy.nanmax(y)
497
500
498 if zmax == None: zmax = numpy.nanmax(abs(z[range(2),:]))
501 if zmax == None: zmax = numpy.nanmax(abs(z[range(2),:]))
499 #if numpy.isnan(zmax): zmax = 50
502 #if numpy.isnan(zmax): zmax = 50
@@ -503,9 +506,9 class WindProfilerPlot(Figure):
503 if zmax_ver == None: zmax_ver = numpy.nanmax(abs(z[2,:]))
506 if zmax_ver == None: zmax_ver = numpy.nanmax(abs(z[2,:]))
504 if zmin_ver == None: zmin_ver = -zmax_ver
507 if zmin_ver == None: zmin_ver = -zmax_ver
505
508
506 # if dataOut.data_SNR is not None:
509 if dataOut.data_SNR is not None:
507 # if SNRmin == None: SNRmin = numpy.nanmin(SNRavgdB)
510 if SNRmin == None: SNRmin = numpy.nanmin(SNRavgdB)
508 # if SNRmax == None: SNRmax = numpy.nanmax(SNRavgdB)
511 if SNRmax == None: SNRmax = numpy.nanmax(SNRavgdB)
509
512
510
513
511 self.FTP_WEI = ftp_wei
514 self.FTP_WEI = ftp_wei
@@ -520,8 +523,8 class WindProfilerPlot(Figure):
520
523
521 self.setWinTitle(title)
524 self.setWinTitle(title)
522
525
523 #if ((self.xmax - x[1]) < (x[1]-x[0])):
526 if ((self.xmax - x[1]) < (x[1]-x[0])):
524 # x[1] = self.xmax
527 x[1] = self.xmax
525
528
526 strWind = ['Zonal', 'Meridional', 'Vertical']
529 strWind = ['Zonal', 'Meridional', 'Vertical']
527 strCb = ['Velocity (m/s)','Velocity (m/s)','Velocity (cm/s)']
530 strCb = ['Velocity (m/s)','Velocity (m/s)','Velocity (cm/s)']
@@ -533,26 +536,27 class WindProfilerPlot(Figure):
533
536
534 title = "%s Wind: %s" %(strWind[i], thisDatetime.strftime("%Y/%m/%d %H:%M:%S"))
537 title = "%s Wind: %s" %(strWind[i], thisDatetime.strftime("%Y/%m/%d %H:%M:%S"))
535 axes = self.axesList[i*self.__nsubplots]
538 axes = self.axesList[i*self.__nsubplots]
536
539
537 z1 = z[i,:].reshape((1,-1))*windFactor[i]
540 z1 = z[i,:].reshape((1,-1))*windFactor[i]
541 #z1=numpy.ma.masked_where(z1==0.,z1)
538
542
539 axes.pcolorbuffer(x, y, z1,
543 axes.pcolorbuffer(x, y, z1,
540 xmin=self.xmin, xmax=self.xmax, ymin=ymin, ymax=ymax, zmin=zminVector[i], zmax=zmaxVector[i],
544 xmin=self.xmin, xmax=self.xmax, ymin=ymin, ymax=ymax, zmin=zminVector[i], zmax=zmaxVector[i],
541 xlabel=xlabel, ylabel=ylabel, title=title, rti=True, XAxisAsTime=True,
545 xlabel=xlabel, ylabel=ylabel, title=title, rti=True, XAxisAsTime=True,
542 ticksize=9, cblabel=strCb[i], cbsize="1%", colormap="RdBu_r" )
546 ticksize=9, cblabel=strCb[i], cbsize="1%", colormap="seismic" )
543
547
544 if dataOut.data_SNR is not None:
548 if dataOut.data_SNR is not None:
545 i += 1
549 i += 1
546 title = "Signal Noise Ratio (SNR): %s" %(thisDatetime.strftime("%Y/%m/%d %H:%M:%S"))
550 title = "Signal Noise Ratio (SNR): %s" %(thisDatetime.strftime("%Y/%m/%d %H:%M:%S"))
547 axes = self.axesList[i*self.__nsubplots]
551 axes = self.axesList[i*self.__nsubplots]
548
552
549 SNRavgdB = SNRavgdB.reshape((1,-1))
553 SNRavgdB = SNRavgdB.reshape((1,-1))
550
554
551 axes.pcolorbuffer(x, y, SNRavgdB,
555 axes.pcolorbuffer(x, y, SNRavgdB,
552 xmin=self.xmin, xmax=self.xmax, ymin=ymin, ymax=ymax, zmin=SNRmin, zmax=SNRmax,
556 xmin=self.xmin, xmax=self.xmax, ymin=ymin, ymax=ymax, zmin=SNRmin, zmax=SNRmax,
553 xlabel=xlabel, ylabel=ylabel, title=title, rti=True, XAxisAsTime=True,
557 xlabel=xlabel, ylabel=ylabel, title=title, rti=True, XAxisAsTime=True,
554 ticksize=9, cblabel='', cbsize="1%", colormap="jet")
558 ticksize=9, cblabel='', cbsize="1%", colormap="jet")
555
559
556 self.draw()
560 self.draw()
557
561
558 self.save(figpath=figpath,
562 self.save(figpath=figpath,
@@ -563,8 +567,8 class WindProfilerPlot(Figure):
563 thisDatetime=thisDatetime,
567 thisDatetime=thisDatetime,
564 update_figfile=update_figfile)
568 update_figfile=update_figfile)
565
569
566 if False and dataOut.ltctime + dataOut.outputInterval >= self.xmax:
570 if dataOut.ltctime + dataOut.outputInterval >= self.xmax:
567 self.counter_imagwr = wr_period
571 self.counter_imagwr = wr_period
568 self.isConfig = False
572 self.isConfig = False
569 update_figfile = True
573 update_figfile = True
570
574
@@ -780,7 +784,7 class ParametersPlot(Figure):
780
784
781
785
782
786
783 class ParametersPlot(Figure):
787 class Parameters1Plot(Figure):
784
788
785 __isConfig = None
789 __isConfig = None
786 __nsubplots = None
790 __nsubplots = None
General Comments 0
You need to be logged in to leave comments. Login now