Modification of the --refreshDB semantics

Use this Forum to find information on, or ask a question about, NASA Earth Science data.
Post Reply
mpenalver
Posts: 6
Joined: Thu Mar 07, 2019 7:47 pm America/New_York
Answers: 0

Modification of the --refreshDB semantics

by mpenalver » Tue Aug 13, 2019 2:05 pm America/New_York

When we ask to refresh the anc DB by passing --refreshDB to a number of routines, modules.anc_utils.finddb drops the existing satfiles record associated to the passed file name (and the ancfiles and satancinfo records related to it). This is too a strong action in some cases; e.g. if we just want to check whether optimal anc files exist, we'll remove the associated atteph files without wanting to do so.In our MODIS processing chain with a global option to update the DB, given that modis_atteph is called first to gather the necessary info to create the GEO file, and getanc is called afterwards to obtain the files required to generate the L2 prods, the atteph files never remain in the DB because they are always dropped by getanc. So, we have felt the need to modify the semantics of --refreshDB slightly. Instead of removing the affected records, it updates the value of their attributes. Specifically, we've removed lines 360 and 361 in modules.anc_utils.finddb, and in modules.ancDB.insert_record we update all the attributes of a record if it exists in satfiles, ancfiles or satancinfo. This will update starttime and stoptime repeatedly for each anc and atteph file inserted/updated, but other than that it seems to do the job. Below are the changes in case someone has a similar need.if satid is None:...else:    if atteph:        c.execute('''UPDATE satfiles                     SET starttime = ?,                         stoptime = ?,                         attephstat = ?                      WHERE satid = ?''', [starttime, stoptime, dbstat, satid])    else:        c.execute('''UPDATE satfiles                     SET starttime = ?,                         stoptime = ?,                         status = ?                     WHERE satid = ?''', [starttime, stoptime, dbstat, satid])if ancid is None:...else:    c.execute('''UPDATE ancfiles                 SET path = ?                 WHERE ancid = ?''', [ancpath, ancid])    self.conn.commit()if r is None:...else:    c.execute('''UPDATE satancinfo                 SET optimal  = ?                 WHERE satid = ? and ancid = ?''', [opt, satid, ancid])    self.conn.commit()

Tags:

Post Reply