writing a variable in a netcdf 4 with IDL [message #89115] |
Fri, 25 July 2014 06:46 |
legonzo2004
Messages: 1 Registered: July 2014
|
Junior Member |
|
|
Hi,
I'm trying to modify with IDL 8.1 (i also tried 8.2) the values of a variable of a netcdf 4 file but it doesn't work. This variable is in a GROUP. I use the command 'ncdf_varput'
What is strange is that i can read with success the values of this variable with the command 'ncdf_varget'.
Here is an extract of my code :
-------------------------------------
; Open the netcdf4 file in Write mode
ncId=ncdf_open(ADF_file,/WRITE)
; get the id of the group 'group1'
cal_grpid = NCDF_NCIDINQ( ncID, 'group1' )
; get the id of the variable 'dark offset'
vName=['var1']
vId=ncdf_varid(cal_grpid,vName[0])
; read the variable (this works)
ncdf_varget, cal_grpid,vId,var1_read
print, var1_read[0:2,0:2,0:2]
; create replacement variable
var1_write=fltarr(dim1, dim2, dim3)+replace_value
; write the new variable (this doesn't work)
ncdf_varput, cal_grpid,vId, var1_write
; Close the ADF file
ncdf_close,ncId
------------------------------------
Then if i look at the content of the file ADF_file with ncdump, the values of the variable 'var1' have not been replaced.
Then If i run again the same program there is an error message :
HDF5-DIAG: Error detected in HDF5 (1.8.4-patch1) thread 0:
#000: H5Dio.c line 245 in H5Dwrite(): file selection+offset not within extent
major: Dataspace
minor: Out of range
NOte that i verified that the file has the rights for writing (chmod ugo+w ADF_file).
Thank you for your help.
|
|
|