Skip to content
Snippets Groups Projects
Commit 74fd3bb6 authored by tomrink's avatar tomrink
Browse files

fix bug in scale method

parent b28707b4
No related branches found
No related tags found
No related merge requests found
...@@ -23,7 +23,8 @@ def run_all(directory): ...@@ -23,7 +23,8 @@ def run_all(directory):
l2_tiles = [] l2_tiles = []
for idx, l1b_f in enumerate(l1b_files): for idx, l1b_f in enumerate(l1b_files):
if idx % 8 == 0: # if idx % 8 == 0:
if True:
# w_o_ext, ext = os.path.splitext(l1b_f) # w_o_ext, ext = os.path.splitext(l1b_f)
# l2_f = w_o_ext+'.highres'+ext # l2_f = w_o_ext+'.highres'+ext
# if not os.path.exists(l2_f): # if not os.path.exists(l2_f):
...@@ -87,42 +88,43 @@ def run(l1b_h5f, l2_h5f, l1b_tiles, l2_tiles, factor=2): ...@@ -87,42 +88,43 @@ def run(l1b_h5f, l2_h5f, l1b_tiles, l2_tiles, factor=2):
l2_grd_s = [] l2_grd_s = []
for param in emis_params: for param in emis_params:
l1b_grd_s.append(get_grid_values(l1b_h5f, param, 0, 0, None, mod_num_lines, mod_num_pixels, range_name=None)) try:
grd = get_grid_values(l1b_h5f, param, 0, 0, None, mod_num_lines, mod_num_pixels, range_name=None)
l1b_grd_s.append(grd)
except:
return
for param in l2_params: for param in l2_params:
l2_grd_s.append(get_grid_values(l2_h5f, param, 0, 0, None, img_num_lines, img_num_pixels, range_name=None)) try:
grd = get_grid_values(l2_h5f, param, 0, 0, None, img_num_lines, img_num_pixels, range_name=None)
l2_grd_s.append(grd)
except:
return
mod_data = np.stack(l1b_grd_s) mod_data = np.stack(l1b_grd_s)
img_data = np.stack(l2_grd_s) img_data = np.stack(l2_grd_s)
num_cntr_tiles = 10 num_keep_x_tiles = 5
i_c = int(mod_num_pixels / num_cntr_tiles) # center i_skip = int(mod_num_x_tiles / num_keep_x_tiles) * mod_tile_width
j_skip = int(mod_num_y_tiles / num_cntr_tiles) * mod_tile_width i_start = int(mod_num_pixels / 2) + int((num_keep_x_tiles * 3 * 64) / 2)
for k in range(num_cntr_tiles):
j_c = k * j_skip num_keep_y_tiles = 16
j_skip = int(mod_num_y_tiles / num_keep_y_tiles) * mod_tile_width
for j in range(num_keep_y_tiles):
j_c = j * j_skip
j_m = j_c j_m = j_c
j_i = j_m * factor j_i = j_m * factor
i_m = i_c for i in range(num_keep_x_tiles):
i_i = i_m * factor i_c = i * i_skip + i_start
i_m = i_c
nda = mod_data[:, j_m:j_m + mod_tile_width, i_m:i_m + mod_tile_width] i_i = i_m * factor
l1b_tiles.append(nda)
nda = mod_data[:, j_m:j_m + mod_tile_width, i_m:i_m + mod_tile_width]
nda = img_data[:, j_i:j_i + img_tile_width, i_i:i_i + img_tile_width] l1b_tiles.append(nda)
l2_tiles.append(nda)
nda = img_data[:, j_i:j_i + img_tile_width, i_i:i_i + img_tile_width]
# for j in range(mod_num_y_tiles): l2_tiles.append(nda)
# 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)
# def hack(): # def hack():
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment