Пример #1
0
    def test_build_urs_boundary(self):

        mux_event_file = self.write_mux_file()

        # Write a test urs order file
        f = tempfile.NamedTemporaryFile(suffix=".txt", prefix="test_build_urs_boundary", delete=False)
        f.write("index,longitude,latitude\n")
        f.write("18,115.620000,-8.500000\n")
        f.write("17,115.644000,-8.467730\n")
        f.write("16,115.678000,-8.444940\n")
        f.write("15,115.703000,-8.416670\n")
        f.close()
        urs_order_file = f.name

        # Get a sts output file
        f = tempfile.NamedTemporaryFile(suffix=".sts", prefix="test_build_urs_boundary", delete=False)
        f.close()
        sts_outputfile = f.name

        multimux_test_dir = os.path.join(".", "muxfiles_test")
        mux_data_folder = os.path.join(multimux_test_dir, "muxfiles")

        build_urs_boundary.build_urs_boundary(mux_event_file, sts_outputfile, urs_order_file, mux_data_folder)

        # Results should be tested.
        # To do this though the answer has to be known

        os.remove(mux_event_file)
        os.remove(urs_order_file)
        os.remove(sts_outputfile)
Пример #2
0
def run_build(log_filename, ScenarioName, GenSaveDir, AppLongName,
              MuxDirectory, EventFile, selected_events):
    """Run build_urs_boundary.py for each selected event.

    log_filename     path to the log file to generate/monitor
    ScenarioName     the scenario name
    GenSaveDir       path to the generated data save directory
    AppLongName      the application long form string
    MuxDirectory     path to the MUX directory
    EventFile        path to the event file
    selected_events  a list of event IDs (strings)
    """

    global LogFilename

    LogFilename = log_filename

    # now run build_urs_boundary for each event ID
    for event_id in selected_events:
        log('Handling event ID %d' % event_id)

        # get paths
        event_folder = os.path.join(GenSaveDir, ScenarioName,
                                    'boundaries', str(event_id))

        # now run the build
        import build_urs_boundary as bub

        log('Running build_urs_boundary() for event %d' % event_id)
        bub.log = log
        bub.build_urs_boundary(EventFile,
                               os.path.join(event_folder, ScenarioName),
                               True, event_folder, MuxDirectory,
                               '../boundaries/urs_order.csv', ScenarioName)

        del bub

    log('Generation is finished')
    log('*' * 80)
    log('*' * 80)
Пример #3
0
        verbose=True)

    #-------------------------------------------------------------------------------
    # Create the computational domain based on overall clipping polygon with
    # a tagged boundary and interior regions defined in project.py along with
    # resolutions (maximal area of per triangle) for each polygon
    #-------------------------------------------------------------------------------

    log.critical('Create computational domain')

    # Create the STS file
    # FIXME (Ole): This is deadly dangerous if buildcode changes (as was the case 24th March 2009)
    # We need to use caching instead!
    log.critical('project.mux_data_folder=%s' % project.mux_data_folder)
    if not os.path.exists(project.event_sts + '.sts'):
        bub.build_urs_boundary(project.mux_input_filename, project.event_sts)
else:
    print 'Hello from processor ', myid

barrier()

# Read in boundary from ordered sts file
event_sts = anuga.create_sts_boundary(project.event_sts)

# Reading the landward defined points, this incorporates the original clipping
# polygon minus the 100m contour
landward_boundary = anuga.read_polygon(project.landward_boundary)

# Combine sts polyline with landward points
bounding_polygon_sts = event_sts + landward_boundary
Пример #4
0
# written by NANKAI on Fri Mar 26 09:07:32 2010

print('JUST BEFORE bub.build_urs_boundary()')
import build_urs_boundary as bub

bub.build_urs_boundary(event.lst, os.path.join(/home/r-w/xyzzy/test/boundaries/58298, test))
Пример #5
0

    #-------------------------------------------------------------------------------
    # Create the computational domain based on overall clipping polygon with
    # a tagged boundary and interior regions defined in project.py along with
    # resolutions (maximal area of per triangle) for each polygon
    #-------------------------------------------------------------------------------

    log.critical('Create computational domain')

    # Create the STS file
    # FIXME (Ole): This is deadly dangerous if buildcode changes (as was the case 24th March 2009)
    # We need to use caching instead!
    log.critical( 'project.mux_data_folder=%s' % project.mux_data_folder)
    if not os.path.exists(project.event_sts + '.sts'):
        bub.build_urs_boundary(project.mux_input_filename, project.event_sts)
else:
    print 'Hello from processor ', myid

barrier()
    

# Read in boundary from ordered sts file
event_sts = anuga.create_sts_boundary(project.event_sts)

# Reading the landward defined points, this incorporates the original clipping
# polygon minus the 100m contour
landward_boundary = anuga.read_polygon(project.landward_boundary)

# Combine sts polyline with landward points
bounding_polygon_sts = event_sts + landward_boundary