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
228ecaec
Commit
228ecaec
authored
4 years ago
by
tomrink
Browse files
Options
Downloads
Patches
Plain Diff
snapshot...
parent
56077ed5
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/aeolus/aeolus_amv.py
+72
-0
72 additions, 0 deletions
modules/aeolus/aeolus_amv.py
with
72 additions
and
0 deletions
modules/aeolus/aeolus_amv.py
+
72
−
0
View file @
228ecaec
...
...
@@ -473,6 +473,7 @@ def analyze2(raob_to_amv_dct, raob_dct, gfs_filename=None):
print
(
'
Hgh Press min/max/mean: {0:.2f} {1:.2f} {2:.2f}
'
.
format
(
good_amvs
[
hgh
,
pidx
].
min
(),
good_amvs
[
hgh
,
pidx
].
max
(),
good_amvs
[
hgh
,
pidx
].
mean
()))
# Comparison to Level of Best Fit (LBF) ------------------------------------------------------------------
# --------------------------------------------------------------------------------------------------------
bin_size
=
200.0
bin_ranges
=
get_press_bin_ranges
(
50
,
1050
,
bin_size
=
bin_size
)
...
...
@@ -527,6 +528,76 @@ def analyze2(raob_to_amv_dct, raob_dct, gfs_filename=None):
print
(
'
VD bias/rms: {0:.2f} {1:.2f}
'
.
format
(
vd_mean
,
np
.
sqrt
(
vd_mean
**
2
+
vd_std
**
2
)))
print
(
'
******************************************************
'
)
x_values
=
[]
num_pres
=
[]
num_spd
=
[]
num_dir
=
[]
print
(
'
level num cases hgt MAD/bias spd MAD/bias dir MAD/bias
'
)
print
(
'
-------------------------------------------------------------------
'
)
for
i
in
range
(
len
(
bin_ranges
)):
x_values
.
append
(
np
.
average
(
bin_ranges
[
i
]))
num_pres
.
append
(
bin_pres
[
i
].
shape
[
0
])
num_spd
.
append
(
bin_spd
[
i
].
shape
[
0
])
num_dir
.
append
(
bin_dir
[
i
].
shape
[
0
])
print
(
'
{0:d} {1:d} {2:.2f}/{3:.2f} {4:.2f}/{5:.2f} {6:.2f}/{7:.2f}
'
.
format
(
int
(
x_values
[
i
]),
num_pres
[
i
],
np
.
average
(
np
.
abs
(
bin_pres
[
i
])),
np
.
average
(
bin_pres
[
i
]),
np
.
average
(
np
.
abs
(
bin_spd
[
i
])),
np
.
average
(
bin_spd
[
i
]),
np
.
average
(
np
.
abs
(
bin_dir
[
i
])),
np
.
average
(
bin_dir
[
i
])))
# Comparison to Level of Best Fit (LBF) GFS ------------------------------------------------------------------
# ------------------------------------------------------------------------------------------------------------
bfs
=
bfs_gfs
vld_bf
=
bfs
[:,
3
]
==
0
keep_idxs
=
vld_bf
amv_p
=
good_amvs
[
keep_idxs
,
pidx
]
bf_p
=
bfs
[
keep_idxs
,
2
]
diff
=
amv_p
-
bf_p
mad
=
np
.
average
(
np
.
abs
(
diff
))
bias
=
np
.
average
(
diff
)
print
(
'
********************************************************
'
)
print
(
'
Number of good best fits:
'
,
bf_p
.
shape
[
0
])
print
(
'
press, MAD: {0:.2f}
'
.
format
(
mad
))
print
(
'
press, bias: {0:.2f}
'
.
format
(
bias
))
pd_std
=
np
.
std
(
diff
)
pd_mean
=
np
.
mean
(
diff
)
print
(
'
press bias/rms: {0:.2f} {1:.2f}
'
.
format
(
pd_mean
,
np
.
sqrt
(
pd_mean
**
2
+
pd_std
**
2
)))
print
(
'
------------------------------------------
'
)
bin_pres
=
bin_data_by
(
diff
,
amv_p
,
bin_ranges
)
amv_spd
=
good_amvs
[
keep_idxs
,
sidx
]
amv_dir
=
good_amvs
[
keep_idxs
,
didx
]
bf_spd
,
bf_dir
=
spd_dir_from_uv
(
bfs
[
keep_idxs
,
0
],
bfs
[
keep_idxs
,
1
])
diff
=
amv_spd
*
units
(
'
m/s
'
)
-
bf_spd
diff
=
diff
.
magnitude
spd_mad
=
np
.
average
(
np
.
abs
(
diff
))
spd_bias
=
np
.
average
(
diff
)
print
(
'
spd, MAD: {0:.2f}
'
.
format
(
spd_mad
))
print
(
'
spd, bias: {0:.2f}
'
.
format
(
spd_bias
))
spd_mean
=
np
.
mean
(
diff
)
spd_std
=
np
.
std
(
diff
)
print
(
'
spd MAD/bias/rms: {0:.2f} {1:.2f} {2:.2f}
'
.
format
(
np
.
average
(
np
.
abs
(
diff
)),
spd_mean
,
np
.
sqrt
(
spd_mean
**
2
+
spd_std
**
2
)))
print
(
'
-----------------
'
)
bin_spd
=
bin_data_by
(
diff
,
amv_p
,
bin_ranges
)
dir_diff
=
direction_difference
(
amv_dir
,
bf_dir
.
magnitude
)
print
(
'
dir, MAD: {0:.2f}
'
.
format
(
np
.
average
(
np
.
abs
(
dir_diff
))))
print
(
'
dir bias: {0:.2f}
'
.
format
(
np
.
average
(
dir_diff
)))
print
(
'
-------------------------------------
'
)
bin_dir
=
bin_data_by
(
dir_diff
,
amv_p
,
bin_ranges
)
amv_u
,
amv_v
=
uv_from_spd_dir
(
good_amvs
[
keep_idxs
,
sidx
],
good_amvs
[
keep_idxs
,
didx
])
u_diffs
=
amv_u
-
(
bfs
[
keep_idxs
,
0
]
*
units
(
'
m/s
'
))
v_diffs
=
amv_v
-
(
bfs
[
keep_idxs
,
1
]
*
units
(
'
m/s
'
))
vd
=
np
.
sqrt
(
u_diffs
**
2
+
v_diffs
**
2
)
vd_mean
=
np
.
mean
(
vd
)
vd_std
=
np
.
std
(
vd
)
print
(
'
VD bias/rms: {0:.2f} {1:.2f}
'
.
format
(
vd_mean
,
np
.
sqrt
(
vd_mean
**
2
+
vd_std
**
2
)))
print
(
'
******************************************************
'
)
x_values
=
[]
num_pres
=
[]
num_spd
=
[]
...
...
@@ -544,6 +615,7 @@ def analyze2(raob_to_amv_dct, raob_dct, gfs_filename=None):
np
.
average
(
np
.
abs
(
bin_spd
[
i
])),
np
.
average
(
bin_spd
[
i
]),
np
.
average
(
np
.
abs
(
bin_dir
[
i
])),
np
.
average
(
bin_dir
[
i
])))
# Direct comparison to RAOB profile ---------------------------------------------------------------
# -------------------------------------------------------------------------------------------------
vld
=
raob_match
[:,
3
]
==
0
keep_idxs
=
vld
...
...
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