Exemplo n.º 1
0
def get_timeseries():
    """Get time series data."""

    name = os.path.join(project.output_folder, project.scenario_name+'.sww')
    log.debug('get_timeseries: input SWW file=%s' % name)
    log.debug('get_timeseries: gauge file=%s' % project.gauges)
    anuga.sww2csv_gauges(name, project.gauges, quantities=project.layers_list,
                         verbose=False)
Exemplo n.º 2
0
def get_timeseries():
    """Get time series data"

    Returns a list of generated files.
    """

    # generate the result files
    name = os.path.join(project.output_folder, project.scenario+'.sww')
    log.debug('get_timeseries: input SWW file=%s' % name)
    log.debug('get_timeseries: gauge file=%s' % project.gauge_file)
    anuga.sww2csv_gauges(name, project.gauge_file, quantities=project.layers_list,
                         verbose=False)

    # since ANUGA code doesn't return a list of generated files,
    # look in output directory for 'gauge_*.csv' files.
    glob_mask = os.path.join(project.output_folder, 'gauge_*.csv')
    return glob.glob(glob_mask)
Exemplo n.º 3
0
def get_timeseries():
    """Get time series data"

    Returns a list of generated files.
    """

    # check contents of project.gauge_file, if empty, do nothing
    with open(project.gauge_file, 'r') as fd:
        lines = fd.readlines()
    if len(lines) < 2:
        log.info('get_timeseries: Nothing to do')
        return []

    # generate the result files
    name = os.path.join(project.output_folder, project.scenario+'.sww')
    log.debug('get_timeseries: input SWW file=%s' % name)
    log.debug('get_timeseries: gauge file=%s' % project.gauge_file)
    anuga.sww2csv_gauges(name, project.gauge_file,
                         quantities=['stage'], verbose=False)

    # since ANUGA code doesn't return a list of generated files,
    # look in output directory for 'gauge_*.csv' files.
    glob_mask = os.path.join(project.output_folder, 'gauge_*.csv')
    return glob.glob(glob_mask)
Exemplo n.º 4
0
"""
Generate time series of nominated "gauges" read from project.gauge_filename. This 
is done by first running sww2csv_gauges on two different directories to make 
'csv' files. Then running csv2timeseries_graphs detailing the two directories 
containing the csv file and produces one set of graphs in the 'output_dir' containing
the details at the gauges for both these sww files.

Note, this script will only work if pylab is installed on the platform
"""

from os import sep
import project
import anuga

anuga.sww2csv_gauges('cairns_slide.sww',
                project.gauge_filename,
                quantities=['stage','speed','depth','elevation'],
                verbose=True)
                
anuga.sww2csv_gauges('cairns_fixed_wave.sww',
               project.gauge_filename,
               quantities=['stage', 'speed','depth','elevation'],
               verbose=True)

try: 
    import pylab
    anuga.csv2timeseries_graphs(directories_dic={'slide'+sep: ['Slide',0, 0],
                                           'fixed_wave'+sep: ['Fixed Wave',0,0]},
                          output_dir='fixed_wave'+sep,
                          base_name='gauge_',
                          plot_numbers='',
                          quantities=['stage','speed','depth'],
Exemplo n.º 5
0
    gauge_writer.writerow([xi + X0 + 0.4 * sigmaG, yi * 1.4, 'p3', 0.])
    gauge_writer.writerow([xi + X0 + 0.4 * sigmaG, yi * 1.6, 'p4', 0.])
    gauge_writer.writerow([xi + X0 + 0.4 * sigmaG, yi * 1.8, 'p5', 0.])
    gauge_writer.writerow([xi + X0 + 0.4 * sigmaG, yi * 1.9, 'p6', 0.])
    gauge_writer.writerow([xi + X0 + 0.4 * sigmaG, yi * 1.98, 'p7', 0.])

    gaugefile.close()
# ------------------------------------------------------------------------------
###STEP-5 Generate Gauge Files
# ------------------------------------------------------------------------------

if p_stepGaugeChart:
    os.chdir(prj_output_dir)
    anuga.sww2csv_gauges(prj_output_dir + os.sep + sww_file,
                         prj_output_dir + os.sep + gauge_file,
                         domain_name + '_gauge_',
                         quantities=['stage', 'speed', 'elevation'],
                         verbose=True)

    import pylab

    anuga.csv2timeseries_graphs(directories_dic={prj_output_dir + os.sep: [r'', 0, 0]},
                                output_dir=prj_output_dir + os.sep + 'gauges' + os.sep,
                                base_name=domain_name + '_gauge_',
                                plot_numbers='',
                                quantities=['stage', 'speed', 'elevation'],
                                extra_plot_name='',
                                assess_all_csv_files=True,
                                create_latex=False,
                                verbose=True)