Skip to content

Commit

Permalink
Merge pull request #248 from sot/trim_archive
Browse files Browse the repository at this point in the history
Fixes for asp1 processing
  • Loading branch information
jeanconn authored Nov 9, 2020
2 parents 39b11cb + 3b1d600 commit f8cc3d6
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 14 deletions.
1 change: 1 addition & 0 deletions mica/archive/asp_l1.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
small='asp1{fidprops}',
small_glob='*fidpr*',
small_ver_regex=r'pcadf\d+N(\d{3})_',
delete=['kalm1', 'gdat', 'adat'],
full='asp1',
filecheck=False,
cols=ARCHFILES_HDR_COLS,
Expand Down
13 changes: 5 additions & 8 deletions mica/archive/asp_l1_proc.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,9 @@ def update(obsids, config=None):
obspar_version=obspar_version,
ap_date=str(aspect_1[0]['ap_date'])),
'aspect_1_proc')
isdefault = archrec[0]['isdefault']
if isdefault is not None:
proc_db.execute("""UPDATE aspect_1_proc SET isdefault = {isdefault}
WHERE obsid = {obsid}
AND revision = {revision}
""".format(isdefault=archrec[0]['isdefault'],
obsid=obs,
revision=revision))
isdefault = 'NULL' if archrec[0]['isdefault'] is None else 1
proc_db.execute(f"""UPDATE aspect_1_proc SET isdefault = {isdefault}
WHERE obsid = {obs}
AND revision = {revision}
""")
logger.info("\tUpdated table for {}".format(obs))
4 changes: 4 additions & 0 deletions mica/archive/obsid_archive.py
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,10 @@ def get_arch(self, obsid, version='last'):
arc5.sendline("obi=%d" % minobi)
arc5.sendline("version=%s" % version)
arc5.sendline("get %s" % config['full'])
if 'delete' in config:
for filetype in config['delete']:
for file in list(Path(tempdir).glob(f"*{filetype}*")):
file.unlink()
# get the log too
arc5.sendline("dataset=pipelog")
arc5.sendline("go")
Expand Down
4 changes: 0 additions & 4 deletions mica/vv/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -977,10 +977,6 @@ def _read_in_data(self):
os.path.join(datadir, "%s_acen1.fits*" % aiid))[0])
self.integ_time = self.cenhdulist[1].header['INTGTIME']

logger.debug('Reading gyro data')
self.gdat = Table.read(glob(
os.path.join(datadir, "%s_gdat1.fits*" % aiid))[0])


(self.gsprop, self.gspr_info, self.h_gspr) \
= self._get_prop('guide', 'gspr')
Expand Down
4 changes: 2 additions & 2 deletions mica/vv/tests/test_vv.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@

@pytest.mark.skipif('not HAS_VV_ARCHIVE', reason='Test requires vv archive')
def test_get_vv_dir():
obsdir = vv.get_vv_dir(16504)
obsdir = vv.get_vv_dir(16504, version=1)
assert obsdir == os.path.abspath(os.path.join(common.MICA_ARCHIVE, 'vv/16/16504_v01'))

@pytest.mark.skipif('not HAS_VV_ARCHIVE', reason='Test requires vv archive')
def test_get_vv_files():
obsfiles = vv.get_vv_files(16504)
obsfiles = vv.get_vv_files(16504, version=1)
assert sorted(obsfiles)[-1] == os.path.abspath(os.path.join(common.MICA_ARCHIVE,
'vv/16/16504_v01/vv_report.pkl'))

Expand Down

0 comments on commit f8cc3d6

Please sign in to comment.