source: production/karratha_2005/run_karratha.py @ 1801

Last change on this file since 1801 was 1801, checked in by ole, 19 years ago
File size: 2.3 KB
Line 
1"""Convert from Arcview ASCII DEMs via native netcdf dem format
2to native pts netcdf format for use with least_squares fits
3"""
4
5import os
6import time
7
8
9from pyvolution.shallow_water import Domain, Reflective_boundary, File_boundary
10from pyvolution.data_manager import convert_dem_from_ascii2netcdf,\
11     dem2pts, ferret2sww
12from pyvolution.pmesh2domain import pmesh_to_domain_instance
13from caching import cache
14import project
15
16#Data preparation
17#Convert ASC 2 DEM 2 PTS using source data and store result in source data
18demname = project.demname
19
20cache(convert_dem_from_ascii2netcdf, demname, {'verbose': True},
21      dependencies = [demname + '.asc'],
22      verbose = True)
23      #evaluate = True)
24
25cache(dem2pts, demname, {'verbose': True},
26      dependencies = [demname + '.dem'],     
27      verbose = True)
28
29
30#Convert MOST boundary
31source_dir = project.boundarydir
32
33
34#Data
35from pyvolution.data_manager import ferret2sww
36
37
38south = project.south
39north = project.north
40west = project.west
41east = project.east
42
43#Origin of existing dem (FIXME: Temporary measure)
44mesh_origin = (50, 421544.35127423, 7677669.5257159)
45
46ferret2sww(source_dir+project.boundary_basename,
47           project.boundary_basename, 
48           verbose=True,
49           minlat=south-1, maxlat=north+1,
50           minlon=west-1, maxlon=east+1,
51           origin = mesh_origin,
52           zscale = 1,
53           fail_on_NaN = False,
54           inverted_bathymetry = True),
55
56
57
58#Setup domain
59mesh = project.meshname + '.msh'
60domain = cache(pmesh_to_domain_instance, (mesh, Domain),
61               dependencies = [mesh],                     
62               verbose = True)               
63
64
65domain.set_name(project.basename)
66domain.set_datadir(project.outputdir)
67domain.store = True
68
69print "Number of triangles = ", len(domain)
70print 'The extent is ', domain.get_extent()
71
72
73#Setup IC
74domain.set_quantity('stage', 0)
75domain.set_quantity('elevation',
76                    filename = demname + '.pts',
77                    use_cache = True,
78                    verbose = True)
79
80#Setup BC
81Bf = File_boundary(project.boundary_basename + '.sww', domain, verbose = True)
82
83Br = Reflective_boundary(domain)
84domain.set_boundary( {'wall': Br} )
85
86
87#Run
88for t in domain.evolve(yieldstep = 1, finaltime = 100):
89    domain.write_time()
Note: See TracBrowser for help on using the repository browser.