Commit 826100b5 authored by Niklas Bohn's avatar Niklas Bohn
Browse files

Extended list of errors for try-except clause when loading contents of S2...


Extended list of errors for try-except clause when loading contents of S2 novelty detector and removed some unnecessary file closing statements.
Signed-off-by: Niklas Bohn's avatarnbohn <nbohn@gfz-potsdam.de>
parent 4b760c27
......@@ -59,8 +59,7 @@ class CloudMask(S2cB):
with open(novelty_detector, "rb") as fl:
nvc = pickle.load(fl)
ncv_clf = pickle.load(fl)
fl.close()
except ModuleNotFoundError:
except (ModuleNotFoundError, AttributeError, KeyError):
# download training data base for novelty detector from google drive
logger.info("Novelty detector has to be updated with a newer version of scikit-learn.")
logger.info("Download training data base from google drive.")
......@@ -82,14 +81,11 @@ class CloudMask(S2cB):
pickle.dump(nv, fl)
pickle.dump({"id": [tuple(ids) for ids in bf["id"]], "fk": [str(ids) for ids in bf["fk"]]},
fl)
fl.close()
h5f.close()
# reload novelty detector
with open(novelty_detector, "rb") as fl:
nvc = pickle.load(fl)
ncv_clf = pickle.load(fl)
fl.close()
else:
raise ValueError("Novelty detector file type not implemented")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment