3 static void fstr2cstr(
char *cstr,
9 if ( cstr != fstr ) strncpy( cstr, fstr, len );
11 for ( i=len-1; i>=0; i-- ) {
12 if ( cstr[i] !=
' ' ) {
20 static void cstr2fstr(
char *fstr,
26 if ( fstr != cstr ) strncpy( fstr, cstr, len );
28 for ( i=0; i<len; i++ )
29 if ( cstr[i] ==
'\0' )
break;
31 for ( ; i < len; i++ )
45 fstr2cstr(_fname, fname, len);
65 fstr2cstr(_filetype, filetype, len);
68 fstr2cstr(_key, key, len);
71 fstr2cstr(_val, val, len);
89 fstr2cstr(_varname, varname, len);
129 fstr2cstr(_key, key, len);
134 cstr2fstr(value, _value, len);
148 fstr2cstr(_key, key, l);
164 fstr2cstr(_key, key, l);
180 fstr2cstr(_key, key, l);
197 fstr2cstr(_key, key, len);
200 fstr2cstr(_value, value, len);
215 fstr2cstr(_key, key, key_len);
231 fstr2cstr(_key, key, l);
247 fstr2cstr(_key, key, l);
260 fstr2cstr(_time_units, time_units, len);
280 fstr2cstr(_vname, vname, len);
283 fstr2cstr(_key, key, len);
286 fstr2cstr(_val, val, len);
304 int32_t dim_name_len)
313 fstr2cstr(_name, name, len);
316 fstr2cstr(_desc, desc, len);
319 fstr2cstr(_units, units, len);
322 fstr2cstr(_dim_name, dim_name, len);
324 *error =
file_put_axis( *fid, _name, _desc, _units, _dim_name, *dtype, val, *size, *precision );
338 int32_t dim_name_len)
347 fstr2cstr(_name, name, len);
350 fstr2cstr(_desc, desc, len);
353 fstr2cstr(_units, units, len);
356 fstr2cstr(_dim_name, dim_name, len);
358 *error =
file_def_axis( *fid, _name, _desc, _units, _dim_name, *dtype, *dim_size );
372 fstr2cstr(_name, name, len);
390 int32_t dim_name_len)
400 fstr2cstr(_name, name, len);
403 fstr2cstr(_desc, desc, len);
406 fstr2cstr(_units, units, len);
408 _dim_names = (
char**) malloc(
sizeof(
char*)*(*ndims));
410 for ( i=0; i<*ndims; i++ ) {
411 _dim_names[i] = (
char*) malloc(
sizeof(
char)*(
File_HSHORT+1));
412 fstr2cstr(_dim_names[i], dim_names+i*dim_name_len, len);
428 int32_t dim_name_len)
438 fstr2cstr(_name, name, len);
441 fstr2cstr(_desc, desc, len);
444 fstr2cstr(_units, units, len);
446 _dim_names = (
char**) malloc(
sizeof(
char*)*(*ndims));
448 for ( i=0; i<*ndims; i++ ) {
449 _dim_names[i] = (
char*) malloc(
sizeof(
char)*(
File_HSHORT+1));
450 fstr2cstr(_dim_names[i], dim_names+i*dim_name_len, len);
466 fstr2cstr(_name, name, len);
495 fstr2cstr(_varname, varname, len);
498 fstr2cstr(_desc, desc, len);
501 fstr2cstr(_units, units, len);
503 _dims = (
char**) malloc(
sizeof(
char*)*(*ndims));
505 for ( i=0; i<*ndims; i++ ) {
506 _dims[i] = (
char*) malloc(
sizeof(
char)*(
File_HSHORT+1));
507 fstr2cstr(_dims[i], dims+i*dims_len, len);
510 *error =
file_add_variable( vid, *fid, _varname, _desc, _units, _dims, *ndims, *dtype, *tint, *tavg );
512 for ( i=0; i<*ndims; i++ )
525 *error =
file_write_data( *fid, *vid, var, *t_start, *t_end, *precision );
535 *error =
file_write_var( *vid, var, *t_start, *t_end, *precision );
char dim_name[File_HSHORT *MAX_RANK]
char description[File_HMID]
char time_units[File_HMID]
char varname[File_HSHORT]