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
8ddeb13d
Commit
8ddeb13d
authored
2 years ago
by
tomrink
Browse files
Options
Downloads
Patches
Plain Diff
initial commit...
parent
34a1faed
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
+54
-54
54 additions, 54 deletions
modules/icing/pirep_goes.py
with
54 additions
and
54 deletions
modules/icing/pirep_goes.py
+
54
−
54
View file @
8ddeb13d
...
@@ -1590,61 +1590,61 @@ def tile_extract(icing_files, no_icing_files, trnfile='/home/rink/tiles_train.h5
...
@@ -1590,61 +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_intensity = icing_int_s
icing_times
=
ice_time_s
#
icing_times = ice_time_s
icing_lons
=
ice_lon_s
#
icing_lons = ice_lon_s
icing_lats
=
ice_lat_s
#
icing_lats = ice_lat_s
icing_alt
=
ice_flt_alt_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
]
=
icing_data_dct
[
ds_name
]
data_dct
[
ds_name
]
=
np
.
concatenate
([
icing_data_dct
[
ds_name
],
no_icing_data_dct
[
ds_name
]])
# for ds_name in params:
# 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
)
...
@@ -1789,8 +1789,8 @@ def tile_extract(icing_files, no_icing_files, trnfile='/home/rink/tiles_train.h5
...
@@ -1789,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