Commit 57e9b2c1 authored by Carl Schaffer's avatar Carl Schaffer
Browse files

adding date-run instantiation to GrisRun

parent 70657ec6
......@@ -18,6 +18,7 @@ import matplotlib.pyplot as plt
import numpy as np
from astropy.coordinates import SkyCoord, Angle
from astropy.wcs import WCS
from pandas import to_datetime
from kis_tools.generic.fits import FitsFile
from kis_tools.gris.coord_correction_ml import get_coords_ml
......@@ -62,6 +63,25 @@ class GrisFitsFile(FitsFile):
self.is_parsed = False
def from_date_run(cls, date, run_number):
# Check date for validity, try to cast to date
if not isinstance(date, datetime):
date = to_datetime(date)
# Check operating system and set path accordingly
# Assumes mars mounted at Y: on windows
if sys.platform == "win32":
archive_root = Path('Y:\dat')
archive_root = Path('/dat')
archive = archive_root / 'sdc' / 'gris' / date.strftime("%Y%m%d") / 'level1_split'
# Glob for files matching the run
pattern = f'*l1?_{run_number:03d}*'
return GrisFitsFile(list(*archive.glob(pattern)))
def parse_filename(self):
"""Extract metadata from filename"""
# Extract time from Filename
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