Example #1
0
    def plot_basis_functions(self, domain, bv_dict, save=True, show=False,
                             ext='.eps', ics=2): 
        """
        See :meth:`~polsim.pyADCIRC.plotADCIRC.basis_functions`

        """
        plot.basis_functions(domain, bv_dict, self.save_dir, save, show,
                             ext=ext, ics=ics)
Example #2
0
    def plot_basis_functions(self,
                             domain,
                             bv_dict,
                             save=True,
                             show=False,
                             ext='.eps',
                             ics=2):
        """
        See :meth:`~polsim.pyADCIRC.plotADCIRC.basis_functions`

        """
        plot.basis_functions(domain,
                             bv_dict,
                             self.save_dir,
                             save,
                             show,
                             ext=ext,
                             ics=ics)
Example #3
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)
Example #4
0
# load in the small katrina mesh
domain = dom.domain(grid_dir)
domain.update()

# load in basis vectors for domain
bv_dict = tmm.get_basis_vectors(basis_dir)

# create and save images of the mesh with various manning's n values to
# visualize the location of different types of nodes
# show the location of the non default nodes
# show the location of the shelf nodes
# show the location of the default nodes
domain.get_Triangulation()
# convert basis vectors to an array
bv_array = np.zeros((domain.node_num, len(bv_dict)+1))
default_nodes = tmm.get_default_nodes(domain, bv_dict)
bv_array[default_nodes, -1] = 1.0
for i, b_vect in enumerate(bv_dict):
    ind = np.array(b_vect.keys())-1
    bv_array[ind, i] = 1
plotA.basis_functions(domain, bv_array)

# plot bathymetry contours (in a separate plot, but with contours where the
# shelf should be)
plotA.bathymetry(domain, contour=True)

# everything should look fine if it does then we're good :)


Example #5
0
    def plot_basis_functions(self, domain, bv_array, save=True, show=False):
        """
        See :meth:``~polsim.pyADCIRC.plotADCIRC.basis_functions`

        """
        plot.basis_functions(domain, bv_array, self.save_dir, save, show)
Example #6
0
save_dir = adcirc_dir + '/ADCIRC_landuse/Katrina_small/runs/output_test'
basis_dir = adcirc_dir + '/ADCIRC_landuse/Katrina_small/landuse_basis/gap/shelf_test'

# load in the small katrina mesh
domain = dom.domain(grid_dir)
domain.update()

# load in basis vectors for domain
bv_dict = tmm.get_basis_vectors(basis_dir)

# create and save images of the mesh with various manning's n values to
# visualize the location of different types of nodes
# show the location of the non default nodes
# show the location of the shelf nodes
# show the location of the default nodes
domain.get_Triangulation()
# convert basis vectors to an array
bv_array = np.zeros((domain.node_num, len(bv_dict) + 1))
default_nodes = tmm.get_default_nodes(domain, bv_dict)
bv_array[default_nodes, -1] = 1.0
for i, b_vect in enumerate(bv_dict):
    ind = np.array(b_vect.keys()) - 1
    bv_array[ind, i] = 1
plotA.basis_functions(domain, bv_array)

# plot bathymetry contours (in a separate plot, but with contours where the
# shelf should be)
plotA.bathymetry(domain, contour=True)

# everything should look fine if it does then we're good :)
Example #7
0
    def plot_basis_functions(self, domain, bv_array, save=True, show=False):
        """
        See :meth:``~polsim.pyADCIRC.plotADCIRC.basis_functions`

        """
        plot.basis_functions(domain, bv_array, self.save_dir, save, show)