On Aug 6, 11:05 am, kuyper <kuy...@wizard.net> wrote:
> I just performed a test, and I had no problems overwriting data using
> code similar to yours. The one important thing that seems to be
> missing from your code is a call to HDF_SD_End, but what you've
> written is obviously a code fragment, rather than a complete program,
> so I'm not sure whether that procedure call is really missing.
Thanks for replying. No I have not missed that command. This is what I
am doing. I am reading the dataset into a text file. the text file
contains 3 columns seperated by spaces. I read the text file line by
line to get the 3 values (D,A and G). use it in the formula to get the
results and write it back to the HDF file. I get the correct results
if I output the results to tiff file. But I am not able to get the
same results when I write it back to the HDF file. this is what my
code looks like
sdFileID2 = HDF_SD_Start(fname, /RdWr)
sdsIDsm = HDF_SD_Select(sdFileID2,im[j]) ; Image data
sdsIDsm2 = HDF_SD_Select(sdFileID2,bd[j]) ; recorrection data
HDF_SD_GETDATA, sdsIDsm, rr, start=[0,0], count=[x[j],y[j]],
stride=[0,0]
HDF_SD_GETDATA, sdsIDsm2, r2
; Writing it into a text file
openw, lun, out_path+'Step1\'+strcompress(fn[3],/remove_all)
+'-'+strcompress(j,/remove_all)+'.txt', /get_lun
printf, lun, r2
close, lun
free_lun, lun
results=fltarr(x[j],y[j])
rowp=fltarr(x[j],y[j])
openr, lun1, out_path+'Step1\'+strcompress(fn[3],/remove_all)
+'-'+strcompress(j,/remove_all)+'.txt', /get_lun
; Reading line by line to D, A, G values
while ((~eof(lun1)) && (n lt x[j])) do begin
readf, lun1, temp1
sr = strsplit(temp1,' ', /Extract)
d=float(sr[0])
a=float(sr[1])
g=float(sr[2])
print, d, a, g
results[n,*]=(float(a)*(rr[(n),*])/float(g))+float(d)
rowp[n,*]=(3.14159*results[n,*]*sd*sd)/(esun[j]*COS((90-
theta)*3.14159/180))
n=n+1
endwhile
HDF_SD_ADDDATA, sdsIDsm, rowp, start=[0,0], count=[x[j],y[j]],
stride=[0,0]
HDF_SD_EndAccess, sdsIDsm
HDF_SD_END, sdFileID2
Thanks
Rajesh
|