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
08ffd13c
Commit
08ffd13c
authored
Aug 30, 2021
by
tomrink
Browse files
Options
Downloads
Patches
Plain Diff
snapshot...
parent
99acc238
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
modules/icing/pirep_goes.py
+41
-1
41 additions, 1 deletion
modules/icing/pirep_goes.py
modules/util/util.py
+13
-9
13 additions, 9 deletions
modules/util/util.py
with
54 additions
and
10 deletions
modules/icing/pirep_goes.py
+
41
−
1
View file @
08ffd13c
...
...
@@ -4,7 +4,7 @@ import pickle
import
matplotlib.pyplot
as
plt
import
os
from
util.util
import
get_time_tuple_utc
,
GenericException
,
add_time_range_to_filename
,
is_night
,
is_day
,
\
get_grid_values_all
,
check_oblique
get_grid_values_all
,
check_oblique
,
make_times
,
find_bin_index
from
aeolus.datasource
import
CLAVRx
,
GOESL1B
from
util.geos_nav
import
GEOSNavigation
import
h5py
...
...
@@ -1522,6 +1522,32 @@ def time_filter(icing_dct, dt_str_0=None, dt_str_1=None, format_code='%Y-%m-%d_%
return
keep_times
,
keep_reports
# dt_str_0: start datetime string in format YYYY-MM-DD_HH:MM (default)
# dt_str_1: end datetime string in format YYYY-MM-DD_HH:MM (default)
# format_code: Python Datetime format code, default: '%Y-%m-%d_%H:%M'
# return a flatten list of icing reports
def
time_filter_2
(
times
,
dt_str_0
=
None
,
dt_str_1
=
None
,
format_code
=
'
%Y-%m-%d_%H:%M
'
):
ts_0
=
0
if
dt_str_0
is
not
None
:
dto_0
=
datetime
.
datetime
.
strptime
(
dt_str_0
,
format_code
).
replace
(
tzinfo
=
timezone
.
utc
)
ts_0
=
dto_0
.
timestamp
()
ts_1
=
np
.
finfo
(
np
.
float64
).
max
if
dt_str_1
is
not
None
:
dto_1
=
datetime
.
datetime
.
strptime
(
dt_str_1
,
format_code
).
replace
(
tzinfo
=
timezone
.
utc
)
ts_1
=
dto_1
.
timestamp
()
keep_idxs
=
[]
keep_times
=
[]
for
ts
,
idx
in
enumerate
(
times
):
if
ts_0
<=
ts
<
ts_1
:
keep_times
.
append
(
ts
)
keep_idxs
.
append
(
idx
)
return
keep_times
,
keep_idxs
def
analyze_moon_phase
(
icing_dict
):
ts
=
api
.
load
.
timescale
()
eph
=
api
.
load
(
'
de421.bsp
'
)
...
...
@@ -1546,6 +1572,20 @@ def analyze_moon_phase(icing_dict):
print
(
len
(
icing_dict
),
cnt
)
def
collect
(
icing_times
,
icing_intensity
):
nbins
=
6
jdays
=
[
'
071
'
,
'
072
'
,
'
074
'
,
'
079
'
,
'
080
'
,
'
081
'
,
'
082
'
,
'
084
'
,
'
085
'
,
'
088
'
,
'
107
'
,
'
110
'
,
'
113
'
,
'
117
'
,
'
119
'
,
'
129
'
,
'
132
'
,
'
134
'
,
'
139
'
,
'
150
'
,
'
164
'
,
'
203
'
,
'
205
'
,
'
232
'
,
'
252
'
,
'
254
'
]
keep_idxs
=
[[[]
for
j
in
range
(
nbins
)]
for
i
in
range
(
len
(
jdays
))]
for
jd
in
jdays
:
fltr_times
,
fltr_idxs
=
time_filter_2
(
icing_times
,
'
2019-
'
+
jd
+
'
_00:00
'
,
'
2019-
'
+
jd
+
'
_00:00
'
,
format_code
=
'
%Y-%j_%H:%M
'
)
_
,
ts_edges
=
make_times
(
'
2019-
'
+
jd
+
'
_00:00
'
,
None
,
num_steps
=
6
,
format_code
=
'
%Y-%j_%H:%M
'
,
hours
=
4
)
bin_idxs
=
find_bin_index
(
np
.
array
(
ts_edges
),
np
.
array
(
fltr_times
))
# ------------ This code will not be needed when we implement a Fully Connected CNN -----------------------------------
# Example GOES file to retrieve GEOS parameters in MetPy form (CONUS)
exmp_file
=
'
/Users/tomrink/data/OR_ABI-L1b-RadC-M6C14_G16_s20193140811215_e20193140813588_c20193140814070.nc
'
...
...
This diff is collapsed.
Click to expand it.
modules/util/util.py
+
13
−
9
View file @
08ffd13c
...
...
@@ -185,20 +185,24 @@ def value_to_index(nda, value):
return
idx
def
find_bin_index
(
nda
,
value
):
def
find_bin_index
(
nda
,
value
_s
):
idxs
=
np
.
arange
(
nda
.
shape
[
0
])
iL_s
=
np
.
zeros
(
value_s
.
shape
[
0
])
iL_s
[:,]
=
-
1
above
=
value
>=
nda
for
k
,
v
in
enumerate
(
value_s
):
above
=
v
>=
nda
if
not
above
.
any
():
return
-
1
continue
below
=
v
alue
<
nda
below
=
v
<
nda
if
not
below
.
any
():
return
-
1
continue
iL
=
idxs
[
above
].
max
()
iL_s
[
k
]
=
iL
return
iL
return
iL
_s
# array solzen must be degrees, missing values must NaN. For small roughly 50x50km regions only
...
...
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