forked from wterwey/SPOUT
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathglobalVariables.py
114 lines (105 loc) · 4.6 KB
/
globalVariables.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
import math
import numpy as np
global modelParams, TrackerParams, modelData
#----------------------------------------------------------------------
# Set up common arrays and constants.
#----------------------------------------------------------------------
modelParams = {}
modelParams['INPUTROOT'] = '/raid60/raid/home/srvx7/lehre/users/a1254888/VSC/OSSE_v1.10_LMU+shear/1/'
modelParams['OUTPUTROOT'] = '/raid60/raid/home/srvx7/lehre/users/a1254888/osse_analysis/output/SPOUT'
modelParams['g'] = 9.8
#----------------------------------------------------------------------
# Establish updraft arrays and parameters.
#
# BADVALUE is a tracking value that can be used for checking. Choose
# a value that NONE of your potential tracked variables could EVER
# take on.
#
# NVAR is the number of variables being tracked. This needs to be a
# number greater than or equal to 5. The first five variables tracked
# are X-position (0), Y-position (1), U-environment (2), V-environment
# (3), and W-insitu (4). Any and all other variables can be modified
# by the user in the appropriate section of code.
#
# MAXUP is the maximum number of updrafts that can be tracked at
# once.
#
# WTHRES is a threshold value for checking by how much a local maximum
# must exceed its neighbors.
#
# MINUPHEIGHT is a value stating the minimum updraft height to be
# considered (in vertical gridpoints).
#
# NUMLEVELS states through how many vertical gridpoints the code will
# be searching for updrafts. It is advisable to count the number of
# gridpoints between the boundary layer and the tropopause and use a
# number close to this.
#
# SPACETHRES is the spatial threshold (in horizontal gridpoints) that
# must be satisfied for the vertical linking of updrafts. This is
# used for both horizontal dimensions independently, not as a total
# distance.
#
# RANKTHRES is the spatial threshold (in horizontal gridpoint
# distance) that must be satisfied for the temporal linking of
# updrafts. Using the previous time step's environmental U and
# V winds (and the velFudge factor), a prior updraft is "advected" to
# a new point. For it to be (potentially) temporally linked, it must
# be within RANKTHRES distance of this advected point.
#
# POINTTHRES is the vertial spatial threshold that must be satisfied
# for the temporal linking of updrafts. Prior and current updrafts
# must have a number of updraft levels within POINTTHRES number of
# vertical points to be temporally linked.
#
# OUTPUTTIMETHRES is a threshold value for the minimum number of time
# steps that a tracked updraft must be to be output to the final data
# file.
#
# velCorrect is the correction factor for the advective process in ranking
# potential temporal linking. This was included since it is
# well-known that thunderstorms can often move at fractions of the
# imposed advective velocities.
#
# checkLevels is the array that states which set of consecutive levels
# (in vertical gridpoint space) are being checked.
#
# checkValues is the array that states what the minimal vertical
# velocity is for each level's maxima to be qualified for
# updraft status.
#
# updraftData is the actual array that tracks the information for the
# updrafts currently being tracked. It is a 4-D array:
# 1.) ID of the variable being tracked
# 2.) ID number of the updraft
# 3.) Vertical profile of each updraft
# 4.) Time for each updraft.
# This array is filled usually with BADVALUE.
#
# SKIPFRAMES is the integer number of time frames to skip in order to speed up
# calculating
#----------------------------------------------------------------------
TrackerParams = {}
TrackerParams['BADVALUE'] = -999.9
TrackerParams['WTHRES'] = 0.0
TrackerParams['MINUPLEVEL'] = 4
TrackerParams['MINUPHEIGHT'] = 4 # TODO: whats the difference to MINUPLEVEL
TrackerParams['NUMLEVELS'] = 20
TrackerParams['SPACETHRES'] = 2
TrackerParams['RANKTHRES'] = 5.0
TrackerParams['POINTTHRES'] = 6
TrackerParams['OUTPUTTIMETHRES'] = 3
TrackerParams['velCorrect'] = 1.0
TrackerParams['SKIPFRAMES'] = 48
tempar = np.zeros(TrackerParams['NUMLEVELS']) + TrackerParams['MINUPLEVEL']
TrackerParams['checkLevels'] = tempar.astype(np.int32) # integer for indexing
tempar = np.zeros(TrackerParams['NUMLEVELS'], np.float32) + 1.5
TrackerParams['checkValues'] = tempar
updraftData = []
#######################################################################
#----------------------------------------------------------------------
# Set up data array dictionary
#
# This dictionary will be populated by the modelReadIn modules.
#----------------------------------------------------------------------
modelData = {}