| 1 |
pro opendir, fileid |
| 2 |
S = nxinitgroupdir (fileid) |
| 3 |
print, 'nxinitgroupdir', S |
| 4 |
print, '' |
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
S = nxgetgroupinfo(fileid, item_number, group_name, group_class) |
| 9 |
print, 'nxgetgroupinfo status', S |
| 10 |
print, 'current group name: ', group_name |
| 11 |
print, 'current group class: ', group_class |
| 12 |
print, 'number of items in group', item_number |
| 13 |
print, '' |
| 14 |
|
| 15 |
for j = 1, item_number, 1 do begin |
| 16 |
;wait, 1 |
| 17 |
S = nxgetnextentry(fileid, name, class, data_type) |
| 18 |
print, 'nxgetnextentry status: ', S |
| 19 |
print, 'nxgetnextentry name: ', name |
| 20 |
print, 'nxgetnextentry class: ', class |
| 21 |
print, 'nxgetnextentry data_type', data_type |
| 22 |
print, '' |
| 23 |
if (strcmp(class, 'SDS')) then begin |
| 24 |
|
| 25 |
print, 'opening data: ', name |
| 26 |
S = nxopendata(fileid, name) |
| 27 |
print, 'nxopendata status:', S |
| 28 |
print, '' |
| 29 |
if(S EQ 1) then opendata, fileid |
| 30 |
S = nxclosedata(fileid) |
| 31 |
print, 'nxclosedata status', S |
| 32 |
print, '' |
| 33 |
|
| 34 |
endif else begin |
| 35 |
S = nxisexternalgroup(fileid ,name, class, nxurl, 100) |
| 36 |
print, 'nxisexternalgroup status: ', S |
| 37 |
if (S EQ 1) then begin |
| 38 |
print, 'Group is an externally link group' |
| 39 |
print, 'nxisexternalgroup url:', nxurl |
| 40 |
print, '' |
| 41 |
S = nxinquirefile(fileid,filename, 100); |
| 42 |
print, 'nxinquirefile status:', S |
| 43 |
print, 'file currently open: ', filename |
| 44 |
endif |
| 45 |
S = nxopengroup(fileid, name, class) |
| 46 |
print, 'nxopengroup status', S |
| 47 |
print, '' |
| 48 |
|
| 49 |
if(S EQ 1) then opendir, fileid |
| 50 |
|
| 51 |
S = nxclosegroup(fileid) |
| 52 |
print, 'nxclosegroup status', S |
| 53 |
print, '' |
| 54 |
|
| 55 |
endelse |
| 56 |
|
| 57 |
endfor |
| 58 |
|
| 59 |
end |
| 60 |
|
| 61 |
pro opendata, fileid |
| 62 |
|
| 63 |
S = nxgetinfo(fileid, rank, di, info_type) |
| 64 |
print, 'nxgetinfo status:', S |
| 65 |
print, 'rank:', rank |
| 66 |
for i = 0,rank-1 DO print, 'Dim [',i,']:', di[i] |
| 67 |
print, 'Data Type:', info_type |
| 68 |
print, '' |
| 69 |
S = nxgetdata(fileid, data) |
| 70 |
print, 'nxgetdata status: ', S |
| 71 |
print, 'data :' |
| 72 |
print, data |
| 73 |
print, '' |
| 74 |
S = nxgetattrinfo(fileid, numberofattr) |
| 75 |
print, 'nxgetattrinfo status:',S |
| 76 |
print, 'number of attributes: ', numberofattr |
| 77 |
|
| 78 |
;S= nxinitattrdir (fileid) |
| 79 |
print, 'nxinitattrdir', S |
| 80 |
print, '' |
| 81 |
|
| 82 |
for j = 1, numberofattr, 1 do begin |
| 83 |
S = nxgetnextattr(fileid, attrname, lenght,attr_type) |
| 84 |
print, 'attribute name: ', attrname |
| 85 |
print, 'attrubute lenght: ', lenght |
| 86 |
print, 'attribute type: ', attr_type |
| 87 |
|
| 88 |
S = nxgetattr(fileid, attrname, value, lenght,attr_type) |
| 89 |
;print, 'attribute name: ', attrname |
| 90 |
;print, 'attrubute lenght: ', lenght |
| 91 |
;print, 'attribute type: ', attr_type |
| 92 |
print, 'attribute value: ', value |
| 93 |
print, '' |
| 94 |
|
| 95 |
endfor |
| 96 |
|
| 97 |
end |
| 98 |
|
| 99 |
|
| 100 |
pro recursiveread, filepath |
| 101 |
new_dlm_file = '/home/scratch/lns/kauppila/temp/IDLNeXus-API/NeXusIDL-API.dlm' |
| 102 |
DLM_REGISTER, new_dlm_file |
| 103 |
|
| 104 |
|
| 105 |
; S = nxopen("data/nx.hdf","NXACC_READ",fileid) |
| 106 |
; S = nxopen("data/dmc01.h5","NXACC_READ",fileid) |
| 107 |
; S = nxopen("data/dmc01.hdf","NXACC_READ",fileid) |
| 108 |
; S = nxopen("data/dmc01.xml","NXACC_READ",fileid) |
| 109 |
; S = nxopen("data/dmc02.h5","NXACC_READ",fileid) |
| 110 |
; S = nxopen("data/dmc02.hdf","NXACC_READ",fileid) |
| 111 |
; S = nxopen("data/dmc02.xml","NXACC_READ",fileid) |
| 112 |
; S = nxopen("data/NXtest.nxs","NXACC_READ",fileid) |
| 113 |
; S = nxopen("data/NXtest.hdf","NXACC_READ",fileid) |
| 114 |
; S = nxopen("NXtest.nxs","NXACC_READ",fileid) |
| 115 |
; S = nxopen("C:\temp\dlm\dlm\NXtest.nxs","NXACC_READ",fileid) |
| 116 |
; S = nxopen("C:\temp\dlm\dlm\data\dmc01.h5","NXACC_READ",fileid) |
| 117 |
|
| 118 |
if(N_PARAMS() EQ 1) then begin |
| 119 |
S = nxopen(filepath,"NXACC_READ",fileid) |
| 120 |
|
| 121 |
endif else begin |
| 122 |
print, 'Reading default file NXtest.h5' |
| 123 |
S = nxopen("NXtest.h5","NXACC_READ",fileid) |
| 124 |
endelse |
| 125 |
|
| 126 |
print, 'nxopen status: ',S |
| 127 |
print, '' |
| 128 |
|
| 129 |
opendir, fileid |
| 130 |
|
| 131 |
; Read global attributes |
| 132 |
|
| 133 |
S = nxgetattrinfo(fileid, numberofattr) |
| 134 |
print, 'nxgetattrinfo status:',S |
| 135 |
print, 'number of attributes: ', numberofattr |
| 136 |
|
| 137 |
S= nxinitattrdir (fileid) |
| 138 |
print, 'nxinitattrdir', S |
| 139 |
print, '' |
| 140 |
|
| 141 |
for j = 1, numberofattr, 1 do begin |
| 142 |
S = nxgetnextattr(fileid, attrname, lenght,attr_type) |
| 143 |
print, 'global attribute name: ', attrname |
| 144 |
print, 'global attrubute lenght: ', lenght |
| 145 |
print, 'global attribute type: ', attr_type |
| 146 |
|
| 147 |
S = nxgetattr(fileid, attrname, value, lenght,attr_type) |
| 148 |
;print, 'global attribute name: ', attrname |
| 149 |
;print, 'global attrubute lenght: ', lenght |
| 150 |
;print, 'global attribute type: ', attr_type |
| 151 |
print, 'global attribute value: ', value |
| 152 |
print, '' |
| 153 |
|
| 154 |
endfor |
| 155 |
|
| 156 |
|
| 157 |
|
| 158 |
S = nxclose(fileid) |
| 159 |
print, 'nxclose status: ', S |
| 160 |
end |
| 161 |
|