Changeset 1172
- Timestamp:
- 17/01/09 00:55:20 (3 years ago)
- Location:
- trunk/bindings/python
- Files:
-
- 2 edited
-
nxs/napi.py (modified) (7 diffs)
-
nxstest.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/bindings/python/nxs/napi.py
r1171 r1172 1 # This program is public domain 2 1 # This program is public domain 3 2 # Author: Paul Kienzle 4 3 … … 107 106 nxs.MAXNAMELEN - names must be shorter than this 108 107 nxs.MAXPATHLEN - total path length must be shorter than this 109 108 nxs.H4SKIP - class names that may appear in HDF4 files but can be ignored 110 109 111 110 Caveats … … 123 122 .. _NAPI: http://www.nexusformat.org/Application_Program_Interface 124 123 """ 125 __all__ = ['UNLIMITED', 'MAXRANK', 'MAXNAMELEN','MAXPATHLEN', 124 __all__ = ['UNLIMITED', 'MAXRANK', 'MAXNAMELEN','MAXPATHLEN','H4SKIP', 126 125 'NeXus','NeXusError','open'] 127 126 … … 156 155 MAXNAMELEN=64 157 156 MAXPATHLEN=1024 # inferred from code 157 158 # bogus groups; these groups are ignored in HDFView from NCSA. 159 H4SKIP = ['CDF0.0','_HDF_CHK_TBL_','Attr0.0', 160 'RIG0.0','RI0.0', 'RIATTR0.0N','RIATTR0.0C'] 158 161 159 162 # HDF data types from numpy types … … 602 605 since getinfo returns shape and storage, both of which are required 603 606 to read the data. 607 608 Note that HDF4 files can have entries in the file with classes 609 that don't need to be processed. If the file follows the standard 610 NeXus DTDs then skip any entry for which nxclass.startswith('NX') 611 is False. For non-conforming files, skip those entries with 612 nxclass in nxs.H4SKIP. 604 613 """ 605 614 name = ctypes.create_string_buffer(MAXNAMELEN) … … 630 639 This does not correspond to an existing NeXus API function, 631 640 but instead combines the work of initgroupdir/getnextentry 632 and open/close on data and group. 641 and open/close on data and group. Entries in nxs.H4SKIP are 642 ignored. 633 643 """ 634 644 # To preserve the semantics we must read in the whole list … … 642 652 L = [] 643 653 for i in range(n): 644 L.append(self.getnextentry()) 654 name,nxclass = self.getnextentry() 655 if nxclass not in H4SKIP: 656 L.append((name,nxclass)) 645 657 for name,nxclass in L: 646 658 self.openpath(path) # Reset the file cursor -
trunk/bindings/python/nxstest.py
r1171 r1172 45 45 print "%(prefix)s@%(attr)s: %(value)s" % locals() 46 46 for name,nxclass in file.entries(): 47 if nxclass.startswith("CDF"): continue # Root has an extra CDF class48 47 if nxclass == "SDS": 49 48 shape,dtype = file.getinfo()
Note: See TracChangeset
for help on using the changeset viewer.
