Esempio n. 1
0
    def write_data_objects(self):
        super(PlaneWaveTest, self).write_data_objects()

        # Write out bathy file
        mx = self.rundata.clawdata.num_cells[0]
        my = self.rundata.clawdata.num_cells[1]
        xlower = self.rundata.clawdata.lower[0]
        xupper = self.rundata.clawdata.upper[0]
        ylower = self.rundata.clawdata.lower[1]
        yupper = self.rundata.clawdata.upper[1]
        dx = (xupper - xlower) / mx
        dy = (yupper - ylower) / my
        d = min(dx,dy)
        mx = int((xupper - xlower) / d) + 8
        my = int((yupper - ylower) / d) + 8
        
        xlower = xlower - d*4.0
        ylower = ylower - d*4.0
        xupper = xupper + d*4.0
        yupper = yupper + d*4.0

        step = lambda x,y: setrun.bathy_step(x, y, location=self.bathy_location,
                                            angle=self.bathy_angle)
        
        tt.topo2writer('./topo.tt2', step, xlower, xupper, ylower, yupper, 
                                     mx, my, nodata_value=-99999)

        # Write out simple bathy geometry file for communication to the plotting
        with open("./bathy_geometry.data", 'w') as bathy_geometry_file:
            bathy_geometry_file.write("%s\n%s" % (self.bathy_location,
                                                  self.bathy_angle) )
Esempio n. 2
0
    def write_data_objects(self):
        super(PlaneWaveTest, self).write_data_objects()

        # Write out bathy file
        mx = self.rundata.clawdata.num_cells[0]
        my = self.rundata.clawdata.num_cells[1]
        xlower = self.rundata.clawdata.lower[0]
        xupper = self.rundata.clawdata.upper[0]
        ylower = self.rundata.clawdata.lower[1]
        yupper = self.rundata.clawdata.upper[1]
        dx = (xupper - xlower) / mx
        dy = (yupper - ylower) / my
        d = min(dx,dy)
        mx = int((xupper - xlower) / d) + 8
        my = int((yupper - ylower) / d) + 8
        
        xlower = xlower - d*4.0
        ylower = ylower - d*4.0
        xupper = xupper + d*4.0
        yupper = yupper + d*4.0

        step = lambda x,y: setrun.bathy_step(x, y, location=self.bathy_location,
                                            angle=self.bathy_angle)
        
        tt.topo2writer('./topo.tt2', step, xlower, xupper, ylower, yupper, 
                                     mx, my, nodata_value=-99999)

        # Write out simple bathy geometry file for communication to the plotting
        with open("./bathy_geometry.data", 'w') as bathy_geometry_file:
            bathy_geometry_file.write("%s\n%s" % (self.bathy_location,
                                                  self.bathy_angle) )
Esempio n. 3
0
def write_topo_file(run_data, out_file, **kwargs):
    
    # Write out bathy file
    mx = run_data.clawdata.num_cells[0]
    my = run_data.clawdata.num_cells[1]
    xlower = run_data.clawdata.lower[0]
    xupper = run_data.clawdata.upper[0]
    ylower = run_data.clawdata.lower[1]
    yupper = run_data.clawdata.upper[1]
    dx = (xupper - xlower) / mx
    dy = (yupper - ylower) / my
    d = min(dx,dy)
    mx = int((xupper - xlower) / d) + 8
    my = int((yupper - ylower) / d) + 8
    
    xlower = xlower - d*4.0
    ylower = ylower - d*4.0
    xupper = xupper + d*4.0
    yupper = yupper + d*4.0

    step = lambda x,y: bathy_step(x, y, **kwargs)
    
    tt.topo2writer(out_file, step, xlower, xupper, ylower, yupper, mx, my, nodata_value=-99999)

    # Write out simple bathy geometry file for communication to the plotting
    with open("./bathy_geometry.data", 'w') as bathy_geometry_file:
        if kwargs.has_key("location"):
            location = kwargs['location']
        else:
            location = 0.15
        if kwargs.has_key("angle"):
            angle = kwargs['angle']
        else:
            angle = 0.0
        bathy_geometry_file.write("%s\n%s" % (location, angle) )
Esempio n. 4
0
def maketopo1b(path):
    """
    Output topography file for the entire domain
    """
    nxpoints = 101
    nypoints = 71
    xlower = 0.0
    xupper = 1.0
    ylower = 0.5
    yupper = 1.2
    topotools.topo2writer(path, topo1, xlower, xupper, ylower, yupper, nxpoints, nypoints)
Esempio n. 5
0
def maketopo_flat():
    """
    Output topography file for the entire domain
    """
    nxpoints = 201
    nypoints = 301
    xlower = 204.812
    xupper = 205.012
    ylower = 19.7
    yupper = 20.0
    outfile= "flat.tt2"     
    topotools.topo2writer(outfile,topo_flat,xlower,xupper,ylower,yupper,nxpoints,nypoints)
Esempio n. 6
0
def maketopo1a(path):
    """
    Output topography file for the entire domain
    """

    nxpoints = 101
    nypoints = 76
    xlower = -1.5
    xupper = 2.5
    ylower = -1.0
    yupper = 2.0
    topotools.topo2writer(path, topo1, xlower, xupper, ylower, yupper, nxpoints, nypoints)
Esempio n. 7
0
def maketopo1b(path):
    """
    Output topography file for the entire domain
    """
    nxpoints = 101
    nypoints = 71
    xlower = 0.0
    xupper = 1.0
    ylower = 0.5
    yupper = 1.2
    topotools.topo2writer(path,topo1,xlower,xupper,ylower,yupper,\
                          nxpoints,nypoints)
Esempio n. 8
0
def maketopo():
    """
    Output topography file for the entire domain
    """
    nxpoints = 1001
    nypoints = 21
    xlower = -50.e0
    xupper =  50.e0
    yupper =  1.e0
    ylower = -1.e0
    outfile= "tank.tt2"     
    topotools.topo2writer(outfile,topo,xlower,xupper,ylower,yupper,nxpoints,nypoints)
Esempio n. 9
0
def maketopo():
    """
    Output topography file for the entire domain
    """
    nxpoints = 2001
    nypoints = 2001
    xlower = 0
    xupper = 200000.e0
    yupper = 200000.e0
    ylower = 0
    outfile= "bowl.topotype2"     
    topotools.topo2writer(outfile,topo,xlower,xupper,ylower,yupper,nxpoints,nypoints)
Esempio n. 10
0
def maketopo_flat():
    """
    Output topography file for the entire domain
    """
    nxpoints = 201
    nypoints = 301
    xlower = 204.812
    xupper = 205.012
    ylower = 19.7
    yupper = 20.0
    outfile = "flat.tt2"
    topotools.topo2writer(outfile, topo_flat, xlower, xupper, ylower, yupper,
                          nxpoints, nypoints)
Esempio n. 11
0
def maketopo():
    """
    Output topography file for the entire domain
    """
    nxpoints = 101
    nypoints = 101
    xlower = -100.e0
    xupper = 100.e0
    yupper = 100.e0
    ylower = -100.e0
    outfile = "bowl.topotype2"
    topotools.topo2writer(outfile, topo, xlower, xupper, ylower, yupper,
                          nxpoints, nypoints)
Esempio n. 12
0
def maketopo1a(path):
    """
    Output topography file for the entire domain
    """

    nxpoints = 101
    nypoints = 76
    xlower = -1.5
    xupper = 2.5
    ylower = -1.
    yupper = 2.
    topotools.topo2writer(path,topo1,xlower,xupper,ylower,yupper,\
                          nxpoints,nypoints)
Esempio n. 13
0
def maketopo():
    """
    Output topography file for the entire domain
    """
    nxpoints = 1001
    nypoints = 21
    xlower = -50.e0
    xupper = 50.e0
    yupper = 1.e0
    ylower = -1.e0
    outfile = "tank.tt2"
    topotools.topo2writer(outfile, topo, xlower, xupper, ylower, yupper,
                          nxpoints, nypoints)
Esempio n. 14
0
def maketopo():
    """
    Output topography file for the entire domain
    """
    nxpoints=201
    nypoints=201
    xlower = -10e0
    xupper= 10e0
    ylower = -10e0
    yupper= 10e0
    outfile= "topo1.topotype2"
    topo2writer(outfile,topo,xlower,xupper,ylower,yupper,nxpoints,nypoints)
    dx = (xupper-xlower)/(nxpoints-1)
    dy = (yupper-ylower)/(nypoints-1)
    print "==> topo1 has dx = %g, dy = %g" % (dx,dy)
Esempio n. 15
0
def maketopo2():
    """
    Another topo file for testing
    """
    nxpoints=21
    nypoints=51
    xlower = -0.5
    xupper= -0.3
    ylower = -0.1
    yupper= 0.4
    outfile= "topo2.topotype2"
    topo2writer(outfile,topo2,xlower,xupper,ylower,yupper,nxpoints,nypoints)
    dx = (xupper-xlower)/(nxpoints-1)
    dy = (yupper-ylower)/(nypoints-1)
    print "==> topo2 has dx = %g, dy = %g" % (dx,dy)
Esempio n. 16
0
def maketopo():
    """
    Output topography file for the entire domain
    """
    nxpoints=200
    nypoints=200
    xupper=2.e0
    yupper=2.e0
    xlower = -2.e0
    ylower = -2.e0
    outfile= "bowl.topotype2"
    topo2writer(outfile,topo,xlower,xupper,ylower,yupper,nxpoints,nypoints)

    # convert to netcdf form:
    topo4 = topotools.Topography()
    topo4.read(outfile,2)
    topo4.write("bowl.nc",topo_type=4)
Esempio n. 17
0
def maketopo():
    """
    Output topography file for the entire domain
    """
    nxpoints=200
    nypoints=200
    xupper=2.e0
    yupper=2.e0
    xlower = -2.e0
    ylower = -2.e0
    outfile= "bowl.topotype2"
    topo2writer(outfile,topo,xlower,xupper,ylower,yupper,nxpoints,nypoints)

    # convert to netcdf form:
    topo4 = topotools.Topography()
    topo4.read(outfile,2)
    topo4.write("bowl.nc",topo_type=4)
Esempio n. 18
0
def write_topo_file(run_data, out_file, **kwargs):

    # Write out bathy file
    mx = run_data.clawdata.num_cells[0]
    my = run_data.clawdata.num_cells[1]
    xlower = run_data.clawdata.lower[0]
    xupper = run_data.clawdata.upper[0]
    ylower = run_data.clawdata.lower[1]
    yupper = run_data.clawdata.upper[1]
    dx = (xupper - xlower) / mx
    dy = (yupper - ylower) / my
    d = min(dx, dy)
    mx = int((xupper - xlower) / d) + 8
    my = int((yupper - ylower) / d) + 8

    xlower = xlower - d * 4.0
    ylower = ylower - d * 4.0
    xupper = xupper + d * 4.0
    yupper = yupper + d * 4.0

    step = lambda x, y: bathy_step(x, y, **kwargs)

    tt.topo2writer(out_file,
                   step,
                   xlower,
                   xupper,
                   ylower,
                   yupper,
                   mx,
                   my,
                   nodata_value=-99999)

    # Write out simple bathy geometry file for communication to the plotting
    with open("./bathy_geometry.data", 'w') as bathy_geometry_file:
        if kwargs.has_key("location"):
            location = kwargs['location']
        else:
            location = 0.15
        if kwargs.has_key("angle"):
            angle = kwargs['angle']
        else:
            angle = 0.0
        bathy_geometry_file.write("%s\n%s" % (location, angle))
Esempio n. 19
0
def maketopo():
    """
    Output topography file for the entire domain
    and near-shore in one location.
    """
    nxpoints = 400
    nypoints = 400
    xlower = -30.e0
    xupper = 30.e0
    ylower = 20.e0
    yupper = 60.e0
    outfile = "ocean.topotype2"
    topotools.topo2writer(outfile, topo, xlower, xupper, ylower, yupper,
                          nxpoints, nypoints)

    nxpoints = 200
    nypoints = 200
    xlower = xisland - 1.
    xupper = xisland + 1.
    ylower = yisland - 1.
    yupper = yisland + 1.
    outfile = "island.topotype2"
    topotools.topo2writer(outfile, topo, xlower, xupper, ylower, yupper,
                          nxpoints, nypoints)