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
971d1cbc
Commit
971d1cbc
authored
2 years ago
by
tomrink
Browse files
Options
Downloads
Patches
Plain Diff
snapshot...
parent
f4518a55
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/util/viirs.py
+31
-13
31 additions, 13 deletions
modules/util/viirs.py
with
31 additions
and
13 deletions
modules/util/viirs.py
+
31
−
13
View file @
971d1cbc
...
@@ -3,20 +3,21 @@ import h5py
...
@@ -3,20 +3,21 @@ import h5py
from
util.util
import
get_grid_values
,
get_grid_values_all
from
util.util
import
get_grid_values
,
get_grid_values_all
import
glob
import
glob
from
pathlib
import
Path
from
pathlib
import
Path
import
os
mod_res_params
=
[
'
M07
'
,
'
M08
'
,
'
M10
'
,
'
M12
'
,
'
M13
'
,
'
M14
'
,
'
M15
'
,
'
M16
'
]
mod_res_params
=
[
'
M07
'
,
'
M08
'
,
'
M10
'
,
'
M12
'
,
'
M13
'
,
'
M14
'
,
'
M15
'
,
'
M16
'
]
img_res_params
=
[
'
M07_highres
'
,
'
M08_highres
'
,
'
M10_highres
'
,
'
M12_highres
'
,
'
M13_highres
'
,
'
M14_highres
'
,
'
M15_highres
'
,
'
M16_highres
'
]
img_res_params
=
[
'
M07_highres
'
,
'
M08_highres
'
,
'
M10_highres
'
,
'
M12_highres
'
,
'
M13_highres
'
,
'
M14_highres
'
,
'
M15_highres
'
,
'
M16_highres
'
]
def
run_all
(
directory
):
def
run_all
(
directory
):
mod_files
=
glob
.
glob
(
directory
+
'
*.uwssec.nc
'
)
mod_files
=
Path
(
directory
).
rglob
(
'
*.uwssec.nc
'
)
img_files
=
glob
.
glob
(
directory
+
'
*.uwssec.highres.nc
'
)
mod_tiles
=
[]
mod_tiles
=
[]
img_tiles
=
[]
img_tiles
=
[]
for
idx
,
mfile
in
enumerate
(
mod_files
):
for
idx
,
mfile
in
enumerate
(
mod_files
):
ifile
=
img_files
[
idx
]
w_o_ext
,
ext
=
os
.
path
.
splitext
(
mfile
)
ifile
=
w_o_ext
+
'
uwssec
'
+
ext
run
(
mfile
,
ifile
,
mod_tiles
,
img_tiles
)
run
(
mfile
,
ifile
,
mod_tiles
,
img_tiles
)
mod_nda
=
np
.
stack
(
mod_tiles
)
mod_nda
=
np
.
stack
(
mod_tiles
)
...
@@ -55,17 +56,34 @@ def run(mod_res_filename, img_res_filename, mod_tiles, img_tiles):
...
@@ -55,17 +56,34 @@ def run(mod_res_filename, img_res_filename, mod_tiles, img_tiles):
mod_data
=
get_grid_values
(
mod_h5f
,
mod_param
,
0
,
0
,
None
,
mod_num_lines
,
mod_num_pixels
,
range_name
=
None
)
mod_data
=
get_grid_values
(
mod_h5f
,
mod_param
,
0
,
0
,
None
,
mod_num_lines
,
mod_num_pixels
,
range_name
=
None
)
img_data
=
get_grid_values
(
img_h5f
,
img_param
,
0
,
0
,
None
,
img_num_lines
,
img_num_pixels
,
range_name
=
None
)
img_data
=
get_grid_values
(
img_h5f
,
img_param
,
0
,
0
,
None
,
img_num_lines
,
img_num_pixels
,
range_name
=
None
)
for
j
in
range
(
mod_num_y_tiles
):
num_cntr_tiles
=
2
j_m
=
j
*
mod_tile_width
i_c
=
int
(
mod_num_pixels
/
num_cntr_tiles
)
# center
j_skip
=
int
(
mod_num_y_tiles
/
num_cntr_tiles
)
*
mod_tile_width
for
k
in
range
(
num_cntr_tiles
):
j_c
=
k
*
j_skip
j_m
=
j_c
j_i
=
j_m
*
2
j_i
=
j_m
*
2
for
i
in
range
(
mod_num_x_tiles
):
i_m
=
i
*
mod_tile_width
i_m
=
i_c
i_i
=
i_m
*
2
i_i
=
i_m
*
2
nda
=
mod_data
[
j_m
:
j_m
+
mod_tile_width
,
i_m
:
i_m
+
mod_tile_width
]
nda
=
mod_data
[
j_m
:
j_m
+
mod_tile_width
,
i_m
:
i_m
+
mod_tile_width
]
mod_tiles
.
append
(
nda
)
mod_tiles
.
append
(
nda
)
nda
=
img_data
[
j_i
:
j_i
+
img_tile_width
,
i_i
:
i_i
+
img_tile_width
]
img_tiles
.
append
(
nda
)
nda
=
img_data
[
j_i
:
j_i
+
img_tile_width
,
i_i
:
i_i
+
img_tile_width
]
img_tiles
.
append
(
nda
)
# for j in range(mod_num_y_tiles):
# j_m = j * mod_tile_width
# j_i = j_m * 2
# for i in range(mod_num_x_tiles):
# i_m = i * mod_tile_width
# i_i = i_m * 2
#
# nda = mod_data[j_m:j_m+mod_tile_width, i_m:i_m+mod_tile_width]
# mod_tiles.append(nda)
# nda = img_data[j_i:j_i+img_tile_width, i_i:i_i+img_tile_width]
# img_tiles.append(nda)
mod_h5f
.
close
()
mod_h5f
.
close
()
img_h5f
.
close
()
img_h5f
.
close
()
...
...
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