Пример #1
0
    def plotNGround(self, name, hour, tRange, plotEmf=False):

        size = 50

        nPlots = len(hour)

        # be carefull. This is wrong we must use nodx and not vclx
        if self.revertPlotT:
            self.xDataMesh, self.yDataMesh = num.meshgrid(
                self.xPoints, -self.yPoints)
        else:
            self.xDataMesh, self.yDataMesh = num.meshgrid(
                self.xPoints, self.yPoints)

        fig = plt.figure(figsize=(6.4, 5.5))

        #        levels = [0,5,10,15,20,25,30,35,40,45,50,55,60]

        for i in range(nPlots):
            nXPlots = int(num.ceil(num.sqrt(nPlots)))
            nYPlots = int(num.floor(num.sqrt(nPlots)))
            plot = fig.add_subplot(nXPlots, nYPlots, i + 1)

            self.readTemperatureField(name[i])

            axes = plot.contourf(
                self.xDataMesh,
                num.max(num.max(self.yDataMesh)) - self.yDataMesh,
                self.T.T,
                levels=num.linspace(tRange[0], tRange[1],
                                    tRange[1] - tRange[0] + 1),
            )
            plot.invert_yaxis()
            for c in axes.collections:
                c.set_edgecolor("face")
            plot.set_ylabel("Tiefe [m]")
            plot.set_xlabel("Distanz zur Gebäudemitte [m]")
            plot.tick_params(axis="both", which="major")
            plot.tick_params(axis="both", which="minor")

            (month, day, year) = utils.getMonthIndexByHourOfYear(hour[i] + 24)
            year = "Jahr " + str(year)
            plot.set_title("%s: %d.%d." % (year, day, month), fontsize=8)

        fig.subplots_adjust(right=0.8, hspace=0.35, wspace=0.3)
        cbar_ax = fig.add_axes([0.85, 0.15, 0.02, 0.7])
        cbar = fig.colorbar(axes, cax=cbar_ax)
        cbar.set_label("Temperatur [°C]")
        nameFile = r"groundPlot1.pdf"
        self.nameGroundWithPath1 = "%s/groundPlot1.pdf" % (self.outputPath)

        fig.savefig(self.nameGroundWithPath1)
        if plotEmf:

            nameEmfWithPath = "%s\%s" % (self.outputPath, nameFile)

            self._plot_as_emf(fig, filename=nameEmfWithPath)

        fig.clear()
        return os.path.basename(self.nameGroundWithPath1)
Пример #2
0
    def plotTwelveGround(self, name, hour):

        size = 50

        # be carefull. This is wrong we must use nodx and not vclx
        if self.revertPlotT:
            self.xDataMesh, self.yDataMesh = num.meshgrid(
                self.xPoints, -self.yPoints)
        else:
            self.xDataMesh, self.yDataMesh = num.meshgrid(
                self.xPoints, self.yPoints)

        fig = plt.figure(figsize=(12, 12))

        #        levels = [0,5,10,15,20,25,30,35,40,45,50,55,60]

        for i in range(12):
            plot = fig.add_subplot(4, 3, i + 1)

            self.readTemperatureField(name[i])

            axes = plot.contourf(self.xDataMesh,
                                 self.yDataMesh,
                                 self.T.T,
                                 vmin=0,
                                 vmax=60,
                                 size=500)

            plot.tick_params(axis="both", which="major", labelsize=6)
            plot.tick_params(axis="both", which="minor", labelsize=6)

            (month, day, year) = utils.getMonthIndexByHourOfYear(hour[i] + 24)
            year = 2012 + year
            plot.set_title("%d-%d-%d" % (day, month, year), fontsize=6)

            cbar = fig.colorbar(axes)  # draw colorbar
            cbar.ax.tick_params(labelsize=6)
            cbar.update_ticks()

        self.nameGroundWithPath1 = "%s/groundPlot1.pdf" % (self.outputPath)

        fig.savefig(self.nameGroundWithPath1)

        fig.clear()
Пример #3
0
    def plotTGround(self, name, hour):

        fig = plt.figure()
        plot = fig.add_subplot(1, 1, 1)

        size = 1000

        (month, day, year) = utils.getMonthIndexByHourOfYear(hour + 24)
        year = 2012 + year
        plot.set_title("%d-%d-%d" % (day, month, year), fontsize=8)

        # be carefull. This is wrong we must use nodx and not vclx
        if self.revertPlotT:
            self.xDataMesh, self.yDataMesh = num.meshgrid(
                self.xPoints, -self.yPoints)
        else:
            self.xDataMesh, self.yDataMesh = num.meshgrid(
                self.xPoints, self.yPoints)

        axes = plot.contourf(self.xDataMesh,
                             self.yDataMesh,
                             self.T.T,
                             levels=num.linspace(-10, 20, 100))

        plot.tick_params(axis="both", which="major", labelsize=8)
        plot.tick_params(axis="both", which="minor", labelsize=8)

        #        plot.grid(True)

        cbar = fig.colorbar(axes)  # draw colorbar
        cbar.update_ticks()

        if self.addSizeInNames:
            myName = "%s/%s-T-TX%dTY%d.pdf" % (self.outputPath, name.split(
                ".")[0], len(self.xPoints), len(self.yPoints))
        else:
            myName = "%s/%s-T.pdf" % (self.outputPath, name.split(".")[0])

        fig.savefig(myName)

        fig.clear()

        return os.path.basename(myName)
Пример #4
0
    def getIteProblemsForEachMonth(self):

        sentence = "TRNSYS Message    441"
        sentenceUnit = "Reported information  : UNITS:"

        iteMonth = num.zeros(12)

        self.hourWhereItProblems = []
        self.unitsInvolvedItProlems = []

        try:
            for i in range(len(self.lines)):

                mysplit = self.lines[i].split(sentence)

                try:
                    if (mysplit[1] != None):

                        hourOfYear = float(self.lines[i - 3].split(":")[1])
                        self.hourWhereItProblems.append(hourOfYear)

                        units = self.lines[i + 1].split(sentenceUnit)[1]
                        self.unitsInvolvedItProlems.append(list(units.split()))

                        #                       print "hourOfYear:%f " % (hourOfYear)
                        (n, d, h) = utils.getMonthIndexByHourOfYear(hourOfYear)
                        n = n - 1
                        iteMonth[n] = iteMonth[n] + 1
#                       print "ite in month:%d = %d"% (n,iteMonth[n])

                except:
                    pass

        except:
            logger.warning("LOG FILE NOT FOUND")

        return iteMonth