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
8ed654a8
Commit
8ed654a8
authored
Jan 3, 2022
by
tomrink
Browse files
Options
Downloads
Patches
Plain Diff
snapshot...
parent
2d4d5b82
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/icing/pirep_goes.py
+44
-28
44 additions, 28 deletions
modules/icing/pirep_goes.py
with
44 additions
and
28 deletions
modules/icing/pirep_goes.py
+
44
−
28
View file @
8ed654a8
...
...
@@ -624,6 +624,49 @@ def process(ice_dct, no_ice_dct, neg_ice_dct):
return
new_ice_dct
,
new_no_ice_dct
,
new_neg_ice_dct
def
process_boeing
(
ice_dct
,
no_ice_dct
):
new_no_ice_dct
=
{}
print
(
'
num keys ice, no_ice:
'
,
len
(
ice_dct
),
len
(
no_ice_dct
))
no_ice_keys
=
[]
no_ice_tidx
=
[]
for
ts
in
list
(
no_ice_dct
.
keys
()):
rpts
=
no_ice_dct
[
ts
]
for
idx
,
tup
in
enumerate
(
rpts
):
no_ice_keys
.
append
(
ts
)
no_ice_tidx
.
append
(
idx
)
# -----------------------------------------------------
no_ice_keys
=
np
.
array
(
no_ice_keys
)
no_ice_tidx
=
np
.
array
(
no_ice_tidx
)
print
(
'
no ice total:
'
,
no_ice_keys
.
shape
[
0
])
np
.
random
.
seed
(
42
)
ridxs
=
np
.
random
.
permutation
(
np
.
arange
(
no_ice_keys
.
shape
[
0
]))
no_ice_keys
=
no_ice_keys
[
ridxs
]
no_ice_tidx
=
no_ice_tidx
[
ridxs
]
no_ice_keys
=
no_ice_keys
[::
10
]
no_ice_tidx
=
no_ice_tidx
[::
10
]
print
(
'
no ice reduced:
'
,
no_ice_keys
.
shape
[
0
])
sidxs
=
np
.
argsort
(
no_ice_keys
)
no_ice_keys
=
no_ice_keys
[
sidxs
]
no_ice_tidx
=
no_ice_tidx
[
sidxs
]
for
idx
,
key
in
enumerate
(
no_ice_keys
):
rpts
=
no_ice_dct
[
key
]
tup
=
rpts
[
no_ice_tidx
[
idx
]]
n_rpts
=
new_no_ice_dct
.
get
(
key
)
if
n_rpts
is
None
:
n_rpts
=
[]
new_no_ice_dct
[
key
]
=
n_rpts
n_rpts
.
append
(
tup
)
# -------------------------------------------------
return
ice_dct
,
new_no_ice_dct
def
analyze2
(
filename
,
filename_l1b
):
f
=
h5py
.
File
(
filename
,
'
r
'
)
icing_alt
=
f
[
'
icing_altitude
'
][:]
...
...
@@ -1659,34 +1702,7 @@ def spatial_filter(icing_dict):
return
grd_bins
,
grd_bins_keys
def
spatial_filter2
(
icing_dict
):
keys
=
icing_dict
.
keys
()
grd_x_hi
=
lon_space
.
shape
[
0
]
-
1
grd_y_hi
=
lat_space
.
shape
[
0
]
-
1
grd_bins
=
np
.
full
((
lat_space
.
shape
[
0
],
lon_space
.
shape
[
0
]),
0
)
grd_bins_keys
=
[[[]
for
i
in
range
(
lon_space
.
shape
[
0
])]
for
j
in
range
(
lat_space
.
shape
[
0
])]
for
key
in
keys
:
tup
=
icing_dict
.
get
(
key
)
lat
=
tup
[
0
]
lon
=
tup
[
1
]
lon_idx
=
np
.
searchsorted
(
lon_space
,
lon
)
lat_idx
=
np
.
searchsorted
(
lat_space
,
lat
)
if
lon_idx
<
0
or
lon_idx
>
grd_x_hi
:
continue
if
lat_idx
<
0
or
lat_idx
>
grd_y_hi
:
continue
grd_bins
[
lat_idx
,
lon_idx
]
+=
1
grd_bins_keys
[
lat_idx
][
lon_idx
].
append
(
key
)
return
grd_bins
,
grd_bins_keys
def
process_boeing
(
boeing_dct
,
pirep_dct
,
threshold
=
3000
):
def
remove_common
(
boeing_dct
,
pirep_dct
,
threshold
=
3000
):
boeing_times
=
list
(
boeing_dct
.
keys
())
pirep_times
=
np
.
array
(
list
(
pirep_dct
.
keys
()))
...
...
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