-
Notifications
You must be signed in to change notification settings - Fork 1
/
getInversionData.py
executable file
·62 lines (57 loc) · 1.84 KB
/
getInversionData.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Aug 14 09:10:16 2020
@author: ian
"""
import modelfunc as mf
def getInversionData(inversionCheckpointFile, Q, V, mesh=None):
'''
Read an inversion results file and return
betaInv, thetaInv, Ainv, sInv, hInv, zbInv, floatingInv,
groundedInv, uInv, uObsInv
Parameters
----------
inversionCheckpointFile : str
Check point filename WITHOUT .h5 suffix
Q : firedrake function space
modal scalar function space.
V : firedrake function space
model vector function space.
mesh: Mesh for new checkpoint function
chk: Echo data to chk file
Returns
-------
betaInv: firedrake
Beta solution from inversion
thetaInv: firedrake
Theta solution from inversion
Ainv: firedrake
Initial A used in inversion
sInv: firedrake
Elevation used in inversion
hInv: firedrake
Thickness used in inversion
zbInv: firedrake
Bed elevation used in version
floatingInv:
floating masking used in inversion
groundedInv: firedrake
grounded mask used in inversion
uInv: firedrake
velocity solution from inversion
uObsInv: firedrake
observed velocity used to constrain inversion
'''
#
inversionData = ['betaInv', 'thetaInv', 'AInv', 'sInv', 'hInv', 'zbInv',
'floatingInv', 'groundedInv']
myVars = mf.getCheckPointVars(inversionCheckpointFile, inversionData, Q, mesh=mesh)
myList = [myVars[myVar] for myVar in inversionData]
vels = mf.getCheckPointVars(inversionCheckpointFile, ['uInv', 'uObsInv'],
V, mesh=mesh)
myList += [vels['uInv'], vels['uObsInv']]
#
# betaInv, thetaInv, Ainv, sInv, hInv, zbInv, floatingInv,
# groundedInv, uInv, uObsInv
return myList[:]