コード例 #1
0
    def make_plots(self,
                   points,
                   domain,
                   save=True,
                   show=False,
                   bathymetry=False):
        """
        Plots ``mesh``, ``station_locations``, ``basis_functions``,
        ``random_fields``, ``mean_field``, ``station_data``, and
        save in save_dir/figs

        .. todo:: this uses bv_array everywhere. I might want to change this
                  later when I go to the nested mesh approach

        """
        mkdir(self.save_dir + '/figs')
        domain.get_Triangulation(self.save_dir, save, show)
        domain.plot_bathymetry(self.save_dir, save, show)
        domain.plot_station_locations(self.save_dir, bathymetry, save, show)

        bv_array = tmm.get_basis_vec_array(self.basis_dir)

        self.plot_basis_functions(domain, bv_array, save, show)
        self.plot_random_fields(domain, points, bv_array, save, show)

        self.plot_mean_field(domain, points, bv_array, save, show)
        self.plot_station_data(save, show)
コード例 #2
0
    def make_plots(self,
                   points,
                   domain,
                   save=True,
                   show=False,
                   bathymetry=False,
                   ext='.eps',
                   ics=2):
        """
        Plots ``mesh``, ``station_locations``, ``basis_functions``,
        ``random_fields``, ``mean_field``, ``station_data``, and
        save in save_dir/figs

        """
        mkdir(os.path.join(self.save_dir, 'figs'))
        domain.get_Triangulation(self.save_dir, save, show, ext, ics)
        domain.plot_bathymetry(self.save_dir, save, show, ext, ics)
        domain.plot_station_locations(self.save_dir, bathymetry, save, show,
                                      ext, ics)
        bv_dict = tmm.get_basis_vectors(self.basis_dir)
        self.plot_basis_functions(domain,
                                  tmm.get_basis_vec_array(self.basis_dir),
                                  save, show, ext, ics)
        self.plot_random_fields(domain, points, bv_dict, save, show, ext, ics)
        self.plot_mean_field(domain, points, bv_dict, save, show, ext, ics)
        self.plot_station_data(save, show, ext)
コード例 #3
0
ファイル: random_manningsn.py プロジェクト: UT-CHG/PolyADCIRC
    def make_plots(self, points, domain, save=True, show=False,
                   bathymetry=False, ext='.eps', ics=2):
        """
        Plots ``mesh``, ``station_locations``, ``basis_functions``,
        ``random_fields``, ``mean_field``, ``station_data``, and
        save in save_dir/figs

        """
        mkdir(os.path.join(self.save_dir, 'figs'))
        domain.get_Triangulation(self.save_dir, save, show, ext, ics)
        domain.plot_bathymetry(self.save_dir, save, show, ext, ics)
        domain.plot_station_locations(self.save_dir, bathymetry, save, show,
                                      ext, ics)
        bv_dict = tmm.get_basis_vectors(self.basis_dir)
        self.plot_basis_functions(domain,
                                  tmm.get_basis_vec_array(self.basis_dir), 
                                  save, show, ext, ics)
        self.plot_random_fields(domain, points, bv_dict, save, show, ext, ics)
        self.plot_mean_field(domain, points, bv_dict, save, show, ext, ics)
        self.plot_station_data(save, show, ext)
コード例 #4
0
def compare(basis_dir=None, default=0.012):
    """
    Create a set of diagnostic plots in basis_dir/figs

    :param string basis_dir: directory containing the test folder and landuse
        folders
    :param float default: default Manning's *n*
    """
    if basis_dir is None:
        basis_dir = os.getcwd()
    tables = tm.read_tables(os.path.join(basis_dir, 'test'))
    domain = dom.domain(basis_dir)
    domain.read_spatial_grid()
    fm.mkdir(os.path.join(basis_dir, 'figs'))
    old_files = glob.glob(os.path.join(basis_dir, 'figs', '*.png'))
    for fid in old_files:
        os.remove(fid)
    domain.get_Triangulation(path=basis_dir)
    original = f13.read_nodal_attr_dict(os.path.join(basis_dir, 'test'))
    original = tmm.dict_to_array(original, default, domain.node_num)
    weights = np.array(tables[0].land_classes.values())
    lim = (np.min(weights), np.max(weights))
    bv_dict = tmm.get_basis_vectors(basis_dir)
    combo = tmm.combine_basis_vectors(weights, bv_dict, default,
                                      domain.node_num) 
    bv_array = tmm.get_basis_vec_array(basis_dir,
                                       domain.node_num)
    plt.basis_functions(domain, bv_array, path=basis_dir)
    plt.field(domain, original, 'original', clim=lim, path=basis_dir)
    plt.field(domain, combo, 'reconstruction', clim=lim, path=basis_dir)
    plt.field(domain, original-combo, 'difference', path=basis_dir)
    combo_array = tmm.combine_bv_array(weights, bv_array)
    plt.field(domain, combo_array, 'combo_array', clim=lim, path=basis_dir)
    plt.field(domain, original-combo_array, 'diff_ori_array', path=basis_dir)
    plt.field(domain, combo-combo_array, 'diff_com_array', path=basis_dir)
    combo_bv = tmm.combine_basis_vectors(np.ones(weights.shape),
                                         bv_dict, default, domain.node_num)
    plt.field(domain, combo_bv, 'combo_bv', path=basis_dir)
コード例 #5
0
    def make_plots(self, points, domain, save=True, show=False,
                   bathymetry=False):
        """
        Plots ``mesh``, ``station_locations``, ``basis_functions``,
        ``random_fields``, ``mean_field``, ``station_data``, and
        save in save_dir/figs

        .. todo:: this uses bv_array everywhere. I might want to change this
                  later when I go to the nested mesh approach

        """
        mkdir(self.save_dir+'/figs')
        domain.get_Triangulation(self.save_dir, save, show)
        domain.plot_bathymetry(self.save_dir, save, show)
        domain.plot_station_locations(self.save_dir, bathymetry, save, show)

        bv_array = tmm.get_basis_vec_array(self.basis_dir)

        self.plot_basis_functions(domain, bv_array, save, show)
        self.plot_random_fields(domain, points, bv_array, save, show)

        self.plot_mean_field(domain, points, bv_array, save, show)
        self.plot_station_data(save, show)