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
c0aa4790
Commit
c0aa4790
authored
2 years ago
by
tomrink
Browse files
Options
Downloads
Patches
Plain Diff
snapshot...
parent
c7af42c8
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/icing/pirep_goes.py
+32
-2
32 additions, 2 deletions
modules/icing/pirep_goes.py
with
32 additions
and
2 deletions
modules/icing/pirep_goes.py
+
32
−
2
View file @
c0aa4790
...
@@ -626,6 +626,7 @@ def pirep_info(pirep_dct):
...
@@ -626,6 +626,7 @@ def pirep_info(pirep_dct):
lon_space_hdeg
=
np
.
linspace
(
-
180
,
180
,
721
)
lon_space_hdeg
=
np
.
linspace
(
-
180
,
180
,
721
)
lat_space_hdeg
=
np
.
linspace
(
-
90
,
90
,
361
)
lat_space_hdeg
=
np
.
linspace
(
-
90
,
90
,
361
)
hgt_space_3000
=
np
.
linspace
(
0
,
15000
,
3000
)
def
check_no_overlap
(
lon
,
lat
,
ts
,
grd_bins
,
t_delta
=
600.0
):
def
check_no_overlap
(
lon
,
lat
,
ts
,
grd_bins
,
t_delta
=
600.0
):
...
@@ -649,6 +650,31 @@ def check_no_overlap(lon, lat, ts, grd_bins, t_delta=600.0):
...
@@ -649,6 +650,31 @@ def check_no_overlap(lon, lat, ts, grd_bins, t_delta=600.0):
return
False
return
False
def
check_no_overlap_alt
(
lon
,
lat
,
hgt
,
ts
,
grd_bins
,
t_delta
=
600.0
):
grd_x_hi
=
lon_space_hdeg
.
shape
[
0
]
-
1
grd_y_hi
=
lat_space_hdeg
.
shape
[
0
]
-
1
grd_z_hi
=
hgt_space_3000
.
shape
[
0
]
-
1
lon_idx
=
np
.
searchsorted
(
lon_space_hdeg
,
lon
)
lat_idx
=
np
.
searchsorted
(
lat_space_hdeg
,
lat
)
hgt_idx
=
np
.
searchsorted
(
hgt_space_3000
,
hgt
)
if
lon_idx
<
0
or
lon_idx
>
grd_x_hi
:
return
False
if
lat_idx
<
0
or
lat_idx
>
grd_y_hi
:
return
False
if
hgt_idx
<
0
or
hgt_idx
>
grd_z_hi
:
return
False
last_ts
=
grd_bins
[
hgt_idx
,
lat_idx
,
lon_idx
]
if
ts
-
last_ts
>
t_delta
:
grd_bins
[
hgt_idx
,
lat_idx
,
lon_idx
]
=
ts
return
True
else
:
return
False
# This mostly reduces some categories for a degree of class balancing and removes no intensity reports
# This mostly reduces some categories for a degree of class balancing and removes no intensity reports
def
process
(
ice_dct
,
no_ice_dct
,
neg_ice_dct
,
t_delta
=
600
):
def
process
(
ice_dct
,
no_ice_dct
,
neg_ice_dct
,
t_delta
=
600
):
t_delta
=
600
# seconds
t_delta
=
600
# seconds
...
@@ -777,6 +803,7 @@ def process(ice_dct, no_ice_dct, neg_ice_dct, t_delta=600):
...
@@ -777,6 +803,7 @@ def process(ice_dct, no_ice_dct, neg_ice_dct, t_delta=600):
all_which
=
all_which
[
sidxs
]
all_which
=
all_which
[
sidxs
]
grd_bins
=
np
.
full
((
lat_space_hdeg
.
shape
[
0
],
lon_space_hdeg
.
shape
[
0
]),
-
(
t_delta
+
1
))
grd_bins
=
np
.
full
((
lat_space_hdeg
.
shape
[
0
],
lon_space_hdeg
.
shape
[
0
]),
-
(
t_delta
+
1
))
#grd_bins = np.full((hgt_space_3000.shape[0], lat_space_hdeg.shape[0], lon_space_hdeg.shape[0]), -(t_delta+1))
cnt_i
=
0
cnt_i
=
0
cnt_ni
=
0
cnt_ni
=
0
for
idx
,
key
in
enumerate
(
all_keys
):
for
idx
,
key
in
enumerate
(
all_keys
):
...
@@ -789,8 +816,9 @@ def process(ice_dct, no_ice_dct, neg_ice_dct, t_delta=600):
...
@@ -789,8 +816,9 @@ def process(ice_dct, no_ice_dct, neg_ice_dct, t_delta=600):
rpts
=
ice_dct
[
key
]
rpts
=
ice_dct
[
key
]
tup
=
rpts
[
all_tidx
[
idx
]]
tup
=
rpts
[
all_tidx
[
idx
]]
lat
,
lon
=
tup
[
0
],
tup
[
1
]
lat
,
lon
,
falt
=
tup
[
0
],
tup
[
1
]
,
tup
[
2
]
#if not check_no_overlap_alt(lon, lat, falt, key, grd_bins, t_delta=t_delta):
if
not
check_no_overlap
(
lon
,
lat
,
key
,
grd_bins
,
t_delta
=
t_delta
):
if
not
check_no_overlap
(
lon
,
lat
,
key
,
grd_bins
,
t_delta
=
t_delta
):
continue
continue
...
@@ -817,13 +845,15 @@ def process(ice_dct, no_ice_dct, neg_ice_dct, t_delta=600):
...
@@ -817,13 +845,15 @@ def process(ice_dct, no_ice_dct, neg_ice_dct, t_delta=600):
neg_ice_tidx
=
np
.
array
(
neg_ice_tidx
)
neg_ice_tidx
=
np
.
array
(
neg_ice_tidx
)
print
(
'
neg ice total:
'
,
neg_ice_keys
.
shape
[
0
])
print
(
'
neg ice total:
'
,
neg_ice_keys
.
shape
[
0
])
#grd_bins = np.full((hgt_space_3000.shape[0], lat_space_hdeg.shape[0], lon_space_hdeg.shape[0]), -(t_delta+1))
grd_bins
=
np
.
full
((
lat_space_hdeg
.
shape
[
0
],
lon_space_hdeg
.
shape
[
0
]),
-
(
t_delta
+
1
))
grd_bins
=
np
.
full
((
lat_space_hdeg
.
shape
[
0
],
lon_space_hdeg
.
shape
[
0
]),
-
(
t_delta
+
1
))
cnt
=
0
cnt
=
0
for
idx
,
key
in
enumerate
(
neg_ice_keys
):
for
idx
,
key
in
enumerate
(
neg_ice_keys
):
rpts
=
neg_ice_dct
[
key
]
rpts
=
neg_ice_dct
[
key
]
tup
=
rpts
[
neg_ice_tidx
[
idx
]]
tup
=
rpts
[
neg_ice_tidx
[
idx
]]
lat
,
lon
=
tup
[
0
],
tup
[
1
]
lat
,
lon
,
falt
=
tup
[
0
],
tup
[
1
],
tup
[
2
]
#if not check_no_overlap_alt(lon, lat, falt, key, grd_bins, t_delta=t_delta):
if
not
check_no_overlap
(
lon
,
lat
,
key
,
grd_bins
,
t_delta
=
t_delta
):
if
not
check_no_overlap
(
lon
,
lat
,
key
,
grd_bins
,
t_delta
=
t_delta
):
continue
continue
cnt
+=
1
cnt
+=
1
...
...
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