Exemplo n.º 1
0
    def render_aspect(self, ax1, ax2, ax3, mean):
        ax1.set_title('Aspect distribution', **PlotBase.title_opts())
        ax1.set_ylabel('Count', **PlotBase.label_opts())
        Histogram.show_mean(ax1, self.lidar.aspect.mean())

        ax2.set_title('Aspect distribution', **PlotBase.title_opts())
        ax2.set_ylabel('Count', **PlotBase.label_opts())
        Histogram.show_mean(ax2, self.sfm.aspect.mean())

        ax3.set_title('Differences per aspect angle in 10 degree intervals',
                      **PlotBase.title_opts())
        ax3.set_ylabel('Percent', **PlotBase.label_opts())
        ax3.set_xlabel('Degree', **PlotBase.label_opts())
        PlotBase.add_to_legend(ax3, self.BOX_TEXT.format(mean.round(2)))
Exemplo n.º 2
0
    def render_elevation(self, ax1, ax2, ax3, mean):
        ax1.set_title('Elevation distribution', **PlotBase.title_opts())
        ax1.set_ylabel('Count', **PlotBase.label_opts())
        Histogram.show_mean(ax1, self.lidar.elevation.mean())

        ax2.set_title('Elevation distribution', **PlotBase.title_opts())
        ax2.set_ylabel('Count', **PlotBase.label_opts())
        Histogram.show_mean(ax2, self.sfm.elevation.mean())

        ax3.set_title('Differences per elevation in 10 m intervals',
                      **PlotBase.title_opts())
        ax3.set_ylabel('Percent', **PlotBase.label_opts())
        ax3.set_xlabel('Elevation', **PlotBase.label_opts())
        PlotBase.add_to_legend(ax3, self.BOX_TEXT.format(mean.round(4)))
Exemplo n.º 3
0
    def plot(self, raster_attr):
        self.print_status(str(raster_attr))

        fig = plt.figure(constrained_layout=False)
        fig.set_size_inches(14, 12)
        heights = [2, 1]
        grid_opts = dict(figure=fig, height_ratios=heights)

        difference = getattr(self.raster_difference, raster_attr)

        if raster_attr is 'elevation':
            grid_spec = GridSpec(nrows=2,
                                 ncols=3,
                                 width_ratios=[3, 2, 3],
                                 **grid_opts)
            bins = np.arange(difference.min(),
                             difference.max() + self.HIST_BIN_WIDTH,
                             self.HIST_BIN_WIDTH)
            bounds = dict(norm=colors.BoundaryNorm(boundaries=bins,
                                                   ncolors=self.COLORMAP.N))
        else:
            grid_spec = GridSpec(nrows=2,
                                 ncols=2,
                                 width_ratios=[3, 2],
                                 **grid_opts)
            bounds = dict()
            bins = 'auto'

        ax1 = fig.add_subplot(grid_spec[0, :])
        diff_plot = ax1.imshow(difference,
                               cmap=self.COLORMAP,
                               alpha=0.8,
                               extent=self.sfm.extent,
                               **bounds)
        ax1.set_title(self.TITLE.format(raster_attr.capitalize()),
                      **PlotBase.title_opts())
        self.insert_colorbar(plt, ax1, diff_plot,
                             self.SCALE_BAR_LABEL[raster_attr])

        ax2 = fig.add_subplot(grid_spec[1, 0])
        ax2.hist(difference.compressed(), bins=bins, label='Count')
        ax2.set_xlabel(self.SCALE_BAR_LABEL[raster_attr],
                       **PlotBase.label_opts())
        ax2.set_ylabel('Count', **PlotBase.label_opts())
        if raster_attr is 'elevation':
            self.add_hist_stats(ax2)

        ax3 = fig.add_subplot(grid_spec[1, 1])
        box = ax3.boxplot(difference.compressed(),
                          sym='k+',
                          whis=self.BOX_PLOT_WHISKERS,
                          positions=[0.1])
        ax3.set_xlim([0, .35])
        ax3.tick_params(axis='x',
                        which='both',
                        bottom=False,
                        top=False,
                        labelbottom=False)
        ax3.set_ylabel(self.SCALE_BAR_LABEL[raster_attr],
                       **PlotBase.label_opts())
        self.add_box_plot_stats(ax3, box)

        if raster_attr is 'elevation':
            ax4 = fig.add_subplot(grid_spec[1, 2])
            probplot = sm.ProbPlot(
                self.raster_difference.elevation.compressed())
            probplot.qqplot(ax=ax4, line='s')
            ax4.get_lines()[0].set(markersize=1)
            ax4.get_lines()[1].set(color='black', dashes=[4, 1])
            ax4.set_title('Normal Q-Q Plot', **self.title_opts())

        plt.tight_layout()
        plt.savefig(self.OUTPUT_FILE.format(self.output_path, raster_attr),
                    dpi=PlotBase.DEFAULT_DPI)