Example #1
0
def insert_refdata(config):
    ci_db_helper = PGDbHelper(config.pgsql_conn_str())
    logger.info("Insert special coordinate systems %s" % config.dbname)
    for spref in SPREFS:
        ci_db_helper.execute(spref.sql_insert_statement)

    #insert custom functions for calculating du/dx, dv/dx
    logger.info("Inserting special plp/sql procedures %s" % config.dbname)

    from namo_app.db.models import init_mapper
    init_mapper(sqa_conn_str=config.sqa_connection_string())

    logger.info("Inserting ref data on %s" % config.dbname)

    from namo_app.db.ref_data import PROVIDERS, VARIABLES, FORMATS

    with SqaAccess(conn_str=config.sqa_connection_string()) as sqa:
        logger.info("Inserting variables")
        sqa.insert(VARIABLES)

        logger.info("Inserting formats")
        sqa.insert(FORMATS)

        logger.info("Inserting providers")
        sqa.insert(PROVIDERS)
Example #2
0
def insert_refdata(config):
    ci_db_helper = PGDbHelper(config.pgsql_conn_str())
    logger.info("Insert special coordinate systems %s" % config.dbname)
    for spref in SPREFS:
        ci_db_helper.execute(spref.sql_insert_statement)

    #insert custom functions for calculating du/dx, dv/dx
    logger.info("Inserting special plp/sql procedures %s" % config.dbname)

    from namo_app.db.models import init_mapper
    init_mapper(sqa_conn_str=config.sqa_connection_string())

    logger.info("Inserting ref data on %s" % config.dbname)

    from namo_app.db.ref_data import PROVIDERS, VARIABLES, FORMATS

    with SqaAccess(conn_str=config.sqa_connection_string()) as sqa:
        logger.info("Inserting variables")
        sqa.insert(VARIABLES)

        logger.info("Inserting formats")
        sqa.insert(FORMATS)

        logger.info("Inserting providers")
        sqa.insert(PROVIDERS)
Example #3
0
def rastertile(datagranule_id):
    from namo_app.db.access import SqaAccess
    from namo_app.config import Config, get_env
    from namo_app.db.models import init_mapper, Mask, RasterTile, DataGranule, DataFormat
    from flask import request

    #q	{"filters":[{"name":"datagranule_id","op":"==","val":"3"}]}
    config = Config(env=get_env())
    init_mapper(config.sqa_connection_string())

    mask = request.args.get('mask', None)
    with SqaAccess(conn_str=config.sqa_connection_string()) as sqa:
        tileObjs = sqa.all(RasterTile, filterr={'datagranule_id': datagranule_id})
        response = flask.json.dumps({"tiles": tileObjs})

    return response
Example #4
0
def rastertile(datagranule_id):
    from namo_app.db.access import SqaAccess
    from namo_app.config import Config, get_env
    from namo_app.db.models import init_mapper, Mask, RasterTile, DataGranule, DataFormat
    from flask import request

    #q	{"filters":[{"name":"datagranule_id","op":"==","val":"3"}]}
    config = Config(env=get_env())
    init_mapper(config.sqa_connection_string())

    mask = request.args.get('mask', None)
    with SqaAccess(conn_str=config.sqa_connection_string()) as sqa:
        tileObjs = sqa.all(RasterTile,
                           filterr={'datagranule_id': datagranule_id})
        response = flask.json.dumps({"tiles": tileObjs})

    return response
Example #5
0
__author__ = 'ujjwal'
from namo_app.config import Config, get_env
from namo_app.db.models import init_mapper


config = Config(env=get_env())
init_mapper(sqa_conn_str=config.sqa_connection_string())