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
8d5c9267
Commit
8d5c9267
authored
4 years ago
by
tomrink
Browse files
Options
Downloads
Patches
Plain Diff
snapshot
parent
e83ba619
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
modules/aeolus/datasource.py
+12
-0
12 additions, 0 deletions
modules/aeolus/datasource.py
modules/icing/pirep_goes.py
+22
-1
22 additions, 1 deletion
modules/icing/pirep_goes.py
modules/icing/pireps.py
+30
-0
30 additions, 0 deletions
modules/icing/pireps.py
with
64 additions
and
1 deletion
modules/aeolus/datasource.py
+
12
−
0
View file @
8d5c9267
...
...
@@ -52,6 +52,18 @@ class Files:
return
None
,
None
,
None
class
GOESL1B
(
Files
):
def
__init__
(
self
,
files_path
,
band
=
'
14
'
):
super
().
__init__
(
files_path
,
10
,
'
OR_ABI-L1b-RadC-M3C
'
+
band
+
'
*.nc
'
)
def
get_datetime
(
self
,
pathname
):
filename
=
os
.
path
.
split
(
pathname
)[
1
]
so
=
re
.
search
(
'
_s
\\
d{11}
'
,
filename
)
dt_str
=
so
.
group
()
dto
=
datetime
.
datetime
.
strptime
(
dt_str
,
'
_s%Y%j%H%M
'
).
replace
(
tzinfo
=
timezone
.
utc
)
return
dto
class
CLAVRx
(
Files
):
def
__init__
(
self
,
files_path
):
super
().
__init__
(
files_path
,
10
,
'
clavrx_OR_ABI-L1b*.level2.nc
'
)
...
...
This diff is collapsed.
Click to expand it.
modules/icing/pirep_goes.py
+
22
−
1
View file @
8d5c9267
...
...
@@ -3,14 +3,19 @@ import numpy as np
import
pickle
import
os
from
util.util
import
get_time_tuple_utc
from
aeolus.datasource
import
CLAVRx
from
aeolus.datasource
import
CLAVRx
,
GOESL1B
from
util.geos_nav
import
GEOSNavigation
import
h5py
import
datetime
from
datetime
import
timezone
goes_date_format
=
'
%Y%j%H
'
goes16_directory
=
'
/arcdata/goes/grb/goes16/
'
# /year/date/abi/L1b/RadC
clavrx_dir
=
'
/apollo/cloud/scratch/ICING/
'
dir_fmt
=
'
%Y_%m_%d_%j
'
# dir_list = [f.path for f in os.scandir('.') if f.is_dir()]
ds_dct
=
{}
goes_ds_dct
=
{}
ice_dict
=
None
no_ice_dict
=
None
time_keys
=
None
...
...
@@ -38,6 +43,22 @@ def get_clavrx_datasource(timestamp):
return
ds
def
get_goes_datasource
(
timestamp
):
dt_obj
,
time_tup
=
get_time_tuple_utc
(
timestamp
)
yr_dir
=
str
(
dt_obj
.
timetuple
().
tm_year
)
date_dir
=
dt_obj
.
strftime
(
dir_fmt
)
yr_date
=
yr_dir
+
date_dir
files_path
=
goes16_directory
+
'
/
'
+
yr_dir
+
'
/
'
+
date_dir
+
'
/abi
'
+
'
/L1b
'
+
'
/RadC/
'
print
(
files_path
)
ds
=
goes_ds_dct
.
get
(
yr_date
)
if
ds
is
None
:
ds
=
GOESL1B
(
files_path
)
goes_ds_dct
[
yr_date
]
=
ds
return
ds
def
get_grid_values
(
h5f
,
grid_name
,
j_c
,
i_c
,
half_width
,
scale_factor_name
=
'
scale_factor
'
,
add_offset_name
=
'
add_offset
'
):
hfds
=
h5f
[
grid_name
]
attrs
=
hfds
.
attrs
...
...
This diff is collapsed.
Click to expand it.
modules/icing/pireps.py
+
30
−
0
View file @
8d5c9267
import
datetime
from
datetime
import
timezone
import
re
import
numpy
as
np
from
icing.pirep_goes
import
get_goes_datasource
NO_ICE
=
'
\s*NEG\s*|\s*NONE\s*|\s*NEGATIVE\s*|\s*NO\s*
'
ICE_LVL
=
'
\d+-\d+|FL\d+-FL\d+
'
...
...
@@ -105,3 +108,30 @@ def pirep_icing(filename, lon_range=[-180, 180], lat_range=[-55, 55]):
rpts
.
append
(
tup
)
return
ice_dict
,
no_ice_dict
def
analyze
(
ice_dct
,
no_ice_dct
):
ice_times
=
np
.
array
(
list
(
ice_dct
.
keys
()))
no_ice_times
=
np
.
array
(
list
(
no_ice_dct
.
keys
()))
dt_str
=
'
201601010000
'
dto
=
datetime
.
datetime
.
strptime
(
dt_str
,
'
%Y%m%d%H%M
'
).
replace
(
tzinfo
=
timezone
.
utc
)
t0
=
dto
.
timestamp
()
dt_str
=
'
201906300000
'
dto
=
datetime
.
datetime
.
strptime
(
dt_str
,
'
%Y%m%d%H%M
'
).
replace
(
tzinfo
=
timezone
.
utc
)
t1
=
dto
.
timestamp
()
tline
=
np
.
arange
(
t0
,
t1
,
600
)
hist_a
,
edges
=
np
.
histogram
(
no_ice_times
,
bins
=
tline
)
print
(
len
(
np
.
nonzero
(
hist_a
)[
0
]))
hist_b
,
edges
=
np
.
histogram
(
ice_times
,
bins
=
tline
)
print
(
len
(
np
.
nonzero
(
hist_b
)[
0
]))
print
(
np
.
sum
(
np
.
logical_and
(
hist_a
>
0
,
hist_b
>
0
)))
for
ts
in
list
(
no_ice_dct
.
keys
()):
ds
=
get_goes_datasource
(
ts
)
goes_file
=
ds
.
get_file
(
ts
)[
0
]
print
(
goes_file
)
\ No newline at end of file
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