Beispiel #1
0
 def test_parseVersion(self):
     """parseVersion"""
     self.assertEqual(Version.Version(1, 2, 3), Utils.parseVersion('1.2.3'))
     self.assertRaises(TypeError, Utils.parseVersion, '1.2')
                product_id = dbu.getProductID(conf['plot{0}'.format(pnum)]['product{0}'.format(pn)])
                # print pnum, n_prods, product_id

                ans[ind_pnum][ind_d][ind_pn].append(d)
                ans[ind_pnum][ind_d][ind_pn].append(np.zeros(len(d), dtype=int))
                files = dbu.getFilesByProductDate(product_id, [d[0], d[-1]], newest_version=True)
                # print  len(d), pnum, n_prods, product_id, len(files)
                # cull the files list based on productN_glob
                if 'product{0}_glob'.format(pn) in conf['plot{0}'.format(pnum)]:
                    files = [f for f in files if fnmatch.fnmatch(f.filename,
                                                                 conf['plot{0}'.format(pnum)][
                                                                     'product{0}_glob'.format(pn)])]

                if 'product{0}_version'.format(pn) in conf['plot{0}'.format(pnum)]:
                    files = [f for f in files if (dbu.getFileVersion(dbu.getEntry('File', f.file_id).file_id) >=
                                                  Utils.parseVersion(
                                                      conf['plot{0}'.format(pnum)]['product{0}_version'.format(pn)]))]
                # now that we have all the files loop through and the the dates that we have to 1
                f_dates = [dbu.getEntry('File', f.file_id).utc_file_date for f in files]
                for fd in f_dates:
                    ans[ind_pnum][ind_d][ind_pn][1][ans[ind_pnum][ind_d][ind_pn][0].index(fd)] = 1
                print("\tcollected {0} from {1} to {2}"
                      .format(conf['plot{0}'.format(pnum)]['product{0}'.format(pn)],
                              d[0], d[-1]))

    print('Collected data')

    # and make the plots
    out = _combine_coverage(ans)

    outfiles = []
    for ind_d, d in enumerate(out[0]):  # loop over the times