diff --git a/msc/coredb_clone_hybrid.py b/msc/coredb_clone_hybrid.py index 30c2ef06f2fd91f2433c830424ae7f2a6de531c4..810e04fb1e162996326005e7341e0371698b2ea3 100644 --- a/msc/coredb_clone_hybrid.py +++ b/msc/coredb_clone_hybrid.py @@ -6,10 +6,11 @@ FZ 09/2021 """ from watpy.coredb.coredb import * +import os # mkdirs -import os db_path = './CoRe_DB_clone/' os.makedirs(db_path, exist_ok=True) + cdb = CoRe_db(db_path, ifile = "json/DB_Hyb.json") idb = cdb.idb diff --git a/msc/coredb_write_index_json.py b/msc/coredb_write_index_json.py index 27b3514fcc3446ee4cec924a355a64868ee2d7ab..926c4530537a7df77bd0e534c56fa4cf2dbbbd01 100644 --- a/msc/coredb_write_index_json.py +++ b/msc/coredb_write_index_json.py @@ -6,10 +6,12 @@ SB 09/2021 """ from watpy.coredb.coredb import * +import os # mkdirs db_path = './CoRe_DB_clone/' +os.makedirs(db_path, exist_ok=True) + cdb = CoRe_db(db_path) -## cdb = CoRe_db(db_path, ifile = "json/DB_Hyb.json") #Use this for Hybrids! idb = cdb.idb # make sure the DB is up-to-date! @@ -25,5 +27,3 @@ idb.update_from_mdlist(mdlist) # write the index to JSON with the appropriate template idb.to_json_tmplk() -## idb.to_json_tmplk(tmpl = TXT_HYB) #Use this for Hybrids! - diff --git a/msc/coredb_write_index_json_hybrid.py b/msc/coredb_write_index_json_hybrid.py new file mode 100644 index 0000000000000000000000000000000000000000..b16db297a923467adba1209a468d79ec95640b82 --- /dev/null +++ b/msc/coredb_write_index_json_hybrid.py @@ -0,0 +1,29 @@ +#!/usr/bin/python + +""" +Write the index JSON from the metadata_main.txt in the DB +SB 09/2021 +""" + +from watpy.coredb.coredb import * +import os # mkdirs + +db_path = './CoRe_DB_clone/' +os.makedirs(db_path, exist_ok=True) + +cdb = CoRe_db(db_path, ifile = "json/DB_Hyb.json") #Use this for Hybrids! +idb = cdb.idb + +# make sure the DB is up-to-date! +cdb.sync() + +# read metadata_main in a list +mdlist = [] +for key in idb.dbkeys: + mdlist.append(cdb.sim[key].md) + +# update the index +idb.update_from_mdlist(mdlist) + +# write the index to JSON with the appropriate template +idb.to_json_tmplk(tmpl = TXT_HYB) #Use this for Hybrids!