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
cd131c50
Commit
cd131c50
authored
4 years ago
by
tomrink
Browse files
Options
Downloads
Patches
Plain Diff
snapshot...
parent
a27fff1a
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
+19
-5
19 additions, 5 deletions
modules/icing/pirep_goes.py
with
19 additions
and
5 deletions
modules/icing/pirep_goes.py
+
19
−
5
View file @
cd131c50
...
...
@@ -19,7 +19,7 @@ dir_fmt = '%Y_%m_%d_%j'
ds_dct
=
{}
goes_ds_dct
=
{}
#pirep_file = '/home/rink/data/pireps/pireps_2019010000_2019063023.csv'
pirep_file
=
'
/
home/
rink/data/pirep
s
/pireps_20180101_20200331.csv
'
pirep_file
=
'
/
Users/tom
rink/data/pirep/pireps_20180101_20200331.csv
'
l1b_ds_list
=
[
'
temp_10_4um_nom
'
,
'
temp_11_0um_nom
'
,
'
temp_12_0um_nom
'
,
'
temp_13_3um_nom
'
,
'
temp_3_75um_nom
'
,
'
temp_6_2um_nom
'
,
'
temp_6_7um_nom
'
,
'
temp_7_3um_nom
'
,
'
temp_8_5um_nom
'
,
'
temp_9_7um_nom
'
,
...
...
@@ -100,7 +100,7 @@ def get_grid_values(h5f, grid_name, j_c, i_c, half_width, scale_factor_name='sca
return
grd_vals
def
create_file
(
filename
,
data_dct
,
ds_list
,
ds_types
,
lon_c
,
lat_c
,
time_s
,
fl_alt_s
,
icing_intensity
):
def
create_file
(
filename
,
data_dct
,
ds_list
,
ds_types
,
lon_c
,
lat_c
,
time_s
,
fl_alt_s
,
icing_intensity
,
unq_ids
):
h5f_expl
=
h5py
.
File
(
a_clvr_file
,
'
r
'
)
h5f
=
h5py
.
File
(
filename
,
'
w
'
)
...
...
@@ -128,6 +128,8 @@ def create_file(filename, data_dct, ds_list, ds_types, lon_c, lat_c, time_s, fl_
icing_int_ds
=
h5f
.
create_dataset
(
'
icing_intensity
'
,
data
=
icing_intensity
,
dtype
=
'
i4
'
)
icing_int_ds
.
attrs
.
create
(
'
long_name
'
,
data
=
'
0:No intensity report, 1:Trace, 2:Light, 3:Light Moderate, 4:Moderate, 5:Moderate Severe, 6:Severe
'
)
unq_ids_ds
=
h5f
.
create_dataset
(
'
unique_id
'
,
data
=
unq_ids
,
dtype
=
'
i4
'
)
# copy relevant attributes
for
ds_name
in
ds_list
:
h5f_ds
=
h5f
[
ds_name
]
...
...
@@ -171,6 +173,7 @@ def run(pirep_dct, outfile=None, outfile_l1b=None, dt_str_start=None, dt_str_end
time_s
=
[]
fl_alt_s
=
[]
ice_int_s
=
[]
unq_ids
=
[]
for
idx
,
time
in
enumerate
(
time_keys
):
if
t_start
is
not
None
:
...
...
@@ -181,7 +184,7 @@ def run(pirep_dct, outfile=None, outfile_l1b=None, dt_str_start=None, dt_str_end
reports
=
pirep_dct
[
time
]
for
tup
in
reports
:
lat
,
lon
,
fl
,
I
,
rpt_str
=
tup
lat
,
lon
,
fl
,
I
,
id
,
rpt_str
=
tup
lat_s
[
0
]
=
lat
lon_s
[
0
]
=
lon
...
...
@@ -238,6 +241,7 @@ def run(pirep_dct, outfile=None, outfile_l1b=None, dt_str_start=None, dt_str_end
time_s
.
append
(
time
)
fl_alt_s
.
append
(
fl
)
ice_int_s
.
append
(
I
)
unq_ids
.
append
(
id
)
if
reduce
is
True
:
break
...
...
@@ -256,10 +260,11 @@ def run(pirep_dct, outfile=None, outfile_l1b=None, dt_str_start=None, dt_str_end
time_s
=
np
.
array
(
time_s
)
fl_alt_s
=
np
.
array
(
fl_alt_s
)
ice_int_s
=
np
.
array
(
ice_int_s
)
unq_ids
=
np
.
array
(
unq_ids
)
if
outfile
is
not
None
:
outfile
=
add_time_range_to_filename
(
outfile
,
t_start
,
t_end
)
create_file
(
outfile
,
data_dct
,
ds_list
,
ds_types
,
lon_c
,
lat_c
,
time_s
,
fl_alt_s
,
ice_int_s
)
create_file
(
outfile
,
data_dct
,
ds_list
,
ds_types
,
lon_c
,
lat_c
,
time_s
,
fl_alt_s
,
ice_int_s
,
unq_ids
)
data_dct
=
{}
for
ds_name
in
l1b_ds_list
:
...
...
@@ -267,7 +272,7 @@ def run(pirep_dct, outfile=None, outfile_l1b=None, dt_str_start=None, dt_str_end
if
outfile_l1b
is
not
None
:
outfile_l1b
=
add_time_range_to_filename
(
outfile_l1b
,
t_start
,
t_end
)
create_file
(
outfile_l1b
,
data_dct
,
l1b_ds_list
,
l1b_ds_types
,
lon_c
,
lat_c
,
time_s
,
fl_alt_s
,
ice_int_s
)
create_file
(
outfile_l1b
,
data_dct
,
l1b_ds_list
,
l1b_ds_types
,
lon_c
,
lat_c
,
time_s
,
fl_alt_s
,
ice_int_s
,
unq_ids
)
def
analyze2
(
ice_dct
):
...
...
@@ -590,3 +595,12 @@ def apply_qc_icing_pireps(icing_alt, cld_top_hgt, cld_phase, cld_opd, cld_mask,
mask
.
append
(
keep
)
return
mask
def
test
(
flags
,
fkeys
,
ice_dct
):
for
i
,
key
in
enumerate
(
fkeys
):
rpts
=
ice_dct
[
key
]
if
len
(
rpts
)
==
1
:
print
(
flags
[
i
],
rpts
[
0
][
4
])
#for tup in rpts:
# print(flags[i], tup[4])
\ 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