def _ESP(self, options):
        ndays = (date(self.endyear, self.endmonth, self.endday) -
                 date(self.startyear, self.startmonth, self.startday)).days
        db = dbio.connect(self.models[0].dbname)
        cur = db.cursor()
        sql = "select distinct (date_part('year', fdate)) as year from precip.{0}".format(
            options['vic']['precip'])
        cur.execute(sql)
        years = map(lambda y: int(y[0]), cur.fetchall())
        random.shuffle(years)
        if self.startyear in years:
            years.remove(self.startyear)
        # will need to check whether enough days exist in sampled year before
        # removing
        years.remove(max(years))
        for e in range(self.nens):
            model = self.models[e]
            model.startyear = years[e]
            t = date(model.startyear, model.startmonth,
                     model.startday) + timedelta(ndays)
            model.endyear, model.endmonth, model.endday = t.year, t.month, t.day
            prec, tmax, tmin, wind = model.getForcings(options['vic'])
            model.writeForcings(prec, tmax, tmin, wind)
        cur.close()
        db.close()
Periodically commit changes into the SQLite database.
dataset/ETHPy150Open nasa/RHEAS/src/ensemble.py/Ensemble._ESP--crossover with--dataset/ETHPy150Open GoogleCloudPlatform/python-compat-runtime/appengine-compat/exported_appengine_sdk/google/appengine/tools/bulkloader.py/_Database._MaybeCommit