-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlistMod.py
More file actions
82 lines (74 loc) · 3.2 KB
/
listMod.py
File metadata and controls
82 lines (74 loc) · 3.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# Program to print out model projects currently listed in
# the database, along with the meta-data attributes.
# Logan Karsten
# National Center for Atmospheric Research
# Research Applications Laboratory
import sys
import os
import pickle
sys.path.insert(0, './python')
# Establish class object to hold information on model runs
class modelDatabase:
def __init__(self):
self.alias = []
self.modelInDir = []
self.topDir = []
self.forceInDir = []
self.tag = []
self.ensList = []
self.ensTag = []
self.geoFile = []
self.geoRes = []
self.agg = []
self.fullDomFile = []
self.mskFile = []
self.routeLinkFile = []
self.statsLink2GageFile = []
self.plotLink2GageFile = []
self.basinSubFile = []
self.strObsFile = []
self.snotelObsFile = []
self.amfObsFile = []
self.metObsFile = []
self.snodasPath = []
self.nCores = []
def printInfo(self):
filePathDb = "./parm/modelMeta_db.pkl"
# Read data in from pickle file
with open(filePathDb,'rb') as input:
dbTmp = pickle.load(input)
lenTmp = len(dbTmp.tag)
for i in range(0,lenTmp):
print "----------------------------------------------------"
print "Model Project Number: " + str(i+1)
print "*Alias: " + dbTmp.alias[i]
print "*Source Directory: " + dbTmp.modelInDir[i]
print "*Output Analaysis Directory: " + dbTmp.topDir[i] + "/" + dbTmp.alias[i]
print "*Model Tag: " + dbTmp.tag[i]
print "*Ensemble List: " + ', '.join(dbTmp.ensList[i])
print "*Ensemble Tags: " + ', '.join(dbTmp.ensTag[i])
print "*Model Forcing Source Directory: " + dbTmp.forceInDir[i]
print "*Input Geo File: " + dbTmp.geoFile[i]
print "*Input LSM Resolution: " + dbTmp.geoRes[i]
print "*Routine Aggregation Factor: " + dbTmp.agg[i]
print "*Input FullDom File: " + dbTmp.fullDomFile[i]
print "*Input Mask File: " + dbTmp.mskFile[i]
print "*Streamflow Observations File: " + dbTmp.strObsFile[i]
print "*SNOTEL Observations File: " + dbTmp.snotelObsFile[i]
print "*AMF Observations File: " + dbTmp.amfObsFile[i]
print "*HydroMet Observations File: " + dbTmp.metObsFile[i]
print "*routeLinkFile File: " + dbTmp.routeLinkFile[i]
print "*statsLink2Gage File: " + dbTmp.statsLink2GageFile[i]
print "*plotLink2Gage File: " + dbTmp.plotLink2GageFile[i]
print "*Basin Subset File: " + dbTmp.basinSubFile[i]
print "*SNODAS Directory: " + dbTmp.snodasPath[i]
print "*Number of Cores: " + dbTmp.nCores[i]
fileIn = "./parm/modelMeta_db.pkl"
if not os.path.isfile(fileIn):
print "ERROR: Input database file not found."
print " Please create one to list content."
sys.exit(1)
# Open database file.
db = modelDatabase()
# Print information to screen for user
modelDatabase.printInfo(db)