Added error handling to filter for fits file with no included image array.
This commit is contained in:
parent
cf2165a77b
commit
dad3a80b9a
1 changed files with 7 additions and 3 deletions
|
|
@ -57,7 +57,12 @@ def filter_fits(work_queue):
|
||||||
return
|
return
|
||||||
measurement = job.split("dr_suvi-l2-")[1].split("_")[0][2:]
|
measurement = job.split("dr_suvi-l2-")[1].split("_")[0][2:]
|
||||||
idx = measurement_names.index(measurement)
|
idx = measurement_names.index(measurement)
|
||||||
data = fits.getdata(job)
|
try:
|
||||||
|
data = fits.getdata(job)
|
||||||
|
except IndexError: # This can happen with a blank or corrupt HDU in the .fits file
|
||||||
|
new_name = job.split(".fits")[0] + "_e.fits"
|
||||||
|
os.rename(job, new_name)
|
||||||
|
continue
|
||||||
assert data.shape[0] == expected_dims
|
assert data.shape[0] == expected_dims
|
||||||
assert data.shape[1] == expected_dims
|
assert data.shape[1] == expected_dims
|
||||||
filtered_data = np.zeros_like(data)
|
filtered_data = np.zeros_like(data)
|
||||||
|
|
@ -111,7 +116,6 @@ def filter_fits(work_queue):
|
||||||
os.rename(job, new_name)
|
os.rename(job, new_name)
|
||||||
# print(f"Renamed: {job} -> {new_name}")
|
# print(f"Renamed: {job} -> {new_name}")
|
||||||
|
|
||||||
|
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
return
|
return
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
@ -138,7 +142,7 @@ if __name__ == "__main__":
|
||||||
starttime = calendar.timegm(datetime.datetime(2023, 1, 1, tzinfo=datetime.timezone.utc).timetuple())
|
starttime = calendar.timegm(datetime.datetime(2023, 1, 1, tzinfo=datetime.timezone.utc).timetuple())
|
||||||
stoptime = calendar.timegm(datetime.datetime(2024, 1, 1, tzinfo=datetime.timezone.utc).timetuple())
|
stoptime = calendar.timegm(datetime.datetime(2024, 1, 1, tzinfo=datetime.timezone.utc).timetuple())
|
||||||
|
|
||||||
reprocess_errors = True
|
reprocess_errors = False
|
||||||
nworkers = 20
|
nworkers = 20
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue