Skip to content
Snippets Groups Projects
Commit 789f30ed authored by tomrink's avatar tomrink
Browse files

snapshot...

parent 1f678763
Branches
No related tags found
No related merge requests found
......@@ -95,6 +95,39 @@ def run(mod_res_filename, img_res_filename, mod_tiles, img_tiles):
img_h5f.close()
def run_mean_std(directory):
data_dct = {name: [] for name in mod_res_params}
mean_dct = {name: 0 for name in mod_res_params}
std_dct = {name: 0 for name in mod_res_params}
cnt = 0
for p in os.scandir(directory):
if not p.is_dir():
continue
cnt += 1
mod_files = glob.glob(directory+p.name+'/'+'*.uwssec.nc')
for idx, mfile in enumerate(mod_files):
if idx % 8 == 0:
h5f = h5py.File(mfile, 'r')
for param in mod_res_params:
gvals = get_grid_values_all(h5f, param, range_name=None, stride=10)
data_dct[param].append(gvals.flatten())
print(mfile)
h5f.close()
for param in mod_res_params:
data = data_dct[param]
data = np.concatenate(data)
mean_dct[param] = np.nanmean(data)
std_dct[param] = np.nanstd(data)
print(mean_dct)
print(std_dct)
def run_test(directory):
# files = glob.glob(directory + 'clavrx_snpp_viirs*.h5')
files = Path(directory).rglob('clavrx_snpp_viirs*.h5')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment