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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Tom Rink
python
Commits
a126d6de
Commit
a126d6de
authored
Dec 21, 2020
by
tomrink
Browse files
Options
Downloads
Patches
Plain Diff
snapshot...
parent
c96b3fe6
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/aeolus/aeolus_amv.py
+27
-39
27 additions, 39 deletions
modules/aeolus/aeolus_amv.py
with
27 additions
and
39 deletions
modules/aeolus/aeolus_amv.py
+
27
−
39
View file @
a126d6de
...
...
@@ -1067,6 +1067,8 @@ def compare_amvs_bestfit_driver(all_list, bin_size=200):
amvs_list
=
[]
bfs_list
=
[]
rb_list
=
[]
gfs_list
=
[]
prd_list
=
[]
for
tup
in
all_list
:
ab_dct
=
tup
[
0
]
...
...
@@ -1077,6 +1079,8 @@ def compare_amvs_bestfit_driver(all_list, bin_size=200):
tup
=
ab_dct
.
get
(
key
)
amvs_list
.
append
(
tup
[
0
])
bfs_list
.
append
(
tup
[
1
])
rb_list
.
append
(
tup
[
2
])
gfs_list
.
append
(
tup
[
3
])
keys
=
list
(
pr_dct
.
keys
())
for
key
in
keys
:
...
...
@@ -1101,6 +1105,8 @@ def compare_amvs_bestfit_driver(all_list, bin_size=200):
amvs
=
np
.
concatenate
(
amvs_list
)
bfs
=
np
.
concatenate
(
bfs_list
)
rbm
=
np
.
concatenate
(
rb_list
)
gfs_bfs
=
np
.
concatenate
(
gfs_list
)
prd
=
np
.
concatenate
(
prd_list
)
thin
=
np
.
logical_and
(
prd
[:,
2
]
>
0
,
prd
[:,
2
]
<
1
)
...
...
@@ -1236,59 +1242,41 @@ def compare_amvs_bestfit(amvs, bfs, bin_size=200):
return
bin_ranges
,
bin_pres
,
bin_spd
,
bin_dir
def
make_plot
():
# f = open('/Users/tomrink/amv_raob.pkl', 'rb')
f
=
open
(
'
/Users/tomrink/amv_bf_gfs_all_linear.pkl
'
,
'
rb
'
)
tup_r
=
pickle
.
load
(
f
)
f
.
close
()
def
make_plot
(
bin_ranges
,
bin_values
):
f
=
open
(
'
/Users/tomrink/amv_bf_gfs_all_nearest.pkl
'
,
'
rb
'
)
tup_g
=
pickle
.
load
(
f
)
f
.
close
()
bin_ranges
=
tup_r
[
0
]
# same for all
bin_pres_r
=
tup_r
[
1
]
bin_pres_g
=
tup_g
[
1
]
bin_spd_r
=
tup_r
[
2
]
bin_spd_g
=
tup_g
[
2
]
bin_vals_r
=
bin_values
[
0
]
bin_vals_g
=
bin_values
[
1
]
x_values
=
[]
num_pres_r
=
[]
num_pres_g
=
[]
num_spd
=
[]
num_dir
=
[]
pres_mad_r
=
[]
pres_bias_r
=
[]
pres_mad_g
=
[]
pres_bias_g
=
[]
spd_mad_r
=
[]
spd_bias_r
=
[]
spd_mad_g
=
[]
spd_bias_g
=
[]
num_vals_r
=
[]
num_vals_g
=
[]
mad_r
=
[]
bias_r
=
[]
mad_g
=
[]
bias_g
=
[]
num_r
=
0
num_g
=
0
for
i
in
range
(
len
(
bin_ranges
)):
num_r
+=
bin_
pre
s_r
[
i
].
shape
[
0
]
num_g
+=
bin_
pre
s_g
[
i
].
shape
[
0
]
num_r
+=
bin_
val
s_r
[
i
].
shape
[
0
]
num_g
+=
bin_
val
s_g
[
i
].
shape
[
0
]
for
i
in
range
(
len
(
bin_ranges
)):
x_values
.
append
(
np
.
average
(
bin_ranges
[
i
]))
num_pres_r
.
append
((
bin_pres_r
[
i
].
shape
[
0
])
/
num_r
)
num_pres_g
.
append
((
bin_pres_g
[
i
].
shape
[
0
])
/
num_g
)
pres_mad_r
.
append
(
np
.
average
(
np
.
abs
(
bin_pres_r
[
i
])))
pres_bias_r
.
append
(
np
.
average
(
bin_pres_r
[
i
]))
pres_mad_g
.
append
(
np
.
average
(
np
.
abs
(
bin_pres_g
[
i
])))
pres_bias_g
.
append
(
np
.
average
(
bin_pres_g
[
i
]))
num_vals_r
.
append
((
bin_vals_r
[
i
].
shape
[
0
])
/
num_r
)
num_vals_g
.
append
((
bin_vals_g
[
i
].
shape
[
0
])
/
num_g
)
mad_r
.
append
(
np
.
average
(
np
.
abs
(
bin_vals_r
[
i
])))
bias_r
.
append
(
np
.
average
(
bin_vals_r
[
i
]))
mad_g
.
append
(
np
.
average
(
np
.
abs
(
bin_vals_g
[
i
])))
bias_g
.
append
(
np
.
average
(
bin_vals_g
[
i
]))
spd_mad_r
.
append
(
np
.
average
(
np
.
abs
(
bin_spd_r
[
i
])))
spd_bias_r
.
append
(
np
.
average
(
bin_spd_r
[
i
]))
spd_mad_g
.
append
(
np
.
average
(
np
.
abs
(
bin_spd_g
[
i
])))
spd_bias_g
.
append
(
np
.
average
(
bin_spd_g
[
i
]))
do_plot
(
x_values
,
[
pres_
mad_r
,
pres_
mad_g
],
[
'
GFS_linear
'
,
'
GFS_nearest
'
],
[
'
blue
'
,
'
red
'
],
title
=
'
ACHA - BestFit
'
,
x_axis_label
=
'
MAD
'
,
y_axis_label
=
'
hPa
'
,
invert
=
True
,
flip
=
True
)
do_plot
(
x_values
,
[
mad_r
,
mad_g
],
[
'
GFS_linear
'
,
'
GFS_nearest
'
],
[
'
blue
'
,
'
red
'
],
title
=
'
ACHA - BestFit
'
,
x_axis_label
=
'
MAD
'
,
y_axis_label
=
'
hPa
'
,
invert
=
True
,
flip
=
True
)
#do_plot(x_values, [pres_mad_r, pres_mad_g], ['RAOB', 'GFS'], ['blue', 'red'], title='ACHA - BestFit', x_axis_label='MAD', y_axis_label='hPa', invert=True, flip=True)
#do_plot(x_values, [spd_mad_r, spd_mad_g], ['RAOB', 'GFS'], ['blue', 'red'], title='ACHA - BestFit', x_axis_label='MAE (m/s)', y_axis_label='hPa', invert=True, flip=True)
#do_plot(x_values, [pres_bias_r, pres_bias_g], ['RAOB', 'GFS'], ['blue', 'red'], title='ACHA - BestFit', x_axis_label='BIAS', y_axis_label='hPa', invert=True, flip=True)
...
...
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