comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Need help with HDF_VD_WRITE!!!
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Need help with HDF_VD_WRITE!!! [message #32505 is a reply to message #32497] Fri, 11 October 2002 04:10 Go to previous messageGo to previous message
Brian Huether is currently offline  Brian Huether
Messages: 12
Registered: September 2002
Junior Member
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2800.1106" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><FONT face=Arial size=2>I thought I had it. But man this is so complicated.
Say I have one column of data with one field. All the following
fail:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>IDL&gt;
fileid=HDF_OPEN('e:\huether\test7.hdf',/CREATE)</FONT></DIV >
<DIV><FONT face=Arial size=2>IDL&gt; Vdat = HDF_VD_ATTACH(fileID, -1,
/WRITE)</FONT></DIV>
<DIV><FONT face=Arial size=2>IDL&gt; HDF_VD_WRITE, Vdat, 'PX', indgen(1,10)
</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>and also</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV><FONT size=1>
<DIV><FONT face=Arial size=2>IDL&gt;
fileid=HDF_OPEN('e:\huether\test8.hdf',/CREATE)</FONT></DIV >
<DIV><FONT face=Arial size=2>IDL&gt; Vdat = HDF_VD_ATTACH(fileID, -1,
/WRITE)</FONT></DIV>
<DIV><FONT face=Arial size=2>IDL&gt; HDF_VD_FDEFINE,
Vdat,'SS',/FLOAT</FONT></DIV>
<DIV><FONT face=Arial size=2>IDL&gt; HDF_VD_WRITE, Vdat, 'SS',
findgen(1,10)</FONT> </DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>In each case the error is</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>% HDF_VD_WRITE: Data array dimensioning mismatch
(&lt;FLOAT Array[1, 10]&gt;).</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>This is so annoying. Consider this:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV><FONT size=1>
<DIV><FONT face=Arial size=2>IDL&gt;
fileid=HDF_OPEN('e:\huether\test10.hdf',/CREATE)</FONT></DIV >
<DIV><FONT face=Arial size=2>IDL&gt; Vdat = HDF_VD_ATTACH(fileID, -1,
/WRITE)</FONT></DIV>
<DIV><FONT face=Arial size=2>IDL&gt; HDF_VD_WRITE, Vdat, 'SS', indgen(10)</FONT>
</DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>This causes the error</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV><FONT face=Arial size=2><FONT
size=1>
<DIV><FONT size=2>HDF_VD_WRITE: Unable to set the VDATA fieldnames to &lt;STRING
('SS')&gt;</FONT></DIV>
<DIV><FONT size=2></FONT>&nbsp;</DIV>
<DIV></FONT>But consider this:</FONT></DIV>
<DIV>&nbsp;
<DIV><FONT face=Arial size=2>IDL&gt;
fileid=HDF_OPEN('e:\huether\test11.hdf',/CREATE)</FONT></DIV >
<DIV><FONT face=Arial size=2>IDL&gt; Vdat = HDF_VD_ATTACH(fileID, -1,
/WRITE)</FONT></DIV></DIV>
<DIV><FONT face=Arial size=2>IDL&gt; HDF_VD_WRITE, Vdat, 'PX', indgen(10)</FONT>
</DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>This works fine! The only difference is that I am
using the string 'PX'!!!!!!!!!!!!!!!!!!!</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Man I have had it with this. So unbelievably
counterintuitive. Oh, and how is this for more insanity: The above works for
unclear reason as stated, but the form of</FONT></DIV>
<DIV><FONT face=Arial size=2>indgen(10) has 10 columns. Try replacing that with
indgen(1,10) and we have the same problem as above.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>If the creaters of this API are watching, can you
please write a user's manual for HDF_VD alone?</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>-brian</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV></FONT></FONT>
<DIV><FONT face=Arial size=2>"James Kuyper" &lt;</FONT><A
href="mailto:kuyper@saicmodis.com"><FONT face=Arial
size=2>kuyper@saicmodis.com</FONT></A><FONT face=Arial size=2>&gt; schrieb im
Newsbeitrag </FONT><A href="news:3DA59E5F.F5098369@saicmodis.com"><FONT
face=Arial size=2>news:3DA59E5F.F5098369@saicmodis.com</FONT></A><FONT
face=Arial size=2>...</FONT></DIV><FONT face=Arial size=2>&gt; &gt; Brian
Huether wrote:<BR>&gt; &gt; <BR>&gt; &gt; This is quite maddening. I am using
IDL 5.2 and am working with HDF<BR>&gt; &gt; files. Consider an array with 2
columns, where each col is a field and<BR>&gt; &gt; each row a record. In the
language of HDF, that would be a VDATA. In<BR>&gt; &gt; theory, then the
following commands should work:<BR>&gt; &gt; <BR>&gt; &gt;
fid=HDF_OPEN('test.hdf',/CREATE)<BR>&gt; &gt; Vdat2 = HDF_VD_ATTACH(fid, -1,
/WRITE)<BR>&gt; <BR>&gt; Before you can write any records, you first need to
call HDF_VD_DEFINE<BR>&gt; to define each field in the vdata:<BR>&gt; <BR>&gt;
IDL&gt; HDF_VD_FDEFINE, Vdat2, 'F1', /FLOAT <BR>&gt; IDL&gt; HDF_VD_FDEFINE,
Vdat2, 'F2', /FLOAT<BR>&gt; <BR>&gt; &gt; HDF_VD_WRITE, Vdat2, 'F1,F2',
fltarr(2,10)<BR>&gt; <BR>&gt; I'm not entirely sure what the field list argument
is for in<BR>&gt; HDF_VD_WRITE. The corresponding raw HDF function can only
write an<BR>&gt; entire record, and can only be called for a vdata that has
already had<BR>&gt; it's fields defined. I tried the following:<BR>&gt; <BR>&gt;
IDL&gt; HDF_VD_WRITE, Vdat2, 'F1', 1.0<BR>&gt; % HDF_VD_WRITE: Insufficient data
in item (&lt;FLOAT&nbsp;&nbsp;&nbsp; (&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
1.00000)&gt;)<BR>&gt; to<BR>&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
write even 1 record.<BR>&gt; <BR>&gt; However, the following was
accepted:<BR>&gt; <BR>&gt; HDF_VD_WRITE, Vdat2, 'F1', [1.0,2.0]<BR>&gt; <BR>&gt;
And vshow gave me the following results after I closed the file:<BR>&gt; FILE:
test.hdf<BR>&gt; No vgroups in this file<BR>&gt; Lone vdatas:<BR>&gt; L vs:2
&lt;1962/2&gt; nv=11 i=0 fld [F1,F2] vsize=8 (NoName {})<BR>&gt; 0: fld [F1],
type=5, order=1<BR>&gt; 1: fld [F2], type=5, order=1<BR>&gt; 0.000000&nbsp;
0.000000&nbsp; 0.000000&nbsp; 0.000000&nbsp; 0.000000&nbsp; 0.000000&nbsp;
0.000000 <BR>&gt; 0.000000&nbsp; <BR>&gt; 0.000000&nbsp; 0.000000&nbsp;
0.000000&nbsp; 0.000000&nbsp; 0.000000&nbsp; 0.000000&nbsp; 0.000000 <BR>&gt;
0.000000&nbsp; <BR>&gt; 0.000000&nbsp; 0.000000&nbsp; 0.000000&nbsp;
0.000000&nbsp; 1.000000&nbsp; 2.000000&nbsp; <BR>&gt; &nbsp;0
attributes.<BR>&gt; <BR>&gt; Which looks to me like it wrote [1.0,2.0] exactly
as if I'd indicated<BR>&gt; "F1,F2", rather than simply "F1". So I'm
confused.<BR>&gt; <BR>&gt; -- <BR>&gt; James Kuyper<BR>&gt; MODIS Level 1
Lead<BR>&gt; Science Data Support Team<BR>&gt; (301)
352-2150</FONT></BODY></HTML>
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: varimax rotation
Next Topic: droplist doesn't work under Linux

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 14:33:35 PDT 2025

Total time taken to generate the page: 0.16307 seconds