Exemple #1
0
def demo_many_queries(addr, genesis):
    eng = DataEngine(addr, genesis)
    s = eng.new_session(get_client(), get_signing_key())
    for _ in range(0, 15):
        submit_inc(s)
    print(submit_get(s).result_num())
    s.close()
Exemple #2
0
def demo_llamadb(addr, genesis):
    eng = DataEngine(addr, genesis)
    s = eng.new_session(get_client(), get_signing_key())
    print(
        submit_query(
            s,
            "CREATE TABLE users(id int, name varchar(128), age int)").result())
    for i in range(0, 20):
        submit_query(
            s, "INSERT INTO users VALUES(%d, 'User%d', %d)" % (i, i, i + 20))
        print(submit_query(s, "SELECT AVG(age) FROM users").result())
    s.close()
Exemple #3
0
    def _init_dataengine(self):
        """
        Creates dataengine object

        :return: dataengine
        """
        data_engine = DataEngine(self)
        return data_engine
Exemple #4
0
def demo_queries(addr,
                 genesis,
                 send_wrong=False,
                 send_closed=True,
                 session=None):
    eng = DataEngine(addr, genesis)
    s = eng.new_session(get_client(), get_signing_key(), session)
    q0 = submit_inc(s)
    q1 = submit_mul(s, 10, 14)
    if send_wrong:
        qw = submit_wrong_command(s)
    q2 = submit_inc(s)
    q3 = submit_get(s)
    if send_closed:
        closed = s.close()
    print(q1.result_num())
    print(q2.result())
    print(q3.result_num())
    if send_closed:
        print(closed.result())
Exemple #5
0
 def __init__(self, collection, rootpath=ROOT_PATH):
     DataEngine.__init__(self, collection, rootpath)
     tagfile = os.path.join(rootpath, collection, 'TextData', 'id.userid.lemmtags.txt')
     self.data = map(str.strip, open(tagfile).readlines())
 def _init_dataengine(self):
     data_engine = DataEngine(self)
     return data_engine
Exemple #7
0
 def __init__(self, collection, rootpath=ROOT_PATH):
     DataEngine.__init__(self, collection, rootpath)
     tagfile = os.path.join(rootpath, collection, 'TextData',
                            'id.userid.lemmtags.txt')
     self.data = map(str.strip, open(tagfile).readlines())
        data = log_df[curve_name]
        ax.set_xlim(min(data), max(data))
        ax.spines['top'].set_position(('outward', 0))
        color = 'blue'
        ax.plot(data, log_df.index, color=color, label=curve_name)
        ax.set_xlabel(curve_name, color=color)
        ax.tick_params(axis='x', colors=color)

        depthes = [x[0] for x in point_list[i]]
        values = [x[1] for x in point_list[i]]
        ax.scatter(values, depthes, marker='o', color='R', label='Core')
        ax.grid(False)
    plt.show()


data_engine = DataEngine()
data_engine.initialize()
data_source = DataSource()

data_source.open("D:\cifplusdemo20120913")
wells = data_source.get_workspace("多井测试数据").get_wells()
logdata = LogData()
logplot = LogPlot()
well = wells[1]
print(well.name)
category = well.get_default_category()
curve_names = category.get_curve1d_names_existed(["sp", "ac", "rt"])
curve1ds = category.get_curve1ds(curve_names)
log_df = logdata.read_curve1ds_to_df(curve1ds)
# logplot.draw_curve1d_df(log_df)
# ac_df =log_df['AC']
Exemple #9
0
 def __init__(self, collection, rootpath=ROOT_PATH):
     DataEngine.__init__(self, collection)
     self.name = '%s.%s' % (self.__class__.__name__, collection)
Exemple #10
0
 def __init__(self, collection, rootpath=ROOT_PATH):
     DataEngine.__init__(self, collection)
     self.name = '%s.%s' % (self.__class__.__name__, collection)