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