/[escript]/trunk/doc/examples/inversion/gravity/gravity_netcdf.py
ViewVC logotype

Contents of /trunk/doc/examples/inversion/gravity/gravity_netcdf.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4187 - (show annotations)
Mon Feb 11 01:05:10 2013 UTC (6 years, 7 months ago) by azadeh
File MIME type: text/x-python
File size: 1893 byte(s)
adding gravity magnetic and joint inversion files in netcdf format 

1
2 ##############################################################################
3 #
4 # Copyright (c) 2009-2013 by University of Queensland
5 # http://www.uq.edu.au
6 #
7 # Primary Business: Queensland, Australia
8 # Licensed under the Open Software License version 3.0
9 # http://www.opensource.org/licenses/osl-3.0.php
10 #
11 # Development until 2012 by Earth Systems Science Computational Center (ESSCC)
12 # Development since 2012 by School of Earth Sciences
13 #
14 ##############################################################################
15
16 """3D gravity inversion example using netCDF data"""
17
18 __copyright__="""Copyright (c) 2009-2013 by University of Queensland
19 http://www.uq.edu.au
20 Primary Business: Queensland, Australia"""
21 __license__="""Licensed under the Open Software License version 3.0
22 http://www.opensource.org/licenses/osl-3.0.php"""
23 __url__="https://launchpad.net/escript-finley"
24
25 # Import required modules
26 from esys.downunder import *
27 from esys.escript import unitsSI as U
28 from esys.weipa import saveSilo
29
30 # Set parameters
31 DATASET = 'QLD_west.nc'
32 PAD_X = 0.2
33 PAD_Y = 0.2
34 thickness = 40. * U.km
35 l_air = 6. * U.km
36 n_cells_v = 25
37 mu = 10.
38
39 # Setup and run the inversion
40 source=NetCdfData(NetCdfData.GRAVITY, DATASET)
41 db=DomainBuilder(dim=3)
42 db.addSource(source)
43 db.setVerticalExtents(depth=thickness, air_layer=l_air, num_cells=n_cells_v)
44 db.setFractionalPadding(pad_x=PAD_X, pad_y=PAD_Y)
45 db.fixDensityBelow(depth=thickness)
46
47 inv=GravityInversion()
48 inv.setSolverTolerance(1e-4)
49 inv.setSolverMaxIterations(50)
50 inv.setup(db)
51 inv.getCostFunction().setTradeOffFactorsModels(mu)
52
53 print("Starting inversion, please stand by...")
54 density = inv.run()
55 print("density = %s"%density)
56
57 # Save results
58 g, w = inv.getCostFunction().getForwardModel().getSurvey(0)
59 saveSilo("result_gravity.silo", density=density, gravity_anomaly=g[2], gravity_weight=w[2])
60 print("Results saved in result_gravity.silo. Good bye.")
61

  ViewVC Help
Powered by ViewVC 1.1.26