Skip to content

Retireve ThermoDataSets and subsets of data

Compare
Choose a tag to compare
@gdmiron gdmiron released this 05 Feb 15:59
· 2 commits to master since this release
52187ed
import thermohubclient as client
# configuration file containing database connection configuration 
databaseClient = client.DatabaseClient('hub-connection-config.json') 
# connects by default to https://db.thermohub.org hub_main database
databaseClient = client.DatabaseClient() 

databaseJSONstring = databaseClient.getDatabase('cemdata18')
# database files are saved at the path where the code is executed, in this case 'cemdata18-thermofun.json' will be created
databaseClient.saveDatabase('cemdata18') 

# Save a subset of ThermoDataSet 'aq17' to a database file aq17-subset-thermofun.json, using a list of elements
dbc_default.saveDatabaseContainingElements(
    "aq17", ["H", "O", "Na", "K", "Si", "Al", "Cl", "Zr", "Zz"])
# Save a subset of ThermoDataSet 'mines16' to a database file mines16-subset-thermofun.json,
# using a (optional) list of elements, substances, and substance classes.
# Only the data that fulfils all selection criteria will be saved
dbc.saveDatabaseSubset("mines16", ["H", "O", "Na", "K", "Si", "Al", "Cl", "Zr", "Zz"],
                       ["O2@", "H2@", "NaHSiO3@", "Al(OH)2+", "NaAl(OH)4@", "Al+3",
                        "AlH3SiO4+2", "AlOH+2", "Al(OH)4-", "H2", "O2", "H2O"],
                       ["{\"1\":\"SC_GASFLUID\"}", "{\"3\":\"SC_AQSOLVENT\"}"])