Le 21/06/2010 09:47, Cedric Roux a écrit :
> Simone Marras wrote:
>
> ...
>> status = nc_redef(ncid);
>> if(status != NC_NOERR)
>> printf(" # Error in setting the file in Define Mode: %d (%s)\n", status,
>> nc_strerror(status));
>>
> ...
>> status = nc_put_vara_float(ncid, theta_id, start, count, theta);
>> if (status != NC_NOERR)
>> printf(" # Error in writing THETA values into the nc file: %d (%s)\n",
>> status, nc_strerror(status));
>>
> ...
>
Hello,
As a complement, always print the value of the status (and anything
which may help) when you tell user there is an error.
In both cases you did have a status of -39 which is "Operation not
allowed in define mode".
- redef not allowed when already in define mode (after a file creation
in this case). IMO it shoud have do nothing in this case but it is not
implemented this way.
- put/get data not allowed too when defining the file.
This is not needed only with netcdf4 files (nc_redef and nc_enddef are
automatic).
--
Philippe Poilbarbe
CLS - Space Oceanography Division