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
10ba648a
Commit
10ba648a
authored
1 year ago
by
tomrink
Browse files
Options
Downloads
Patches
Plain Diff
snapshot...
parent
03ce7260
No related branches found
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/util/abi_surfrad.py
+21
-3
21 additions, 3 deletions
modules/util/abi_surfrad.py
with
21 additions
and
3 deletions
modules/util/abi_surfrad.py
+
21
−
3
View file @
10ba648a
...
...
@@ -10,6 +10,7 @@ group_name_i = 'super/'
group_name_m
=
'
orig/
'
solzen_name
=
group_name_m
+
'
solar_zenith
'
snow_class_name
=
group_name_m
+
'
snow_class
'
params_i
=
[
group_name_i
+
'
temp_ch38
'
,
group_name_i
+
'
refl_ch01
'
,
group_name_i
+
target_param
]
params_m
=
[
group_name_m
+
'
temp_ch38
'
,
group_name_m
+
'
refl_ch01
'
,
group_name_m
+
'
refl_submin_ch01
'
,
...
...
@@ -19,6 +20,10 @@ param_idx_m = params_m.index(group_name_m + target_param)
param_idx_i
=
params_i
.
index
(
group_name_i
+
target_param
)
def
snow_covered
(
tile
):
return
np
.
any
(
tile
>
1
)
def
is_missing
(
p_idx
,
tile
):
keep
=
np
.
invert
(
np
.
isnan
(
tile
[
p_idx
,
]))
if
np
.
sum
(
keep
)
/
keep
.
size
<
0.98
:
...
...
@@ -64,7 +69,7 @@ def process_cld_opd(grd_k):
return
grd_k
def
run_all
(
directory
,
out_directory
,
day_night
=
'
ANY
'
,
pattern
=
'
clavrx_*.nc
'
,
start
=
10
):
def
run_all
(
directory
,
out_directory
,
day_night
=
'
ANY
'
,
pattern
=
'
clavrx_*.nc
'
,
start
=
10
,
is_snow_covered
=
None
):
cnt
=
start
total_num_train_samples
=
0
total_num_valid_samples
=
0
...
...
@@ -95,7 +100,8 @@ def run_all(directory, out_directory, day_night='ANY', pattern='clavrx_*.nc', st
try
:
num_not_missing
=
run
(
h5f
,
params_m
,
data_tiles_m
,
params_i
,
data_tiles_i
,
num_keep_x_tiles
=
num_keep_x_tiles
,
tile_width
=
16
,
kernel_size
=
4
,
factor
=
4
,
day_night
=
day_night
)
num_keep_x_tiles
=
num_keep_x_tiles
,
tile_width
=
16
,
kernel_size
=
4
,
factor
=
4
,
day_night
=
day_night
,
is_snow_covered
=
is_snow_covered
)
except
Exception
as
e
:
print
(
e
)
h5f
.
close
()
...
...
@@ -208,7 +214,8 @@ def run_all(directory, out_directory, day_night='ANY', pattern='clavrx_*.nc', st
# tile_width: Must be even!
# kernel_size: Must be odd!
def
run
(
h5f
,
params_m
,
data_tiles_m
,
params_i
,
data_tiles_i
,
num_keep_x_tiles
=
8
,
tile_width
=
64
,
kernel_size
=
3
,
factor
=
2
,
day_night
=
'
ANY
'
):
def
run
(
h5f
,
params_m
,
data_tiles_m
,
params_i
,
data_tiles_i
,
num_keep_x_tiles
=
8
,
tile_width
=
64
,
kernel_size
=
3
,
factor
=
2
,
day_night
=
'
ANY
'
,
is_snow_covered
=
None
):
border
=
int
((
kernel_size
-
1
)
/
2
)
+
1
# Need to add for interpolation with no edge effects
...
...
@@ -220,6 +227,9 @@ def run(h5f, params_m, data_tiles_m, params_i, data_tiles_i, num_keep_x_tiles=8,
if
day_night
!=
'
ANY
'
:
solzen
=
get_grid_values
(
h5f
,
solzen_name
,
0
,
0
,
None
,
num_lines
,
num_pixels
)
if
is_snow_covered
is
not
None
:
snow
=
get_grid_values
(
h5f
,
snow_class_name
,
0
,
0
,
None
,
num_lines
,
num_pixels
)
grd_s
=
[]
for
param
in
params_m
:
try
:
...
...
@@ -259,6 +269,14 @@ def run(h5f, params_m, data_tiles_m, params_i, data_tiles_i, num_keep_x_tiles=8,
i_a
=
i_start
+
i
*
i_skip
i_b
=
i_a
+
tile_width
if
is_snow_covered
is
not
None
:
if
is_snow_covered
:
if
not
snow_covered
(
snow
[
j_a
:
j_b
,
i_a
:
i_b
]):
continue
else
:
if
snow_covered
(
snow
[
j_a
:
j_b
,
i_a
:
i_b
]):
continue
if
day_night
==
'
DAY
'
and
not
is_day
(
solzen
[
j_a
:
j_b
,
i_a
:
i_b
]):
continue
elif
day_night
==
'
NIGHT
'
and
is_day
(
solzen
[
j_a
:
j_b
,
i_a
:
i_b
]):
...
...
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