Skip to content
Snippets Groups Projects
Commit 8127c47f authored by Sebastiano Bernuzzi's avatar Sebastiano Bernuzzi
Browse files

Added a separate example file for writing index for hybrids. Diff of the two...

Added a separate example file for writing index for hybrids. Diff of the two coredb_write_index_json*.py file now highlights the changes.
parent 41e41181
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
......@@ -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!
#!/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!
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment