Exemplo n.º 1
0
def test4():
    bin = J.bin(ifcb.pid('IFCB5_2011_056_024112'))
    bin2html(bin)
    bin2json(bin)
    print ''
    bin2xml(bin)
    bin2adc(bin)
    bin2hdr(bin)
Exemplo n.º 2
0
def test4():
    bin = J.bin(ifcb.pid('IFCB5_2011_056_024112'))
    bin2html(bin)
    bin2json(bin)
    print ''
    bin2xml(bin)
    bin2adc(bin)
    bin2hdr(bin)
Exemplo n.º 3
0
def latest_bins(n=25,date=None):
    if date is None:
        date = time.gmtime()
    dt = utcdatetime(date)
    c = psql.connect(PSQL_CONNECT)
    db = c.cursor()
    db.execute("select lid,sample_time from bins where sample_time <= %s order by sample_time desc limit %s",(dt,n)) # dangling comma is necessary
    for row in db.fetchall():
        yield ifcb.pid(row[0])
Exemplo n.º 4
0
 def __init__(self, path):
     self.dir = os.path.dirname(os.path.abspath(path))
     file = os.path.basename(path)
     (self.id, ext) = os.path.splitext(file)
     # the timestamp is the approximate time the syringe was sampled and flow began
     self.pid = ifcb.pid(self.id)
     self.oid = parse_id(self.id)
     self.time_string = self.oid.datetime
     self.instrument = self.oid.instrument_number
     self.time_format = self.oid.datetime_format
Exemplo n.º 5
0
 def __init__(self, path):
     self.dir = os.path.dirname(os.path.abspath(path))
     file = os.path.basename(path)
     (self.id, ext) = os.path.splitext(file)
     # the timestamp is the approximate time the syringe was sampled and flow began
     self.pid = ifcb.pid(self.id)
     self.oid = parse_id(self.id)
     self.time_string = self.oid.datetime
     self.instrument = self.oid.instrument_number
     self.time_format = self.oid.datetime_format
Exemplo n.º 6
0
def day_bins(date=None):
    if date is None:
        date = time.gmtime()
    dt = utcdatetime(date)
    c = psql.connect(PSQL_CONNECT)
    db = c.cursor()
    db.execute("set session time zone 'UTC'")
    db.execute("select lid,sample_time from bins where date_part('year',sample_time) = %s and date_part('month',sample_time) = %s and date_part('day',sample_time) = %s order by sample_time desc",(dt.year,dt.month,dt.day))
    for row in db.fetchall():
        yield ifcb.pid(row[0])
Exemplo n.º 7
0
def test5():
    target = J.target(ifcb.pid('IFCB5_2011_056_024112_000001'))
    target2xml(target)
    target2html(target)
    target2rdf(target)
Exemplo n.º 8
0
 def __repr__(self):
     return ifcb.pid(self.lid)
Exemplo n.º 9
0
 def as_pid(self):
     return ifcb.pid(self.lid)
Exemplo n.º 10
0
 def pid(self):
     if no_day_dirs():
         return self.dir
     return ifcb.pid(os.path.basename(self.dir))
Exemplo n.º 11
0
from config import FS_ROOTS
from ifcb.io.path import Filesystem
import mosaic
import sys
import ifcb

if __name__=='__main__':
    if len(sys.argv) < 2:
        print >> sys.stderr, 'usage: %s [pid] [outputfile]' % sys.argv[0]
    else:
        fs = Filesystem(FS_ROOTS)
        b = fs.resolve(ifcb.pid(sys.argv[1]))
        outfile = None
        if len(sys.argv) > 2:
            outfile = sys.argv[2]
        print >> sys.stderr, 'Generating mosaic for %s' % str(b)
        mosaic.save_mosaic(b,outfile)
Exemplo n.º 12
0
def test5():
    target = J.target(ifcb.pid('IFCB5_2011_056_024112_000001'))
    target2xml(target)
    target2html(target)
    target2rdf(target)
Exemplo n.º 13
0
 def __target(self, pid):
     oid = parse_id(pid)
     bin = self.bin(ifcb.pid(oid.bin_lid))
     return bin.target(int(oid.target))  # bin.target is 0-based
Exemplo n.º 14
0
 def __target(self, pid):
     oid = parse_id(pid)
     bin = self.bin(ifcb.pid(oid.bin_lid))
     return bin.target(int(oid.target))  # bin.target is 0-based
Exemplo n.º 15
0
	def pid(self):
		if no_day_dirs():
			return self.dir
		return ifcb.pid(os.path.basename(self.dir))
Exemplo n.º 16
0
from config import FS_ROOTS
from ifcb.io.path import Filesystem
import mosaic
import sys
import ifcb

if __name__ == '__main__':
    if len(sys.argv) < 2:
        print >> sys.stderr, 'usage: %s [pid] [outputfile]' % sys.argv[0]
    else:
        fs = Filesystem(FS_ROOTS)
        b = fs.resolve(ifcb.pid(sys.argv[1]))
        outfile = None
        if len(sys.argv) > 2:
            outfile = sys.argv[2]
        print >> sys.stderr, 'Generating mosaic for %s' % str(b)
        mosaic.save_mosaic(b, outfile)