Esempio n. 1
0
    def plot_cluster_grid(self, i, par_to_plot=co.COL):
        fs = np.array([11, 13]) * .7
        fig_ops = dict(figsize=fs)
        fig: plt.Figure = plt.figure(**fig_ops)
        rows = 4
        # cols = 2
        perM = .9
        # rmap = rows - 2
        cplot = 1
        ax = fig.add_axes(
            [0, .7, .4, .4],
            projection=co.PROJ,
        )
        self.plot_cluster_map(i=i,
                              log_plot_dic=dict(perM=perM),
                              map_dic=dict(ax=ax, ),
                              par_to_plot=par_to_plot)
        fa.add_chc_lpb(ax)

        self.plot_lapaz_rect(ax)

        ax = fig.add_axes(
            [.5, .7, .4, .4],
            projection=co.PROJ,
        )
        self.plot_cluster_map(i=i,
                              log_plot_dic=dict(
                                  perM=perM,
                                  colorbar=True,
                              ),
                              map_dic=dict(ax=ax, lalo_extent=co.LOLA_LAPAZ),
                              par_to_plot=par_to_plot)
        fa.add_chc_lpb(ax)

        ax = fig.add_subplot(rows, cplot, (rows * cplot) - 2)
        self.plot_clust_height(ax, i, perM, par_to_plot=par_to_plot)

        ax = fig.add_subplot(rows, cplot, (rows * cplot) - 1)
        self.plot_absolute_height(ax=ax, i=i, perM=perM)

        ax = fig.add_subplot(rows, cplot, (rows * cplot) - 0)
        self.plot_cluster_influence_i(
            i=i,
            ax=ax,
            par_to_plot=par_to_plot,
        )
        fig.subplots_adjust(wspace=.4, hspace=.6)

        return fig
Esempio n. 2
0
def plot_clust_in_lapaz(_n, dscc):
    for _f in range(_n):
        ax = fa.get_ax_lapaz()
        ax.set_title(str(_f))
        _ds = dscc.loc[{co.CLUS_LENGTH_DIM: _n}][
            {co.R_CENTER: slice(1, 23)}]
        _ds = _ds.drop(co.KMEAN_OBJ)
        _ds = _ds.where(_ds[co.FLAG] == _f)
        _ds = _ds.sum([co.RL, co.ZM])

        _ds = _ds[[co.CONC]]

        _cm = fa.get_custom_cmap([*ucp.cc, *ucp.cc, *ucp.cc][_f][:3])

        if _ds[co.CONC].max().item() != 0:
            fa.logpolar_plot(_ds, ax=ax, patch_args={'cmap': _cm},
                             colorbar=False)
        fa.add_chc_lpb(ax)
ax = fa.get_ax_lapaz()
for i in range(len_clus):
    clus = self.cluster_flags[i]
    boo = self.merged_ds[co.ClusFlag] == clus
    #     fig,ax = plt.subplots()
    import warnings
    warnings.simplefilter('ignore')
    ar = self.merged_ds.where(boo)[co.CCPer].mean(dim=[co.RL])
    fa.logpolar_plot(ar,
                     ax,
                     name=co.CCPer,
                     perM=.05,
                     quantile=False,
                     colorbar=False,
                     patch_args={'cmap': fa.get_custom_cmap(FLP.COLORS[i])})
    fa.add_chc_lpb(ax)

# %%
# fig,axs = plt.subplots(3,4,sharex=True,sharey=True,figsize=(15,10))
axf = axs.flatten()
for i in range(len_clus):

    #     if i==0:
    #         ax = fig.add_subplot(3,4,i+1)
    #         ax0 = ax
    #     if i>0:
    #         ax = fig.add_subplot(3,4,i+1,sharex=ax0,sharey=ax0)
    #     ax = fa.get_ax_lapaz()
    ax = fa.get_ax_bolivia()

    clus = self.cluster_flags[i]