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
75823dc8
Commit
75823dc8
authored
3 years ago
by
tomrink
Browse files
Options
Downloads
Patches
Plain Diff
more work on manual/hard coded metadata, stupid files...
parent
62c9aed6
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
+8
-6
8 additions, 6 deletions
modules/icing/pirep_goes.py
with
8 additions
and
6 deletions
modules/icing/pirep_goes.py
+
8
−
6
View file @
75823dc8
...
...
@@ -31,6 +31,7 @@ l1b_ds_list = ['temp_10_4um_nom', 'temp_11_0um_nom', 'temp_12_0um_nom', 'temp_13
'
refl_0_47um_nom
'
,
'
refl_0_65um_nom
'
,
'
refl_0_86um_nom
'
,
'
refl_1_38um_nom
'
,
'
refl_1_60um_nom
'
]
l1b_ds_types
=
[
'
f4
'
for
ds
in
l1b_ds_list
]
l1b_ds_fill
=
[
-
32767
for
i
in
range
(
10
)]
+
[
-
32768
for
i
in
range
(
5
)]
l1b_ds_range
=
[
'
acutal_range
'
for
ds
in
l1b_ds_list
]
ds_list
=
[
'
cld_height_acha
'
,
'
cld_geo_thick
'
,
'
cld_press_acha
'
,
'
sensor_zenith_angle
'
,
'
supercooled_prob_acha
'
,
'
supercooled_cloud_fraction
'
,
'
cld_temp_acha
'
,
'
cld_opd_acha
'
,
'
solar_zenith_angle
'
,
...
...
@@ -39,6 +40,7 @@ ds_list = ['cld_height_acha', 'cld_geo_thick', 'cld_press_acha', 'sensor_zenith_
'
lwc_dcomp
'
,
'
cld_emiss_acha
'
,
'
conv_cloud_fraction
'
,
'
cloud_type
'
,
'
cloud_phase
'
,
'
cloud_mask
'
]
ds_types
=
[
'
f4
'
for
i
in
range
(
23
)]
+
[
'
i1
'
for
i
in
range
(
3
)]
ds_fill
=
[
-
32768
for
i
in
range
(
23
)]
+
[
-
128
for
i
in
range
(
3
)]
ds_range
=
[
'
actual_range
'
for
i
in
range
(
23
)]
+
[
None
for
i
in
range
(
3
)]
# An example file for accessing and copying metadata
a_clvr_file
=
'
/home/rink/data/clavrx/clavrx_OR_ABI-L1b-RadC-M3C01_G16_s20190020002186.level2.nc
'
...
...
@@ -116,21 +118,21 @@ def get_grid_values(h5f, grid_name, j_c, i_c, half_width, scale_factor_name='sca
if
scale_factor_name
is
not
None
:
attr
=
attrs
.
get
(
scale_factor_name
)
if
attr
is
None
:
raise
GenericException
(
'
Attribute:
'
+
scale_factor_name
+
'
not found for
variable
:
'
+
grid_name
)
raise
GenericException
(
'
Attribute:
'
+
scale_factor_name
+
'
not found for
dataset
:
'
+
grid_name
)
scale_factor
=
attr
[
0
]
grd_vals
=
grd_vals
*
scale_factor
if
add_offset_name
is
not
None
:
attr
=
attrs
.
get
(
add_offset_name
)
if
attr
is
None
:
raise
GenericException
(
'
Attribute:
'
+
add_offset_name
+
'
not found for
variable
:
'
+
grid_name
)
raise
GenericException
(
'
Attribute:
'
+
add_offset_name
+
'
not found for
dataset
:
'
+
grid_name
)
add_offset
=
attr
[
0
]
grd_vals
=
grd_vals
+
add_offset
if
range_name
is
not
None
:
attr
=
attrs
.
get
(
range_name
)
if
attr
is
None
:
raise
GenericException
(
'
Attribute:
'
+
range_name
+
'
not found for
variable
:
'
+
grid_name
)
raise
GenericException
(
'
Attribute:
'
+
range_name
+
'
not found for
dataset
:
'
+
grid_name
)
low
=
attr
[
0
]
high
=
attr
[
1
]
grd_vals
=
np
.
where
(
grd_vals
<
low
,
np
.
nan
,
grd_vals
)
...
...
@@ -138,7 +140,7 @@ def get_grid_values(h5f, grid_name, j_c, i_c, half_width, scale_factor_name='sca
elif
fill_value_name
is
not
None
:
attr
=
attrs
.
get
(
fill_value_name
)
if
attr
is
None
:
raise
GenericException
(
'
Attribute:
'
+
fill_value_name
+
'
not found for
variable
:
'
+
grid_name
)
raise
GenericException
(
'
Attribute:
'
+
fill_value_name
+
'
not found for
dataset
:
'
+
grid_name
)
fill_value
=
attr
[
0
]
grd_vals
=
np
.
where
(
grd_vals
==
fill_value
,
np
.
nan
,
grd_vals
)
...
...
@@ -275,14 +277,14 @@ def run(pirep_dct, outfile=None, outfile_l1b=None, dt_str_start=None, dt_str_end
cnt_a
=
0
for
didx
,
ds_name
in
enumerate
(
ds_list
):
gvals
=
get_grid_values
(
h5f
,
ds_name
,
ll_a
[
0
],
cc_a
[
0
],
20
,
fill_value_name
=
None
,
range_name
=
None
,
fill_value
=
ds_fill
[
didx
])
gvals
=
get_grid_values
(
h5f
,
ds_name
,
ll_a
[
0
],
cc_a
[
0
],
20
,
fill_value_name
=
None
,
range_name
=
ds_range
[
didx
]
,
fill_value
=
ds_fill
[
didx
])
if
gvals
is
not
None
:
ds_grd_dct
[
ds_name
].
append
(
gvals
)
cnt_a
+=
1
cnt_b
=
0
for
didx
,
ds_name
in
enumerate
(
l1b_ds_list
):
gvals
=
get_grid_values
(
h5f
,
ds_name
,
ll_a
[
0
],
cc_a
[
0
],
20
,
fill_value_name
=
None
,
range_name
=
None
,
fill_value
=
l1b_ds_fill
[
didx
])
gvals
=
get_grid_values
(
h5f
,
ds_name
,
ll_a
[
0
],
cc_a
[
0
],
20
,
fill_value_name
=
None
,
range_name
=
l1b_ds_range
[
didx
]
,
fill_value
=
l1b_ds_fill
[
didx
])
if
gvals
is
not
None
:
l1b_grd_dct
[
ds_name
].
append
(
gvals
)
cnt_b
+=
1
...
...
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