Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
python
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Tom Rink
python
Commits
4cfe6867
Commit
4cfe6867
authored
3 years ago
by
tomrink
Browse files
Options
Downloads
Patches
Plain Diff
minor
parent
d8ff6113
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/amv/aeolus.py
+53
-53
53 additions, 53 deletions
modules/amv/aeolus.py
with
53 additions
and
53 deletions
modules/amv/aeolus.py
+
53
−
53
View file @
4cfe6867
...
...
@@ -32,59 +32,59 @@ num_elems = 5424
num_lines
=
5424
def
time_dict_to_cld_layers
(
time_dict
):
time_dict_layers
=
{}
keys
=
list
(
time_dict
.
keys
())
for
key
in
keys
:
prof_s
=
time_dict
[
key
]
layers
=
[]
prof
=
prof_s
[
0
]
if
len
(
prof
)
==
1
:
tup
=
prof
[
0
]
layers
.
append
((
tup
[
0
],
tup
[
1
],
tup
[
3
],
tup
[
4
]))
time_dict_layers
[
key
]
=
layers
continue
top
=
-
9999.9
last_bot
=
-
9999.9
tup
=
None
for
i
in
range
(
len
(
prof
)):
tup
=
prof
[
i
]
if
i
==
0
:
top
=
tup
[
3
]
bot
=
tup
[
4
]
last_bot
=
bot
else
:
if
math
.
fabs
(
last_bot
-
tup
[
3
])
>
10.0
:
layers
.
append
((
tup
[
0
],
tup
[
1
],
top
,
last_bot
))
top
=
tup
[
3
]
last_bot
=
tup
[
4
]
layers
.
append
((
tup
[
0
],
tup
[
1
],
top
,
tup
[
4
]))
time_dict_layers
[
key
]
=
layers
return
time_dict_layers
def
time_dict_to_nd_2
(
time_dict
):
keys
=
list
(
time_dict
.
keys
())
for
key
in
keys
:
vals
=
time_dict
[
key
]
if
vals
is
not
None
:
time_dict
[
key
]
=
np
.
stack
(
vals
)
return
time_dict
def
get_cloud_layers_dict
(
filename
,
lon360
=
False
):
a_d
=
get_aeolus_time_dict
(
filename
,
lon360
=
lon360
)
c_d
=
time_dict_to_cld_layers
(
a_d
)
cld_lyr_dct
=
time_dict_to_nd_2
(
c_d
)
return
cld_lyr_dct
#
def time_dict_to_cld_layers(time_dict):
#
time_dict_layers = {}
#
#
keys = list(time_dict.keys())
#
for key in keys:
#
prof_s = time_dict[key]
#
layers = []
#
prof = prof_s[0]
#
#
if len(prof) == 1:
#
tup = prof[0]
#
layers.append((tup[0], tup[1], tup[3], tup[4]))
#
time_dict_layers[key] = layers
#
continue
#
#
top = -9999.9
#
last_bot = -9999.9
#
tup = None
#
for i in range(len(prof)):
#
tup = prof[i]
#
#
if i == 0:
#
top = tup[3]
#
bot = tup[4]
#
last_bot = bot
#
else:
#
if math.fabs(last_bot - tup[3]) > 10.0:
#
layers.append((tup[0], tup[1], top, last_bot))
#
top = tup[3]
#
last_bot = tup[4]
#
#
layers.append((tup[0], tup[1], top, tup[4]))
#
#
time_dict_layers[key] = layers
#
#
return time_dict_layers
#
#
#
def time_dict_to_nd_2(time_dict):
#
keys = list(time_dict.keys())
#
for key in keys:
#
vals = time_dict[key]
#
if vals is not None:
#
time_dict[key] = np.stack(vals)
#
#
return time_dict
#
#
#
def get_cloud_layers_dict(filename, lon360=False):
#
a_d = get_aeolus_time_dict(filename, lon360=lon360)
#
c_d = time_dict_to_cld_layers(a_d)
#
cld_lyr_dct = time_dict_to_nd_2(c_d)
#
return cld_lyr_dct
def
compare_aeolus_max_height
(
aeolus_dict
,
files_path
,
grid_value_name
=
'
cld_height_acha
'
,
one_cld_layer_only
=
False
,
highest_layer
=
False
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment