function list_hdf_labels, file_name, COUNT=count ; return list of strings of labels in hdf file ; if count is a named variable it returns the number of data sets list = '' l = ' ' print, 'list:', file_name dummy = FindFile(file_name , COUNT = exist) if dummy(0) eq '' then BEGIN print, 'read_hdf: the file "', file_name, '" does not exist!' RETURN, list ENDIF sd_id = HDF_SD_START(file_name[0], /READ) HDF_SD_FILEINFO, sd_id, NumSDS, attributes count = 0L n = 0L FOR i=1L,NumSDS DO BEGIN r=0. l=0. sds_id = HDF_SD_SELECT(sd_id, n) WHILE (HDF_SD_ISCOORDVAR(sds_id)) DO BEGIN HDF_SD_ENDACCESS, sds_id n = n + 1 sds_id = HDF_SD_SELECT(sd_id, n) ENDWHILE n = n + 1 HDF_SD_GETINFO, sds_id, label = l, dims=d, type=t print, i, ' ', l, size(l) if (l NE '') then begin list = [list, l] count = count + 1 endif HDF_SD_ENDACCESS, sds_id ENDFOR HDF_SD_END, sd_id if (N_ELEMENTS(list) gt 1) THEN $ RETURN, list[1:*] $ ELSE BEGIN print, 'having trouble reading labels in ',file_name print, 'returning dummy list' list = 'No labels read ...; ENDELSE END