Skip to content
Snippets Groups Projects
Commit f5ab9d63 authored by Greg Quinn's avatar Greg Quinn
Browse files

Determine output file name automatically

parent f6677227
No related branches found
No related tags found
No related merge requests found
......@@ -83,20 +83,26 @@ def unix_time(t):
return (t - datetime(1970, 1, 1)).total_seconds()
def output_file_name(args):
earlier_time = min(args.metop_time, args.npp_time)
return 'sno_{}_npp_{}_{}.h5'.format(args.iasi_platform.lower(), args.sensor.lower(),
earlier_time.strftime('%Y-%m-%dT%H-%M'))
def main():
args = _parse_args()
granule = _create_granule(args.sensor, args.files)
scan_idx, for_idx, fov_idx = (
_filter_by_proximity(granule, args.latitude, args.longitude, args.max_distance))
with h5py.File(args.output_file, 'w') as output_file:
with h5py.File(output_file_name(args), 'w') as output_file:
_process_spectra(granule, granule.radiance, scan_idx, for_idx, fov_idx,
output_file)
if granule.has_imaginary_radiance:
_process_spectra(
granule, granule.imaginary_radiance, scan_idx, for_idx, fov_idx,
output_file, 'Imaginary')
output_file.create_dataset('Metop-{}_Time'.format(arg.iasi_platform[-1].upper()),
output_file.create_dataset('Metop-{}_Time'.format(args.iasi_platform[-1].upper()),
data=unix_time(args.metop_time))
output_file.create_dataset('NPP_Time', data=unix_time(args.npp_time))
output_file.create_dataset('SNO_Latitude', data=args.latitude)
......
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