Skip to content
Snippets Groups Projects
Commit 13107c4c authored by tomrink's avatar tomrink
Browse files

snapshot...

parent e8398207
No related branches found
No related tags found
No related merge requests found
...@@ -10,32 +10,39 @@ img_res_params = ['M07_highres', 'M08_highres', 'M10_highres', 'M12_highres', 'M ...@@ -10,32 +10,39 @@ img_res_params = ['M07_highres', 'M08_highres', 'M10_highres', 'M12_highres', 'M
def run_all(directory): def run_all(directory):
mod_files = Path(directory).rglob('*.uwssec.nc')
mod_tiles = [] cnt = 0
img_tiles = [] for p in os.scandir(directory):
if not p.is_dir():
for idx, mfile in enumerate(mod_files): continue
if idx % 16 == 0: cnt += 1
w_o_ext, ext = os.path.splitext(mfile) mod_files = glob.glob('*.uwssec.nc')
ifile = w_o_ext+'.highres'+ext
if not os.path.exists(ifile): mod_tiles = []
continue img_tiles = []
print(mfile)
run(mfile, ifile, mod_tiles, img_tiles) for idx, mfile in enumerate(mod_files):
if idx % 16 == 0:
mod_nda = np.stack(mod_tiles) w_o_ext, ext = os.path.splitext(mfile)
img_nda = np.stack(img_tiles) ifile = w_o_ext+'.highres'+ext
if not os.path.exists(ifile):
mod_mean = mod_nda.mean() continue
img_mean = img_nda.mean() print(mfile)
mod_std = mod_nda.std() run(mfile, ifile, mod_tiles, img_tiles)
img_std = img_nda.std()
mod_nda = np.stack(mod_tiles)
mod_nda = (mod_nda - mod_mean) / mod_std img_nda = np.stack(img_tiles)
img_nda = (img_nda - img_mean) / img_std
mod_mean = mod_nda.mean()
return mod_nda, img_nda img_mean = img_nda.mean()
mod_std = mod_nda.std()
img_std = img_nda.std()
mod_nda = (mod_nda - mod_mean) / mod_std
img_nda = (img_nda - img_mean) / img_std
np.save('/data/Personal/rink/viirs/mod_res_'+cnt, mod_nda)
np.save('/data/Personal/rink/viirs/img_res_'+cnt, img_nda)
def run(mod_res_filename, img_res_filename, mod_tiles, img_tiles): def run(mod_res_filename, img_res_filename, mod_tiles, img_tiles):
......
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