Ejemplo n.º 1
0
import utilme

dbo = utilme.Database(db_host='127.0.0.1',
                      db_usr='******',
                      db_pwd='wave',
                      db_type='mysql')

# =============================================
# MANAGE db
# =============================================

# === CREATE

# --- create db
# dbo.create_db('DB_MOUNTS')

# --- create tb
# tbname = 'targets'
# dicts = {'id': 'INT',
#          'name': 'CHAR',
#          'shortname': 'CHAR',
#          'country': 'CHAR',
#          'lat': 'FLOAT',
#          'lon': 'FLOAT'}
# dbo.create_tb(dbname='DB_MOUNTS', tbname=tbname, dicts=dicts, primarykey='id')

# === DELETE

# --- delete db
# dbo.delete_db('DB_MOUNTS')
Ejemplo n.º 2
0
import utilme

# - connect to database
f = file('./conf/credentials_mysql.txt')
(db_usr, db_pwd) = f.readline().split(' ')
dbo = utilme.Database(db_host='127.0.0.1', db_usr=db_usr, db_pwd=db_pwd, db_type='mysql')


# =============================================
# MANAGE db
# =============================================

# === CREATE

# --- create db
# dbo.create_db('DB_MOUNTS')

# --- create tb
# tbname = 'targets'
# dicts = {'id': 'INT',
#          'name': 'CHAR',
#          'shortname': 'CHAR',
#          'country': 'CHAR',
#          'lat': 'FLOAT',
#          'lon': 'FLOAT'}
# dbo.create_tb(dbname='DB_MOUNTS', tbname=tbname, dicts=dicts, primarykey='id')


# === DELETE

# --- delete db
Ejemplo n.º 3
0
        # filename='S2*MSIL1C*',  # 'S2*MSIL2A*',
        # # 'cloudcoverpercentage': '[0 TO 2]',
        # filter_products=1,  # => filter products if acquired at same minute, keep only tiles where intersection percentage with footprint is max)
        # download_pnode=optn['download_pnode'],
        # download_dir=optn['download_dir'],
        # maxrecords=100,
    )

    p = tasks.query(optn, optn_s1, optn_s2)
    # p[1].getQuicklook()
    # print p[1].metadata.title
    print('=> products found in scihub:')
    fetchme.Scihub().print_product_title(p)

    print('=> products found in scihub which are not in DB_MOUNTS:')
    dbo = utilme.Database()
    p_in, p_new = dbo.dbmounts_isproduct_archived(p)
    pnew_title = fetchme.Scihub().print_product_title(p_new)

# === DOWNLOAD + LOAD to archive
if download:
    download_pnew = 1  # >> download new products only (else calculates md5sum and downloads if inconsistent)
    download_pidx = None  # [2, 3, 4]    # >> None=>download full product list; [0]=>download first product in list
    download_pnode = 'fullproduct'  # >> None | 'quicklook' | 'fullproduct'
    download_rootdir = '/home/sebastien/DATA/data_satellite/'
    load_2dbarchive = 1

    # --- select product(s) to download within productlist
    if download_pnew:
        p = p_new