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

Home » Public Forums » archive » HDF_SD_ADDDATA error attempting to copy variable from one HDF file to another
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
HDF_SD_ADDDATA error attempting to copy variable from one HDF file to another [message #94699] Mon, 28 August 2017 08:35 Go to previous message
BLesht is currently offline  BLesht
Messages: 89
Registered: March 2007
Member
I have two existing HDF files. I want to copy a variable from one and add it to the other. I thought this would be pretty straightforward, but I'm getting an error "Unable to write the specified HDF-SD slice" from the HDF_SD_ADDDATA step. Here is the relevant part of the code I'm using:

f1id = HDF_OPEN(fullL1A, /READ) ; Open the L1A file read only
sd1id = HDF_SD_START(fullL1A, /READ) ; Open the SD dataset read only
;
f2id = HDF_OPEN(inL2, /WRITE) ; Open the L2 file for writing
sd2id = HDF_SD_START(inL2, /RDWR) ; Open the L2 SD read/write
;
;
indx1 = HDF_SD_NAMETOINDEX(sd1id, 'ntilts') ; Find the L1A ntilts SD
sdvi1 = HDF_SD_SELECT(sd1id, indx1) ; Get the dataset ID
;
HDF_SD_GETDATA, sdvi1, ntilts ; Get the data
HDF_SD_GETINFO, sdvi1, DIMS=dims1, $ ; Get the information for ntilts
NATTS=numAttrs1, $
NAME=name1, $
TYPE=type1, $
/NOREVERSE

; Create the ntilts SD in the L2 file

newL2SD1 = HDF_SD_CREATE(sd2id, 'ntilts', [dims1], /LONG)

; Add the ntilts data to the L2 file

HDF_SD_ADDDATA, newL2SD1, ntilts

HDF_SD_ENDACCESS, newL2SD1 ; Close the L2 ntilts SD
HDF_SD_ENDACCESS, sdvi1 ; Close the L1 ntilts SD

HDF_SD_END, sd1id ; End the SD interface
HDF_CLOSE, f1id ; Close the file
;
HDF_SD_END, sd2id
HDF_CLOSE, f2id ; Close the file

I have checked the values of ntilts, etc. when they are retrieved from the L1A (source) file and they are correct. I also have checked the permissions on the file to which I want to add the data and they are correct.

Perhaps I've missed a step or am approaching this incorrectly. I'd appreciate any ideas about fixing or additional troubleshooting. Thanks.
[Message index]
 
Read Message
Read Message
Previous Topic: IDL Python Bridge
Next Topic: bug with min/max and non-finite values

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

Current Time: Wed Oct 08 14:10:55 PDT 2025

Total time taken to generate the page: 0.00416 seconds