Commit bb02b006 authored by Carl Schaffer's avatar Carl Schaffer
Browse files

adding retrieval of slit_angle

parent ce556f6e
#!/usr/bin/env python3
import sys
from pathlib import Path
import pandas as pd
from kis_tools.util.util import gris_run_number, date_from_fn
fn = sys.argv[1]
assert Path(fn).exists(), f'Invalid input file {fn} not found!'
from scipy.io.idl import readsav
data = readsav(fn)
# rotation angle of the slit with respect to the solar equator
angle = data['slit_angle']
run = gris_run_number(fn)
date = date_from_fn(fn)
ser = pd.Series({'slit_angle': angle})
df = pd.DataFrame()
df[f'gris_{date.strftime("%Y%m%d")}_{run:03d}'] = ser
df = df.T
df.index.name = 'obs_name'
from sqlalchemy import create_engine
outfile = Path(__file__).parent / 'gris_coords.db'
db_name = 'sqlite:///' + str(outfile)
engine = create_engine(str(db_name))
df.to_sql('slit_angle', con=engine, if_exists='append', index_label='obs_name')
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