@@ -150,6 +150,42 @@ def getHistory( self, path, field ):
150150 t = np .arange ( 0 , len ( val ), 1 ) * self .dt_
151151 return t , val
152152
153+ #####################################################################
154+ def listElecDatasets ( nsdf ):
155+ elec = nsdf ["/data/uniform/%elec" ]
156+ for ee in elec :
157+ path = ""
158+ spl = ee .split ( '%' , 1 )
159+ if spl [0 ] == "##[ISA=CompartmentBase]" :
160+ path += "#"
161+ else :
162+ path = spl [0 ]
163+ if len ( spl ) > 1 :
164+ path += '/' + spl [1 ].replace ( '%' , '/' )
165+ for datasetName in elec [ee ]:
166+ path += '.' + datasetName
167+ dataset = elec [ee + '/' + datasetName ]
168+ dt = dataset .attrs ['dt' ]
169+ shape = dataset .shape
170+ print ( "Elec: {:<36} shape=({}), dt={}" .format ( path , shape , dt ) )
171+
172+ def listDatasets ( nsdf ):
173+ uniform = nsdf ["/data/uniform" ]
174+ for uu in uniform :
175+ if uu == "%elec" :
176+ listElecDatasets ( nsdf )
177+ else :
178+ group = uniform [uu ]
179+ path = uu [1 :]
180+ for ch in group :
181+ path += '/' + ch .replace ( '%' , '/' )
182+ for datasetName in group [ch ]:
183+ dataset = group [ ch + '/' + datasetName ]
184+ #print( "ATTR NAMES = ", dataset.keys() )
185+ dt = dataset .attrs ['dt' ]
186+ shape = dataset .shape
187+ print ( "Chem: {:<36} shape=({}), dt={}" .format ( path + '.' + datasetName , shape , dt ) )
188+
153189
154190#####################################################################
155191def main ():
@@ -163,11 +199,14 @@ def main():
163199 parser .add_argument ( '-l' , '--list_datasets' , action = "store_true" , help = "List possible datasets available to view." )
164200 args = parser .parse_args ()
165201
166- if len ( args .viewspec ) == 0 :
202+ if ( not args . list_datasets ) and len ( args .viewspec ) == 0 :
167203 print ( "warning: No viewpsec defined in command line" )
168204 quit ()
169205
170206 nsdf = h5py .File ( args .NSDF_filename , 'r' )
207+ if args .list_datasets :
208+ listDatasets ( nsdf )
209+ quit ()
171210
172211 viewer = []
173212 for vs in args .viewspec :
0 commit comments