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
e3e7fbe0
Commit
e3e7fbe0
authored
May 12, 2021
by
tomrink
Browse files
Options
Downloads
Patches
Plain Diff
minor...
parent
5c3dc907
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/icing/pirep_goes.py
+58
-24
58 additions, 24 deletions
modules/icing/pirep_goes.py
with
58 additions
and
24 deletions
modules/icing/pirep_goes.py
+
58
−
24
View file @
e3e7fbe0
...
@@ -364,10 +364,15 @@ def process(ice_dct, no_ice_dct, neg_ice_dct):
...
@@ -364,10 +364,15 @@ def process(ice_dct, no_ice_dct, neg_ice_dct):
new_neg_ice_dct
=
{}
new_neg_ice_dct
=
{}
ice_keys_5_6
=
[]
ice_keys_5_6
=
[]
ice_tidx_5_6
=
[]
ice_keys_1
=
[]
ice_keys_1
=
[]
ice_tidx_1
=
[]
ice_keys_4
=
[]
ice_keys_4
=
[]
ice_tidx_4
=
[]
ice_keys_3
=
[]
ice_keys_3
=
[]
ice_tidx_3
=
[]
ice_keys_2
=
[]
ice_keys_2
=
[]
ice_tidx_2
=
[]
print
(
'
num keys ice, no_ice, neg_ice:
'
,
len
(
ice_dct
),
len
(
no_ice_dct
),
len
(
neg_ice_dct
))
print
(
'
num keys ice, no_ice, neg_ice:
'
,
len
(
ice_dct
),
len
(
no_ice_dct
),
len
(
neg_ice_dct
))
no_intensity_cnt
=
0
no_intensity_cnt
=
0
...
@@ -375,26 +380,33 @@ def process(ice_dct, no_ice_dct, neg_ice_dct):
...
@@ -375,26 +380,33 @@ def process(ice_dct, no_ice_dct, neg_ice_dct):
for
ts
in
list
(
ice_dct
.
keys
()):
for
ts
in
list
(
ice_dct
.
keys
()):
rpts
=
ice_dct
[
ts
]
rpts
=
ice_dct
[
ts
]
for
tup
in
rpts
:
for
idx
,
tup
in
enumerate
(
rpts
)
:
num_ice_reports
+=
1
num_ice_reports
+=
1
if
tup
[
3
]
==
5
or
tup
[
3
]
==
6
:
if
tup
[
3
]
==
5
or
tup
[
3
]
==
6
:
ice_keys_5_6
.
append
(
ts
)
ice_keys_5_6
.
append
(
ts
)
ice_tidx_5_6
.
append
(
idx
)
elif
tup
[
3
]
==
1
:
elif
tup
[
3
]
==
1
:
ice_keys_1
.
append
(
ts
)
ice_keys_1
.
append
(
ts
)
ice_tidx_1
.
append
(
idx
)
elif
tup
[
3
]
==
4
:
elif
tup
[
3
]
==
4
:
ice_keys_4
.
append
(
ts
)
ice_keys_4
.
append
(
ts
)
ice_tidx_4
.
append
(
idx
)
elif
tup
[
3
]
==
3
:
elif
tup
[
3
]
==
3
:
ice_keys_3
.
append
(
ts
)
ice_keys_3
.
append
(
ts
)
ice_tidx_3
.
append
(
idx
)
elif
tup
[
3
]
==
2
:
elif
tup
[
3
]
==
2
:
ice_keys_2
.
append
(
ts
)
ice_keys_2
.
append
(
ts
)
ice_tidx_2
.
append
(
idx
)
else
:
else
:
no_intensity_cnt
+=
1
no_intensity_cnt
+=
1
no_ice_keys
=
[]
no_ice_keys
=
[]
no_ice_tidx
=
[]
for
ts
in
list
(
no_ice_dct
.
keys
()):
for
ts
in
list
(
no_ice_dct
.
keys
()):
rpts
=
no_ice_dct
[
ts
]
rpts
=
no_ice_dct
[
ts
]
for
tup
in
rpts
:
for
idx
,
tup
in
enumerate
(
rpts
)
:
no_ice_keys
.
append
(
ts
)
no_ice_keys
.
append
(
ts
)
no_ice_tidx
.
append
(
idx
)
neg_ice_keys
=
[]
neg_ice_keys
=
[]
for
ts
in
list
(
neg_ice_dct
.
keys
()):
for
ts
in
list
(
neg_ice_dct
.
keys
()):
...
@@ -406,46 +418,68 @@ def process(ice_dct, no_ice_dct, neg_ice_dct):
...
@@ -406,46 +418,68 @@ def process(ice_dct, no_ice_dct, neg_ice_dct):
print
(
'
------------------------------------------------
'
)
print
(
'
------------------------------------------------
'
)
ice_keys_5_6
=
np
.
array
(
ice_keys_5_6
)
ice_keys_5_6
=
np
.
array
(
ice_keys_5_6
)
print
(
'
5_6:
'
,
ice_keys_5_6
.
shape
)
ice_tidx_5_6
=
np
.
array
(
ice_tidx_5_6
)
print
(
'
5_6:
'
,
ice_keys_5_6
.
shape
[
0
])
ice_keys_4
=
np
.
array
(
ice_keys_4
)
ice_keys_4
=
np
.
array
(
ice_keys_4
)
print
(
'
4:
'
,
ice_keys_4
.
shape
)
ice_tidx_4
=
np
.
array
(
ice_tidx_4
)
print
(
'
4:
'
,
ice_keys_4
.
shape
[
0
])
ice_keys_3
=
np
.
array
(
ice_keys_3
)
ice_keys_3
=
np
.
array
(
ice_keys_3
)
print
(
'
3:
'
,
ice_keys_3
.
shape
)
ice_tidx_3
=
np
.
array
(
ice_tidx_3
)
print
(
'
3:
'
,
ice_keys_3
.
shape
[
0
])
ice_keys_2
=
np
.
array
(
ice_keys_2
)
ice_keys_2
=
np
.
array
(
ice_keys_2
)
print
(
'
2:
'
,
ice_keys_2
.
shape
)
ice_tidx_2
=
np
.
array
(
ice_tidx_2
)
print
(
'
2:
'
,
ice_keys_2
.
shape
[
0
])
np
.
random
.
seed
(
42
)
np
.
random
.
seed
(
42
)
np
.
random
.
shuffle
(
ice_keys_2
)
ridxs
=
np
.
random
.
permutation
(
np
.
arange
(
ice_keys_2
.
shape
[
0
]))
ice_keys_2
=
ice_keys_2
[
0
:
70000
]
ice_keys_2
=
ice_keys_2
[
ridxs
]
ice_tidx_2
=
ice_tidx_2
[
ridxs
]
ice_keys_2
=
ice_keys_2
[::
2
]
ice_tidx_2
=
ice_tidx_2
[::
2
]
ice_keys_1
=
np
.
array
(
ice_keys_1
)
ice_keys_1
=
np
.
array
(
ice_keys_1
)
print
(
'
1:
'
,
ice_keys_1
.
shape
)
ice_tidx_1
=
np
.
array
(
ice_tidx_1
)
print
(
'
1:
'
,
ice_keys_1
.
shape
[
0
])
print
(
'
no intensity:
'
,
no_intensity_cnt
)
print
(
'
no intensity:
'
,
no_intensity_cnt
)
ice_keys
=
np
.
concatenate
([
ice_keys_5_6
,
ice_keys_1
,
ice_keys_2
,
ice_keys_3
,
ice_keys_4
])
ice_keys
=
np
.
concatenate
([
ice_keys_5_6
,
ice_keys_1
,
ice_keys_2
,
ice_keys_3
,
ice_keys_4
])
uniq_sorted_keys
=
np
.
unique
(
ice_keys
)
ice_tidx
=
np
.
concatenate
([
ice_tidx_5_6
,
ice_tidx_1
,
ice_tidx_2
,
ice_tidx_3
,
ice_tidx_4
])
print
(
'
ice:
'
,
ice_keys
.
shape
,
uniq_sorted_keys
.
shape
)
uniq_sorted_keys
=
uniq_sorted_keys
.
tolist
()
for
idx
,
key
in
enumerate
(
ice_keys
):
for
key
in
uniq_sorted_
key
s
:
rpts
=
ice_dct
[
key
]
new_ice_dct
[
key
]
=
ice_dct
[
key
]
tup
=
rpts
[
ice_tidx
[
idx
]
]
n_rpts
=
new_ice_dct
.
get
(
key
)
if
n_rpts
is
None
:
n_rpts
=
[]
n_rpts
.
append
(
tup
)
# -----------------------------------------------------
no_ice_keys
=
np
.
array
(
no_ice_keys
)
no_ice_keys
=
np
.
array
(
no_ice_keys
)
print
(
'
no ice total:
'
,
no_ice_keys
.
shape
)
no_ice_tidx
=
np
.
array
(
no_ice_tidx
)
print
(
'
no ice total:
'
,
no_ice_keys
.
shape
[
0
])
np
.
random
.
seed
(
42
)
np
.
random
.
seed
(
42
)
np
.
random
.
shuffle
(
no_ice_keys
)
ridxs
=
np
.
random
.
permutation
(
np
.
arange
(
no_ice_keys
.
shape
[
0
]))
no_ice_keys
=
no_ice_keys
[
0
:
150000
]
no_ice_keys
=
no_ice_keys
[
ridxs
]
uniq_sorted_no_ice
=
np
.
unique
(
no_ice_keys
)
no_ice_tidx
=
no_ice_tidx
[
ridxs
]
print
(
'
no ice:
'
,
no_ice_keys
.
shape
,
uniq_sorted_no_ice
.
shape
)
no_ice_keys
=
no_ice_keys
[::
20
]
no_ice_tidx
=
no_ice_tidx
[::
20
]
uniq_sorted_no_ice
=
uniq_sorted_no_ice
.
tolist
()
print
(
'
no ice :
'
,
no_ice_keys
.
shape
[
0
])
for
key
in
uniq_sorted_no_ice
:
new_no_ice_dct
[
key
]
=
no_ice_dct
[
key
]
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
=
[]
n_rpts
.
append
(
tup
)
# -------------------------------------------------
neg_ice_keys
=
np
.
array
(
neg_ice_keys
)
neg_ice_keys
=
np
.
array
(
neg_ice_keys
)
print
(
'
neg ice total:
'
,
neg_ice_keys
.
shape
)
print
(
'
neg ice total:
'
,
neg_ice_keys
.
shape
[
0
]
)
np
.
random
.
seed
(
42
)
np
.
random
.
seed
(
42
)
np
.
random
.
shuffle
(
neg_ice_keys
)
np
.
random
.
shuffle
(
neg_ice_keys
)
neg_ice_keys
=
neg_ice_keys
[
0
:
10000
]
neg_ice_keys
=
neg_ice_keys
[
0
:
10000
]
...
...
...
...
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
sign in
to comment