Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'Trouble with importing NaN values from HDF5' topicStudent Support Forum > General > Archives > "Trouble with importing NaN values from HDF5"

Next Comment >Help | Reply To Topic
Author Comment/Response
Rhys Ulerich
06/15/10 12:11pm

Dataset /u in the attached HDF5 file contains NaN values. This can be confirmed using 'h5dump bar.h5 | grep -i nan'.


However, using Mathematica 7's Import does not cause either NaN or Missing[] values in the input data. Observe

u = Import["bar.h5", {"Datasets", "/u"} ];
u[[5, 47 ;; 55, 1]]

which shows a range of NaN and non-NaN data. The NaN's appear, on my system, as "-1024.". These "-1024." values do not behave like either normal floating point numbers or NaNs:

(#1 < 0) & /@ h[[5, 47 ;; 55, 1]]
(#1 >= 0) & /@ h[[5, 47 ;; 55, 1]]
(#1 == #1) & /@ h[[5, 47 ;; 55, 1]]


However, InputForm shows no other information to indicate there's anything special about their representation. Because of this, I cannot seem to filter the data to replace these obnoxious things with Missing[] or something else that's suitable.

The documentation, from what I can tell, says nothing about what happens when importing NaN values.

Questions, with any answers appreciated:
1) What gives?
2) Can I get them to import as NaNs or Missing[] directly?
3) If not, can I filter them out in some way? I cannot seem to write a predicate to detect them since they behave so funkily.

Thanks in advance,
Rhys

- Rhys

Attachment: bar.h5, URL: ,

Subject (listing for 'Trouble with importing NaN values from HDF5')
Author Date Posted
Trouble with importing NaN values from HDF5 Rhys Ulerich 06/15/10 12:11pm
Re: Trouble with importing NaN values from HDF5 Richard Ober... 04/12/11 10:11pm
Next Comment >Help | Reply To Topic