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
a4535430
Commit
a4535430
authored
2 years ago
by
tomrink
Browse files
Options
Downloads
Patches
Plain Diff
snapshot...
parent
57c5d969
Branches
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
+60
-52
60 additions, 52 deletions
modules/icing/pirep_goes.py
with
60 additions
and
52 deletions
modules/icing/pirep_goes.py
+
60
−
52
View file @
a4535430
...
@@ -1237,8 +1237,8 @@ def apply_qc_icing_pireps(icing_alt, cld_top_hgt, cld_geo_dz, cld_phase, cld_opd
...
@@ -1237,8 +1237,8 @@ def apply_qc_icing_pireps(icing_alt, cld_top_hgt, cld_geo_dz, cld_phase, cld_opd
# continue
# continue
# if not (500.0 < icing_alt[i] < 3000.0):
# if not (500.0 < icing_alt[i] < 3000.0):
if
not
(
icing_alt
[
i
]
<
4000.0
):
#
if not (icing_alt[i] < 4000.0):
continue
#
continue
keep_0
=
np
.
logical_or
(
cld_mask
[
i
,]
==
2
,
cld_mask
[
i
,]
==
3
)
# cloudy
keep_0
=
np
.
logical_or
(
cld_mask
[
i
,]
==
2
,
cld_mask
[
i
,]
==
3
)
# cloudy
keep_1
=
np
.
invert
(
np
.
isnan
(
cld_top_hgt
[
i
,]))
keep_1
=
np
.
invert
(
np
.
isnan
(
cld_top_hgt
[
i
,]))
...
@@ -1250,7 +1250,7 @@ def apply_qc_icing_pireps(icing_alt, cld_top_hgt, cld_geo_dz, cld_phase, cld_opd
...
@@ -1250,7 +1250,7 @@ def apply_qc_icing_pireps(icing_alt, cld_top_hgt, cld_geo_dz, cld_phase, cld_opd
continue
continue
# Test 1
# Test 1
keep
=
np
.
where
(
keep
,
(
cld_top_hgt
[
i
,]
+
closeness_top
)
>
4000.0
,
False
)
keep
=
np
.
where
(
keep
,
(
cld_top_hgt
[
i
,]
+
closeness_top
)
>
icing_alt
[
i
]
,
False
)
# keep = np.where(keep, (cld_top_hgt[i,] - max_depth) < icing_alt[i], False)
# keep = np.where(keep, (cld_top_hgt[i,] - max_depth) < icing_alt[i], False)
# keep = np.where(keep, np.logical_and(bt_11um[i,] > 228.0, bt_11um[i,] < 270.0), False)
# keep = np.where(keep, np.logical_and(bt_11um[i,] > 228.0, bt_11um[i,] < 270.0), False)
...
@@ -1297,8 +1297,8 @@ def apply_qc_no_icing_pireps(icing_alt, cld_top_hgt, cld_geo_dz, cld_phase, cld_
...
@@ -1297,8 +1297,8 @@ def apply_qc_no_icing_pireps(icing_alt, cld_top_hgt, cld_geo_dz, cld_phase, cld_
# continue
# continue
# if not (500.0 < icing_alt[i] < 3000.0):
# if not (500.0 < icing_alt[i] < 3000.0):
if
not
(
icing_alt
[
i
]
<
4000.0
):
#
if not (icing_alt[i] < 4000.0):
continue
#
continue
keep_0
=
np
.
logical_or
(
cld_mask
[
i
,]
==
2
,
cld_mask
[
i
,]
==
3
)
# cloudy
keep_0
=
np
.
logical_or
(
cld_mask
[
i
,]
==
2
,
cld_mask
[
i
,]
==
3
)
# cloudy
keep_1
=
np
.
invert
(
np
.
isnan
(
cld_top_hgt
[
i
,]))
keep_1
=
np
.
invert
(
np
.
isnan
(
cld_top_hgt
[
i
,]))
...
@@ -1309,7 +1309,7 @@ def apply_qc_no_icing_pireps(icing_alt, cld_top_hgt, cld_geo_dz, cld_phase, cld_
...
@@ -1309,7 +1309,7 @@ def apply_qc_no_icing_pireps(icing_alt, cld_top_hgt, cld_geo_dz, cld_phase, cld_
if
num_keep
==
0
:
if
num_keep
==
0
:
continue
continue
keep
=
np
.
where
(
keep
,
(
cld_top_hgt
[
i
,]
+
closeness_top
)
>
4000.0
,
False
)
keep
=
np
.
where
(
keep
,
(
cld_top_hgt
[
i
,]
+
closeness_top
)
>
icing_alt
[
i
]
,
False
)
# keep = np.where(keep, (cld_top_hgt[i,] - max_depth) < icing_alt[i], False)
# keep = np.where(keep, (cld_top_hgt[i,] - max_depth) < icing_alt[i], False)
# keep = np.where(keep, np.logical_and(bt_11um[i,] > 228.0, bt_11um[i,] < 270.0), False)
# keep = np.where(keep, np.logical_and(bt_11um[i,] > 228.0, bt_11um[i,] < 270.0), False)
...
@@ -1590,53 +1590,61 @@ def tile_extract(icing_files, no_icing_files, trnfile='/home/rink/tiles_train.h5
...
@@ -1590,53 +1590,61 @@ def tile_extract(icing_files, no_icing_files, trnfile='/home/rink/tiles_train.h5
ice_flt_alt_s
=
np
.
array
(
ice_flt_alt_s
)
ice_flt_alt_s
=
np
.
array
(
ice_flt_alt_s
)
num_ice
=
icing_int_s
.
shape
[
0
]
num_ice
=
icing_int_s
.
shape
[
0
]
# No icing ------------------------------------------------------------
# # No icing ------------------------------------------------------------
num_no_ice
=
0
# num_no_ice = 0
for
fidx
in
range
(
len
(
no_icing_files
)):
# for fidx in range(len(no_icing_files)):
fname
=
no_icing_files
[
fidx
]
# fname = no_icing_files[fidx]
f
=
h5py
.
File
(
fname
,
'
r
'
)
# f = h5py.File(fname, 'r')
h5_s_no_icing
.
append
(
f
)
# h5_s_no_icing.append(f)
#
times
=
f
[
'
time
'
]
# times = f['time']
num_obs
=
len
(
times
)
# num_obs = len(times)
lons
=
f
[
'
longitude
'
]
# lons = f['longitude']
lats
=
f
[
'
latitude
'
]
# lats = f['latitude']
flt_altitude
=
f
[
'
icing_altitude
'
][:]
# flt_altitude = f['icing_altitude'][:]
#
for
i
in
range
(
num_obs
):
# for i in range(num_obs):
cld_msk
=
f
[
cld_mask_name
][
i
,
n_a
:
n_b
,
m_a
:
m_b
]
# cld_msk = f[cld_mask_name][i, n_a:n_b, m_a:m_b]
for
ds_name
in
params
:
# for ds_name in params:
dat
=
f
[
ds_name
][
i
,
n_a
:
n_b
,
m_a
:
m_b
]
# dat = f[ds_name][i, n_a:n_b, m_a:m_b]
if
L1B_or_L2
==
'
L2
'
:
# if L1B_or_L2 == 'L2':
keep
=
np
.
logical_or
(
cld_msk
==
2
,
cld_msk
==
3
)
# cloudy
# keep = np.logical_or(cld_msk == 2, cld_msk == 3) # cloudy
np
.
where
(
keep
,
dat
,
np
.
nan
)
# np.where(keep, dat, np.nan)
no_icing_data_dct
[
ds_name
].
append
(
dat
)
# no_icing_data_dct[ds_name].append(dat)
num_no_ice
+=
1
# num_no_ice += 1
no_ice_time_s
.
append
(
times
[
i
])
# no_ice_time_s.append(times[i])
no_ice_lon_s
.
append
(
lons
[
i
])
# no_ice_lon_s.append(lons[i])
no_ice_lat_s
.
append
(
lats
[
i
])
# no_ice_lat_s.append(lats[i])
no_ice_flt_alt_s
.
append
(
flt_altitude
[
i
])
# no_ice_flt_alt_s.append(flt_altitude[i])
#
print
(
fname
)
# print(fname)
#
for
ds_name
in
params
:
# for ds_name in params:
lst
=
no_icing_data_dct
[
ds_name
]
# lst = no_icing_data_dct[ds_name]
no_icing_data_dct
[
ds_name
]
=
np
.
stack
(
lst
,
axis
=
0
)
# no_icing_data_dct[ds_name] = np.stack(lst, axis=0)
no_icing_int_s
=
np
.
full
(
num_no_ice
,
-
1
)
# no_icing_int_s = np.full(num_no_ice, -1)
no_ice_time_s
=
np
.
array
(
no_ice_time_s
)
# no_ice_time_s = np.array(no_ice_time_s)
no_ice_lon_s
=
np
.
array
(
no_ice_lon_s
)
# no_ice_lon_s = np.array(no_ice_lon_s)
no_ice_lat_s
=
np
.
array
(
no_ice_lat_s
)
# no_ice_lat_s = np.array(no_ice_lat_s)
no_ice_flt_alt_s
=
np
.
array
(
no_ice_flt_alt_s
)
# no_ice_flt_alt_s = np.array(no_ice_flt_alt_s)
#
icing_intensity
=
np
.
concatenate
([
icing_int_s
,
no_icing_int_s
])
# icing_intensity = np.concatenate([icing_int_s, no_icing_int_s])
icing_times
=
np
.
concatenate
([
ice_time_s
,
no_ice_time_s
])
# icing_times = np.concatenate([ice_time_s, no_ice_time_s])
icing_lons
=
np
.
concatenate
([
ice_lon_s
,
no_ice_lon_s
])
# icing_lons = np.concatenate([ice_lon_s, no_ice_lon_s])
icing_lats
=
np
.
concatenate
([
ice_lat_s
,
no_ice_lat_s
])
# icing_lats = np.concatenate([ice_lat_s, no_ice_lat_s])
icing_alt
=
np
.
concatenate
([
ice_flt_alt_s
,
no_ice_flt_alt_s
])
# icing_alt = np.concatenate([ice_flt_alt_s, no_ice_flt_alt_s])
icing_intensity
=
icing_int_s
icing_times
=
ice_time_s
icing_lons
=
ice_lon_s
icing_lats
=
ice_lat_s
icing_alt
=
ice_flt_alt_s
data_dct
=
{}
data_dct
=
{}
# for ds_name in params:
# data_dct[ds_name] = np.concatenate([icing_data_dct[ds_name], no_icing_data_dct[ds_name]])
for
ds_name
in
params
:
for
ds_name
in
params
:
data_dct
[
ds_name
]
=
np
.
concatenate
([
icing_data_dct
[
ds_name
]
,
no_icing_data_dct
[
ds_name
]])
data_dct
[
ds_name
]
=
icing_data_dct
[
ds_name
]
# do sort -------------------------------------
# do sort -------------------------------------
ds_indexes
=
np
.
argsort
(
icing_times
)
ds_indexes
=
np
.
argsort
(
icing_times
)
...
@@ -1781,8 +1789,8 @@ def tile_extract(icing_files, no_icing_files, trnfile='/home/rink/tiles_train.h5
...
@@ -1781,8 +1789,8 @@ def tile_extract(icing_files, no_icing_files, trnfile='/home/rink/tiles_train.h5
for
h5f
in
h5_s_icing
:
for
h5f
in
h5_s_icing
:
h5f
.
close
()
h5f
.
close
()
for
h5f
in
h5_s_no_icing
:
#
for h5f in h5_s_no_icing:
h5f
.
close
()
#
h5f.close()
def
write_file
(
outfile
,
params
,
param_types
,
data_dct
,
icing_intensity
,
icing_times
,
icing_lons
,
icing_lats
,
icing_alt
):
def
write_file
(
outfile
,
params
,
param_types
,
data_dct
,
icing_intensity
,
icing_times
,
icing_lons
,
icing_lats
,
icing_alt
):
...
...
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