Commit 03f43f98 authored by BO ZHANG's avatar BO ZHANG 🏀
Browse files

add CsstMsFile

parent a9519212
......@@ -1017,7 +1017,6 @@ class CsstMsFile(dict):
self.filename = os.path.basename(filepath)
self.dir_l0 = os.path.dirname(filepath)
print("parsing", filepath)
# parse filename
pattern = re.compile(
r"(?P<telescope>[A-Z]+)_"
......@@ -1033,7 +1032,11 @@ class CsstMsFile(dict):
r"(?P<ext>[a-zA-Z._]+)"
)
mo = re.fullmatch(pattern, self.filename)
try:
assert mo is not None
except AssertionError as ae:
print(self.filename)
raise ae
mogd = mo.groupdict()
# mogd.pop("detector")
......@@ -1079,6 +1082,8 @@ class CsstMsFile(dict):
return CsstMsFile(
filepath=rec["data"].file_path, ver_sim=ver_sim, dir_l0=dir_l0, dir_l1=dir_l1, dfs_root=dfs_root, **header)
def __repr__(self):
return f"CsstMsFile({self.filename})"
# file = CsstMsFile(
# "L1/MSC/SCI/62173/10160000108/CSST_MSC_MS_SCI_20290206174352_20290206174622_10160000108_21_L1_V01.fits")
#
......
Supports Markdown
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