Opened 18 years ago

Closed 17 years ago

#151 closed enhancement (fixed)

incorporate the get_timeseries.py script into anuga source

Reported by: nick Owned by: nick and jane
Priority: low Milestone:
Component: Efficiency and optimisation Version: 1.0
Severity: minor Keywords:
Cc:

Description

This is similar to ticket 150,

I believe this can plot multiple timeseries from different swws in one png file. I found this a bit tricky to understand, ask me and i will tell you what i know.

it could also do with a bit of cleaning up and refactoring

and maybe renaming


""" Generate images of "gauges" for production run

Inputs:

production dirs: dictionary of production directories with a

association to that simulation run, eg high tide, low tide and MSL.

Outputs:

  • figures used for report stored in the report_figure directory

""" from os import getcwd, sep, altsep, mkdir, access, F_OK import project from anuga.abstract_2d_finite_volumes.util import sww2timeseries

# Create report directory reportdir = getcwd()+sep+'report'+sep if access(reportdir,F_OK) == 0:

mkdir (reportdir)

# sww file created from URS boundary production_dirs = {#'boundaries': '10000 yr wave height'

'20070418_035124_run': 'URS boundary normal' }

is_parallel = False if is_parallel == True:

nodes = 8

# Generate figures swwfiles = {}

#J:\inundation\data\western_australia\onslow_tsunami_scenario_2006\anuga\boundaries SU-AU_high_res1.sww

#boundary_dir_filename= os.path.join(home,data,state,'onslow_tsunami_scenario_2006',an,bo,'SU-AU_high_res1.sww') #gauges_dir_name_simple = if is_parallel is True:

print 'bugger'

for i in range(nodes):

print 'Sending node %d of %d' %(i,nodes) swwfiles = {} #reportname = report_name + '_%s' %(i) for label_id in production_dirs.keys():

if label_id == 'boundaries':

# file_loc = project.boundaries_in_dir

swwfile = best_boundary_sww print 'hi'

else:

file_loc = project.output_dir + label_id + sep sww_extra = '_P%s_%s' %(i,nodes) swwfile = file_loc + project.scenario_name + sww_extra + '.sww' print 'swwfile',swwfile

swwfiles[swwfile] = label_id

texname, elev_output = sww2timeseries(swwfiles,

project.gauges_dir_name_simple, production_dirs, report = False, #reportname = reportname, plot_quantity = ['stage', 'momentum'], generate_fig = False, surface = False, time_min = None, time_max = None, title_on = False, verbose = True)

#latex_output.append(texname)

else:

for label_id in production_dirs.keys():

if label_id == 'boundaries':

print 'boundaries' file_loc = project.boundaries_in_dir swwfile = project.boundaries_dir_name3 + '.sww'

# swwfile = boundary_dir_filename

else:

file_loc = project.output_dir + label_id + sep swwfile = file_loc + project.scenario_name + '.sww'

swwfiles[swwfile] = label_id

texname, elev_output = sww2timeseries(swwfiles,

project.gauges_dir_name,

# project.gauges_dir_name_simple,

production_dirs, report = False, #reportname = report_name,

# plot_quantity = ['stage', 'momentum'],

plot_quantity = ['stage', 'xmomentum', 'ymomentum'], surface = False, time_min = None, time_max = None, title_on = False, verbose = True)


Change History (5)

comment:1 Changed 18 years ago by Duncan <duncan@…>

  • Priority changed from normal to low

comment:2 Changed 17 years ago by anonymous

  • Type changed from defect to enhancement

comment:3 Changed 17 years ago by nick

duncan, can you contact jane about this

comment:4 Changed 17 years ago by duncan

  • Owner changed from duncan to nick and jane

I've turned this script into a function and checked it into data_manager, as get_timeseries. There's an example of it being used in dampier_2006/get_timeseries_redone.py. Check it out, test it and see what you think.

comment:5 Changed 17 years ago by anonymous

  • Resolution set to fixed
  • Status changed from new to closed

see sww2csv_gauges and csv2timeseries_graphs in abstract_2d_finite_volumes\util.py

Note: See TracTickets for help on using tickets.