Write image to CDF file [message #52329] |
Fri, 26 January 2007 02:51 |
schulze-till
Messages: 1 Registered: January 2007
|
Junior Member |
|
|
Hi all,
i want to save images with metadata in the cdf format. According to the
IDL Help i tried:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;code (not successful)
;create image, 256x256 floating values
img = dist(256)
;create CDF
id = CDF_CREATE('Temperature.cdf', /CLOBBER )
;some metadata
att_id = CDF_ATTCREATE(id, 'Title', /GLOBAL)
CDF_ATTPUT, id, att_id, 0, 'CDF TEST'
;write image
temp_id = CDF_VARCREATE(id, 'Temp', ['VARY', 'VARY'], $
/REC_VARY, /ZVAR, DIMENSIONS=[256,256],/CDF_FLOAT)
; write records:
CDF_VARPUT, id, temp_id, img
;here comes an error message:
;% CDF_VARPUT: CDF file error. NO_SUCH_VAR: Named variable not found in
this
; CDF.
CDF_CLOSE, id
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;
I tried a lot of different approaches (no ['VARY', 'VARY'], with
dimension information in the CDF_CREATE function, ...) but nothing
helped. I believe that I define the dimensions not correctly, but i
can't find the solution.
Thanks,
Thomas
|
|
|