Thanks for the insight. I had downloaded a version last week, but the project was still pointing to an older version that was downloaded earlier in the year. I cleaned up everything, and reset the class path appropriately and all is working beautifully.
Cheers, Susan On 5/25/12 1:13 PM, "Peter Cao" <x...@hdfgroup.org> wrote: >There was a problem for HDF4 SDS on 64-bit mac machines. >The problem was fixed two months ago. But the problem >should not happen on linux machines. If you installed HDFView >2.8 over two months ago, could you download it and try it? > > >On 5/25/2012 12:23 PM, summerhaze wrote: >> Hi - >> >> I've been trying to figure out how to read data using the hdf-java >>without >> success. All data values returned are zero. Thinking the data was >>somehow >> corrupted, I validated the file by writing an equivalent C program, and >>then >> looked at the data using hdfview. >> >> After validating, I decided to try the TestH4File.java example, running >>the >> "testH4SDS" test, and --- got the same result. All values output are >>zero >> (and should not be). >> >> I've tried this on both my Mac (Lion) and on an Ubuntu 11 box. I'm >>using >> hdf-java 2.8 and java 1.6 (64b). >> >> Any insights are appreciated. >> Thanks, >> Susan >> >> === output === >> >> Julian Date and Time >> _FillValue >> 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 >> Longitude >> _FillValue >> 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 >> >> (I modified line 205 to take the min of the array size of 10, vs. 1000 >>for >> brevity.) >> >> ===== relevant code ==== >> >> /** >> * Test H4SDS. >> */ >> private static void testH4SDS(String fileName) >> { >> H4File h4file = new H4File(fileName, HDFConstants.DFACC_READ); >> >> try { >> h4file.open(); >> } catch (Exception ex) >> { >> System.out.println(ex); >> } >> >> DefaultMutableTreeNode root = >> (DefaultMutableTreeNode)h4file.getRootNode(); >> H4SDS sds = null; >> DefaultMutableTreeNode node = null; >> if (root != null) >> { >> Enumeration nodes = root.depthFirstEnumeration(); >> while (nodes.hasMoreElements()) >> { >> node = (DefaultMutableTreeNode)nodes.nextElement(); >> Object obj = node.getUserObject(); >> if (obj instanceof H4SDS) >> { >> sds = (H4SDS)obj; >> System.out.println(sds); >> >> // test H4CompoundDS attributes >> Attribute attr = null; >> List info = null; >> try { >> info = sds.getMetadata(); >> } catch (Exception ex) >> { System.out.println(ex); } >> >> int n = 0; >> if (info != null) >> { >> n = info.size(); >> for (int i=0; i<n; i++) >> { >> attr = (Attribute)info.get(i); >> System.out.println(attr); >> } >> } >> >> // data >> Object data = null; >> try >> { >> data = sds.read(); >> } catch (Exception ex) {System.out.println(ex);} >> >> if ((data != null)&& data.getClass().isArray()) >> { >> // print out the first 1000 data points >> n = Math.min(Array.getLength(data), 10); >> StringBuffer sb = new StringBuffer(); >> for (int j=0; j<n; j++) >> { >> sb.append(Array.get(data, j)); >> sb.append(" "); >> } >> System.out.println(sb.toString()); >> } >> } //if (obj instanceof H4Group >> } //while (nodes.hasMoreElements()) >> } //if (root != null) >> >> try { >> h4file.close(); >> } catch (Exception ex) >> { >> System.out.println(ex); >> } >> } >> >> -- >> View this message in context: >>http://hdf-forum.184993.n3.nabble.com/Problems-reading-a-datatset-using-h >>df-java-tp4015601.html >> Sent from the hdf-forum mailing list archive at Nabble.com. >> >> _______________________________________________ >> Hdf-forum is for HDF software users discussion. >> Hdf-forum@hdfgroup.org >> http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org >> > >-- >Thank you! >--pc > > >_______________________________________________ >Hdf-forum is for HDF software users discussion. >Hdf-forum@hdfgroup.org >http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org _______________________________________________ Hdf-forum is for HDF software users discussion. Hdf-forum@hdfgroup.org http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org