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
f2c681c1
Commit
f2c681c1
authored
4 years ago
by
tomrink
Browse files
Options
Downloads
Patches
Plain Diff
snapshot...
parent
822fb8ff
No related branches found
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
+56
-21
56 additions, 21 deletions
modules/icing/pirep_goes.py
with
56 additions
and
21 deletions
modules/icing/pirep_goes.py
+
56
−
21
View file @
f2c681c1
...
...
@@ -5,6 +5,8 @@ import pickle
import
os
from
util.util
import
get_time_tuple_utc
from
aeolus.datasource
import
CLAVRx
from
util.geos_nav
import
GEOSNavigation
import
h5py
clavrx_dir
=
'
/apollo/cloud/scratch/ICING/
'
dir_fmt
=
'
%Y_%m_%d_%j
'
...
...
@@ -31,25 +33,58 @@ def get_clavrx_datasource(timestamp):
return
ds
for
idx
,
time
in
enumerate
(
time_keys
):
if
(
idx
%
4
)
!=
0
:
continue
print
(
100.0
*
(
idx
/
len
(
time_keys
)))
reports
=
ice_dict
[
time
]
lat_s
=
[]
lon_s
=
[]
for
tup
in
reports
:
lat
,
lon
,
fl
,
rpt_str
=
tup
lat_s
.
append
(
lat
)
lon_s
.
append
(
lon
)
images
,
_
,
_
,
idxs
=
get_images
(
lon_s
,
lat_s
,
time
,
[
'
14
'
],
[
10
],
[
1
])
if
images
is
not
None
:
counts
,
edges
=
np
.
histogram
(
images
[
0
,],
range
=
[
150
,
350
],
bins
=
20
)
hist
+=
counts
f
=
open
(
'
/home/rink/ice_hist.pkl
'
,
'
wb
'
)
pickle
.
dump
(
hist
,
f
)
f
.
close
()
print
(
'
bin edges:
'
,
edges
)
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
grd_vals
=
hfds
[
j_c
-
half_width
:
j_c
+
half_width
+
1
,
i_c
-
half_width
:
i_c
+
half_width
+
1
]
grd_vals
=
np
.
where
(
grd_vals
==
-
999
,
np
.
nan
,
grd_vals
)
grd_vals
=
np
.
where
(
grd_vals
==
-
32768
,
np
.
nan
,
grd_vals
)
if
attrs
is
None
:
return
grd_vals
if
scale_factor_name
is
not
None
:
scale_factor
=
attrs
.
get
(
scale_factor_name
)[
0
]
grd_vals
=
grd_vals
*
scale_factor
if
add_offset_name
is
not
None
:
add_offset
=
attrs
.
get
(
add_offset_name
)[
0
]
grd_vals
=
grd_vals
+
add_offset
return
grd_vals
def
run
():
nav
=
GEOSNavigation
(
sub_lon
=-
75.0
,
CFAC
=
5.6E-05
,
COFF
=-
0.101332
,
LFAC
=-
5.6E-05
,
LOFF
=
0.128212
,
num_elems
=
2500
,
num_lines
=
1500
)
lon_s
=
np
.
zeros
(
1
)
lat_s
=
np
.
zeros
(
1
)
for
idx
,
time
in
enumerate
(
time_keys
):
if
(
idx
%
4
)
!=
0
:
continue
print
(
100.0
*
(
idx
/
len
(
time_keys
)))
reports
=
ice_dict
[
time
]
for
tup
in
reports
:
lat
,
lon
,
fl
,
rpt_str
=
tup
lat_s
[
0
]
=
lat
lon_s
[
0
]
=
lon
images
,
_
,
_
,
idxs
=
get_images
(
lon_s
,
lat_s
,
time
,
[
'
14
'
],
[
10
],
[
1
])
if
images
is
not
None
:
counts
,
edges
=
np
.
histogram
(
images
[
0
,],
range
=
[
150
,
350
],
bins
=
20
)
clvr_ds
=
get_clavrx_datasource
(
time
)
clvr_file
=
clvr_ds
.
get_file
(
time
)
cc
,
ll
=
nav
.
earth_to_lc_s
(
lon_s
,
lat_s
)
try
:
h5f
=
h5py
.
File
(
clvr_file
,
'
r
'
)
except
Exception
:
h5f
.
close
()
print
(
'
Problem with file:
'
,
clvr_file
)
continue
gvals
=
get_grid_values
(
h5f
,
'
temp_11_0um_nom
'
,
ll
[
0
],
cc
[
0
],
20
)
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