SCALE-RM
Functions
gtool_file_f.c File Reference
#include "gtool_file.h"
Include dependency graph for gtool_file_f.c:

Go to the source code of this file.

Functions

void file_open_ (int32_t *fid, char *fname, int32_t *mode, int32_t *comm, int32_t *error, int32_t fname_len)
 
void file_set_option_ (int32_t *fid, char *filetype, char *key, char *val, int32_t *error, int32_t filetype_len, int32_t key_len, int32_t val_len)
 
void file_get_datainfo_ (datainfo_t *dinfo, int32_t *fid, char *varname, int32_t *step, int32_t *suppress, int32_t *error, int32_t varname_len)
 
void file_read_data_ (void *var, datainfo_t *dinfo, int32_t *precision, int32_t *error)
 
void file_read_data_par_ (void *var, datainfo_t *dinfo, int32_t *ndims, int32_t *ntypes, int32_t *dtype, int32_t *start, int32_t *count, int32_t *error)
 
void file_get_global_attribute_text_ (int32_t *fid, char *key, char *value, int32_t *error, int32_t key_len, int32_t value_len)
 
void file_get_global_attribute_int_ (int32_t *fid, char *key, int32_t *len, int32_t *value, int32_t *error, int32_t key_len)
 
void file_get_global_attribute_float_ (int32_t *fid, char *key, int32_t *len, float *value, int32_t *error, int32_t key_len)
 
void file_get_global_attribute_double_ (int32_t *fid, char *key, int32_t *len, double *value, int32_t *error, int32_t key_len)
 
void file_set_global_attribute_text_ (int32_t *fid, char *key, char *value, int32_t *error, int32_t key_len, int32_t value_len)
 
void file_set_global_attribute_int_ (int32_t *fid, char *key, int32_t *value, int32_t *len, int32_t *error, int32_t key_len)
 
void file_set_global_attribute_float_ (int32_t *fid, char *key, float *value, int32_t *len, int32_t *error, int32_t key_len)
 
void file_set_global_attribute_double_ (int32_t *fid, char *key, double *value, int32_t *len, int32_t *error, int32_t key_len)
 
void file_set_tunits_ (int32_t *fid, char *time_units, int32_t *error, int32_t len)
 
void file_set_tattr_ (int32_t *fid, char *vname, char *key, char *val, int32_t *error, int32_t vname_len, int32_t key_len, int32_t val_len)
 
void file_put_axis_ (int32_t *fid, char *name, char *desc, char *units, char *dim_name, int32_t *dtype, void *val, int32_t *size, int32_t *precision, int32_t *error, int32_t name_len, int32_t desc_len, int32_t units_len, int32_t dim_name_len)
 
void file_def_axis_ (int32_t *fid, char *name, char *desc, char *units, char *dim_name, int32_t *dtype, int32_t *dim_size, int32_t *error, int32_t name_len, int32_t desc_len, int32_t units_len, int32_t dim_name_len)
 
void file_write_axis_ (int32_t *fid, char *name, void *val, int32_t *precision, int32_t *start, int32_t *count, int32_t *error, int32_t name_len)
 
void file_put_associated_coordinates_ (int32_t *fid, char *name, char *desc, char *units, char *dim_names, int32_t *ndims, int32_t *dtype, void *val, int32_t *precision, int32_t *error, int32_t name_len, int32_t desc_len, int32_t units_len, int32_t dim_name_len)
 
void file_def_associated_coordinates_ (int32_t *fid, char *name, char *desc, char *units, char *dim_names, int32_t *ndims, int32_t *dtype, int32_t *error, int32_t name_len, int32_t desc_len, int32_t units_len, int32_t dim_name_len)
 
void file_write_associated_coordinates_ (int32_t *fid, char *name, void *val, int32_t *precision, int32_t *ndims, int32_t *start, int32_t *count, int32_t *error, int32_t name_len)
 
void file_add_variable_ (int32_t *vid, int32_t *fid, char *varname, char *desc, char *units, char *dims, int32_t *ndims, int32_t *dtype, real64_t *tint, int32_t *tavg, int32_t *error, int32_t varname_len, int32_t desc_len, int32_t units_len, int32_t dims_len)
 
void file_write_data_ (int32_t *fid, int32_t *vid, void *var, real64_t *t_start, real64_t *t_end, int32_t *precision, int32_t *ndims, int32_t *start, int32_t *count, int32_t *error)
 
void file_close_ (int32_t *fid, int32_t *error)
 
void file_enddef_ (int32_t *fid, int32_t *error)
 
void file_attach_buffer_ (int32_t *fid, int32_t *buf_amount, int32_t *error)
 
void file_detach_buffer_ (int32_t *fid, int32_t *error)
 
void file_flush_ (int32_t *fid, int32_t *error)
 

Function Documentation

◆ file_open_()

void file_open_ ( int32_t *  fid,
char *  fname,
int32_t *  mode,
int32_t *  comm,
int32_t *  error,
int32_t  fname_len 
)

Definition at line 39 of file gtool_file_f.c.

45 {
46  char _fname[File_HLONG+1];
47  int32_t len;
48 
49  len = fname_len > File_HLONG ? File_HLONG : fname_len;
50  fstr2cstr(_fname, fname, len);
51 
52  *error = file_open( fid, _fname, *mode, MPI_Comm_f2c(*comm) );
53 }
int32_t file_open(int32_t *fid, char *fname, int32_t mode, MPI_Comm comm)
Definition: gtool_netcdf.c:132
#define File_HLONG
Definition: gtool_file.h:14

◆ file_set_option_()

void file_set_option_ ( int32_t *  fid,
char *  filetype,
char *  key,
char *  val,
int32_t *  error,
int32_t  filetype_len,
int32_t  key_len,
int32_t  val_len 
)

Definition at line 55 of file gtool_file_f.c.

References File_HMID, and File_HSHORT.

63 {
64  char _filetype[File_HSHORT+1];
65  char _key[File_HMID+1];
66  char _val[File_HMID+1];
67  int32_t len;
68 
69  len = filetype_len > File_HSHORT ? File_HSHORT : filetype_len;
70  fstr2cstr(_filetype, filetype, len);
71 
72  len = key_len > File_HMID ? File_HMID : key_len;
73  fstr2cstr(_key, key, len);
74 
75  len = val_len > File_HMID ? File_HMID : val_len;
76  fstr2cstr(_val, val, len);
77 
78  *error = file_set_option(*fid, _filetype, _key, _val);
79 }
#define File_HMID
Definition: gtool_file.h:13
#define File_HSHORT
Definition: gtool_file.h:12
int32_t file_set_option(int32_t fid, char *filetype, char *key, char *val)
Definition: gtool_netcdf.c:202

◆ file_get_datainfo_()

void file_get_datainfo_ ( datainfo_t dinfo,
int32_t *  fid,
char *  varname,
int32_t *  step,
int32_t *  suppress,
int32_t *  error,
int32_t  varname_len 
)

Definition at line 81 of file gtool_file_f.c.

88 {
89  char _varname[File_HSHORT+1];
90  int32_t len;
91  int i;
92 
93  len = varname_len > File_HSHORT ? File_HSHORT : varname_len;
94  fstr2cstr(_varname, varname, len);
95 
96  *error = file_get_datainfo( dinfo, *fid, _varname, *step, *suppress );
97 
98  cstr2fstr(dinfo->varname, dinfo->varname, File_HSHORT);
99  cstr2fstr(dinfo->description, dinfo->description, File_HMID);
100  cstr2fstr(dinfo->units, dinfo->units, File_HSHORT);
101  cstr2fstr(dinfo->time_units, dinfo->time_units, File_HMID);
102  for ( i=0; i<MAX_RANK; i++ )
103  cstr2fstr(dinfo->dim_name+i*File_HSHORT, dinfo->dim_name+i*File_HSHORT, File_HSHORT);
104 }
#define File_HMID
Definition: gtool_file.h:13
#define MAX_RANK
Definition: gtool_file.h:35
char dim_name[File_HSHORT *MAX_RANK]
Definition: gtool_file.h:48
char description[File_HMID]
Definition: gtool_file.h:44
int32_t file_get_datainfo(datainfo_t *dinfo, int32_t fid, char *varname, int32_t step, int32_t suppress)
Definition: gtool_netcdf.c:218
#define File_HSHORT
Definition: gtool_file.h:12
char time_units[File_HMID]
Definition: gtool_file.h:53
char units[File_HSHORT]
Definition: gtool_file.h:45
char varname[File_HSHORT]
Definition: gtool_file.h:43

◆ file_read_data_()

void file_read_data_ ( void *  var,
datainfo_t dinfo,
int32_t *  precision,
int32_t *  error 
)

Definition at line 105 of file gtool_file_f.c.

109 {
110  int i;
111 
112  fstr2cstr(dinfo->varname, dinfo->varname, File_HSHORT-1);
113  fstr2cstr(dinfo->description, dinfo->description, File_HMID-1);
114  fstr2cstr(dinfo->units, dinfo->units, File_HSHORT-1);
115  fstr2cstr(dinfo->time_units, dinfo->time_units, File_HMID-1);
116  for ( i=0; i<MAX_RANK; i++ )
117  fstr2cstr(dinfo->dim_name+i*File_HSHORT, dinfo->dim_name+i*File_HSHORT, File_HSHORT-1);
118 
119  *error = file_read_data( var, dinfo, *precision );
120 }
#define File_HMID
Definition: gtool_file.h:13
#define MAX_RANK
Definition: gtool_file.h:35
char dim_name[File_HSHORT *MAX_RANK]
Definition: gtool_file.h:48
char description[File_HMID]
Definition: gtool_file.h:44
#define File_HSHORT
Definition: gtool_file.h:12
char time_units[File_HMID]
Definition: gtool_file.h:53
char units[File_HSHORT]
Definition: gtool_file.h:45
char varname[File_HSHORT]
Definition: gtool_file.h:43
int32_t file_read_data(void *var, datainfo_t *dinfo, int32_t precision)
Definition: gtool_netcdf.c:390

◆ file_read_data_par_()

void file_read_data_par_ ( void *  var,
datainfo_t dinfo,
int32_t *  ndims,
int32_t *  ntypes,
int32_t *  dtype,
int32_t *  start,
int32_t *  count,
int32_t *  error 
)

Definition at line 122 of file gtool_file_f.c.

130 {
131  int i;
132  MPI_Offset ntypes_, start_[4], count_[4];
133 
134  fstr2cstr(dinfo->varname, dinfo->varname, File_HSHORT-1);
135  fstr2cstr(dinfo->description, dinfo->description, File_HMID-1);
136  fstr2cstr(dinfo->units, dinfo->units, File_HSHORT-1);
137  fstr2cstr(dinfo->time_units, dinfo->time_units, File_HMID-1);
138  for ( i=0; i<MAX_RANK; i++ )
139  fstr2cstr(dinfo->dim_name+i*File_HSHORT, dinfo->dim_name+i*File_HSHORT, File_HSHORT-1);
140 
141  for (i=0; i<*ndims; i++) {
142  start_[i+1] = start[*ndims - i - 1] - 1;
143  count_[i+1] = count[*ndims - i - 1];
144  }
145  ntypes_ = (MPI_Offset)(*ntypes);
146 
147  *error = file_read_data_par( var, dinfo, ntypes_, MPI_Type_f2c(*dtype), start_, count_ );
148 }
#define File_HMID
Definition: gtool_file.h:13
#define MAX_RANK
Definition: gtool_file.h:35
char dim_name[File_HSHORT *MAX_RANK]
Definition: gtool_file.h:48
char description[File_HMID]
Definition: gtool_file.h:44
#define File_HSHORT
Definition: gtool_file.h:12
int32_t file_read_data_par(void *var, datainfo_t *dinfo, MPI_Offset ntypes, MPI_Datatype dtype, MPI_Offset *start, MPI_Offset *count)
Definition: gtool_netcdf.c:439
char time_units[File_HMID]
Definition: gtool_file.h:53
char units[File_HSHORT]
Definition: gtool_file.h:45
char varname[File_HSHORT]
Definition: gtool_file.h:43

◆ file_get_global_attribute_text_()

void file_get_global_attribute_text_ ( int32_t *  fid,
char *  key,
char *  value,
int32_t *  error,
int32_t  key_len,
int32_t  value_len 
)

Definition at line 150 of file gtool_file_f.c.

156 {
157  char _key[File_HLONG+1];
158  char _value[File_HLONG+1];
159  int32_t len;
160 
161  len = key_len > File_HLONG ? File_HLONG : key_len;
162  fstr2cstr(_key, key, len);
163 
164  *error = file_get_global_attribute_text( *fid, _key, _value, value_len );
165 
166  len = value_len > File_HLONG ? File_HLONG : value_len;
167  cstr2fstr(value, _value, len);
168 }
int32_t file_get_global_attribute_text(int32_t fid, char *key, char *value, int32_t len)
Definition: gtool_netcdf.c:466
#define File_HLONG
Definition: gtool_file.h:14

◆ file_get_global_attribute_int_()

void file_get_global_attribute_int_ ( int32_t *  fid,
char *  key,
int32_t *  len,
int32_t *  value,
int32_t *  error,
int32_t  key_len 
)

Definition at line 170 of file gtool_file_f.c.

176 {
177  char _key[File_HLONG+1];
178  int32_t l;
179 
180  l = key_len > File_HLONG ? File_HLONG : key_len;
181  fstr2cstr(_key, key, l);
182 
183  *error = file_get_global_attribute_int( *fid, _key, value, (size_t)*len );
184 }
int32_t file_get_global_attribute_int(int32_t fid, char *key, int32_t *value, size_t len)
#define File_HLONG
Definition: gtool_file.h:14

◆ file_get_global_attribute_float_()

void file_get_global_attribute_float_ ( int32_t *  fid,
char *  key,
int32_t *  len,
float value,
int32_t *  error,
int32_t  key_len 
)

Definition at line 186 of file gtool_file_f.c.

192 {
193  char _key[File_HLONG+1];
194  int32_t l;
195 
196  l = key_len > File_HLONG ? File_HLONG : key_len;
197  fstr2cstr(_key, key, l);
198 
199  *error = file_get_global_attribute_float( *fid, _key, value, (size_t)*len );
200 }
int32_t file_get_global_attribute_float(int32_t fid, char *key, float *value, size_t len)
Definition: gtool_netcdf.c:504
#define File_HLONG
Definition: gtool_file.h:14

◆ file_get_global_attribute_double_()

void file_get_global_attribute_double_ ( int32_t *  fid,
char *  key,
int32_t *  len,
double value,
int32_t *  error,
int32_t  key_len 
)

Definition at line 202 of file gtool_file_f.c.

208 {
209  char _key[File_HLONG+1];
210  int32_t l;
211 
212  l = key_len > File_HLONG ? File_HLONG : key_len;
213  fstr2cstr(_key, key, l);
214 
215  *error = file_get_global_attribute_double( *fid, _key, value, (size_t)*len );
216 }
int32_t file_get_global_attribute_double(int32_t fid, char *key, double *value, size_t len)
Definition: gtool_netcdf.c:522
#define File_HLONG
Definition: gtool_file.h:14

◆ file_set_global_attribute_text_()

void file_set_global_attribute_text_ ( int32_t *  fid,
char *  key,
char *  value,
int32_t *  error,
int32_t  key_len,
int32_t  value_len 
)

Definition at line 218 of file gtool_file_f.c.

224 {
225  char _key[File_HLONG+1];
226  char _value[File_HLONG+1];
227  int32_t len;
228 
229  len = key_len > File_HLONG ? File_HLONG : key_len;
230  fstr2cstr(_key, key, len);
231 
232  len = value_len > File_HLONG ? File_HLONG : value_len;
233  fstr2cstr(_value, value, len);
234 
235  *error = file_set_global_attribute_text( *fid, _key, _value );
236 }
int32_t file_set_global_attribute_text(int32_t fid, char *key, char *value)
Definition: gtool_netcdf.c:540
#define File_HLONG
Definition: gtool_file.h:14

◆ file_set_global_attribute_int_()

void file_set_global_attribute_int_ ( int32_t *  fid,
char *  key,
int32_t *  value,
int32_t *  len,
int32_t *  error,
int32_t  key_len 
)

Definition at line 238 of file gtool_file_f.c.

244 {
245  char _key[File_HLONG+1];
246 
247  key_len = key_len > File_HLONG ? File_HLONG : key_len;
248  fstr2cstr(_key, key, key_len);
249 
250  *error = file_set_global_attribute_int( *fid, _key, value, (size_t)*len );
251 }
int32_t file_set_global_attribute_int(int32_t fid, char *key, int32_t *value, size_t len)
#define File_HLONG
Definition: gtool_file.h:14

◆ file_set_global_attribute_float_()

void file_set_global_attribute_float_ ( int32_t *  fid,
char *  key,
float value,
int32_t *  len,
int32_t *  error,
int32_t  key_len 
)

Definition at line 253 of file gtool_file_f.c.

259 {
260  char _key[File_HLONG+1];
261  int32_t l;
262 
263  l = key_len > File_HLONG ? File_HLONG : key_len;
264  fstr2cstr(_key, key, l);
265 
266  *error = file_set_global_attribute_float( *fid, _key, value, (size_t)*len );
267 }
int32_t file_set_global_attribute_float(int32_t fid, char *key, float *value, size_t len)
Definition: gtool_netcdf.c:593
#define File_HLONG
Definition: gtool_file.h:14

◆ file_set_global_attribute_double_()

void file_set_global_attribute_double_ ( int32_t *  fid,
char *  key,
double value,
int32_t *  len,
int32_t *  error,
int32_t  key_len 
)

Definition at line 269 of file gtool_file_f.c.

275 {
276  char _key[File_HLONG+1];
277  int32_t l;
278 
279  l = key_len > File_HLONG ? File_HLONG : key_len;
280  fstr2cstr(_key, key, l);
281 
282  *error = file_set_global_attribute_double( *fid, _key, value, (size_t)*len );
283 }
int32_t file_set_global_attribute_double(int32_t fid, char *key, double *value, size_t len)
Definition: gtool_netcdf.c:620
#define File_HLONG
Definition: gtool_file.h:14

◆ file_set_tunits_()

void file_set_tunits_ ( int32_t *  fid,
char *  time_units,
int32_t *  error,
int32_t  len 
)

Definition at line 285 of file gtool_file_f.c.

References File_HMID.

289 {
290  char _time_units[File_HMID+1];
291 
292  len = len > File_HMID ? File_HMID : len;
293  fstr2cstr(_time_units, time_units, len);
294 
295  *error = file_set_tunits( *fid, _time_units );
296 }
int32_t file_set_tunits(int32_t fid, char *time_units)
Definition: gtool_netcdf.c:647
#define File_HMID
Definition: gtool_file.h:13

◆ file_set_tattr_()

void file_set_tattr_ ( int32_t *  fid,
char *  vname,
char *  key,
char *  val,
int32_t *  error,
int32_t  vname_len,
int32_t  key_len,
int32_t  val_len 
)

Definition at line 298 of file gtool_file_f.c.

References File_HLONG, and File_HSHORT.

306 {
307  char _vname[File_HSHORT+1];
308  char _key[File_HSHORT+1];
309  char _val[File_HLONG+1];
310  int32_t len;
311 
312  len = vname_len > File_HLONG ? File_HLONG : vname_len;
313  fstr2cstr(_vname, vname, len);
314 
315  len = key_len > File_HLONG ? File_HLONG : key_len;
316  fstr2cstr(_key, key, len);
317 
318  len = val_len > File_HLONG ? File_HLONG : val_len;
319  fstr2cstr(_val, val, len);
320 
321  *error = file_set_tattr( *fid, _vname, _key, _val );
322 }
int32_t file_set_tattr(int32_t fid, char *vname, char *key, char *val)
Definition: gtool_netcdf.c:655
#define File_HSHORT
Definition: gtool_file.h:12
#define File_HLONG
Definition: gtool_file.h:14

◆ file_put_axis_()

void file_put_axis_ ( int32_t *  fid,
char *  name,
char *  desc,
char *  units,
char *  dim_name,
int32_t *  dtype,
void *  val,
int32_t *  size,
int32_t *  precision,
int32_t *  error,
int32_t  name_len,
int32_t  desc_len,
int32_t  units_len,
int32_t  dim_name_len 
)

Definition at line 324 of file gtool_file_f.c.

338 {
339  char _name[File_HSHORT+1];
340  char _desc[File_HMID+1];
341  char _units[File_HMID+1];
342  char _dim_name[File_HSHORT+1];
343  int len;
344 
345  len = name_len > File_HSHORT ? File_HSHORT : name_len;
346  fstr2cstr(_name, name, len);
347 
348  len = desc_len > File_HMID ? File_HMID : desc_len;
349  fstr2cstr(_desc, desc, len);
350 
351  len = units_len > File_HMID ? File_HMID : units_len;
352  fstr2cstr(_units, units, len);
353 
354  len = dim_name_len > File_HSHORT ? File_HSHORT : dim_name_len;
355  fstr2cstr(_dim_name, dim_name, len);
356 
357  *error = file_put_axis( *fid, _name, _desc, _units, _dim_name, *dtype, val, *size, *precision );
358 }
#define File_HMID
Definition: gtool_file.h:13
#define File_HSHORT
Definition: gtool_file.h:12
int32_t file_put_axis(int32_t fid, char *name, char *desc, char *units, char *dim_name, int32_t dtype, void *val, int32_t size, int32_t precision)
Definition: gtool_netcdf.c:694

◆ file_def_axis_()

void file_def_axis_ ( int32_t *  fid,
char *  name,
char *  desc,
char *  units,
char *  dim_name,
int32_t *  dtype,
int32_t *  dim_size,
int32_t *  error,
int32_t  name_len,
int32_t  desc_len,
int32_t  units_len,
int32_t  dim_name_len 
)

Definition at line 360 of file gtool_file_f.c.

372 {
373  char _name[File_HSHORT+1];
374  char _desc[File_HMID+1];
375  char _units[File_HMID+1];
376  char _dim_name[File_HSHORT+1];
377  int len;
378 
379  len = name_len > File_HSHORT ? File_HSHORT : name_len;
380  fstr2cstr(_name, name, len);
381 
382  len = desc_len > File_HMID ? File_HMID : desc_len;
383  fstr2cstr(_desc, desc, len);
384 
385  len = units_len > File_HMID ? File_HMID : units_len;
386  fstr2cstr(_units, units, len);
387 
388  len = dim_name_len > File_HSHORT ? File_HSHORT : dim_name_len;
389  fstr2cstr(_dim_name, dim_name, len);
390 
391  *error = file_def_axis( *fid, _name, _desc, _units, _dim_name, *dtype, *dim_size );
392 }
#define File_HMID
Definition: gtool_file.h:13
#define File_HSHORT
Definition: gtool_file.h:12
int32_t file_def_axis(int32_t fid, char *name, char *desc, char *units, char *dim_name, int32_t dtype, int32_t dim_size)
Definition: gtool_netcdf.c:748

◆ file_write_axis_()

void file_write_axis_ ( int32_t *  fid,
char *  name,
void *  val,
int32_t *  precision,
int32_t *  start,
int32_t *  count,
int32_t *  error,
int32_t  name_len 
)

Definition at line 394 of file gtool_file_f.c.

402 {
403  char _name[File_HSHORT+1];
404  int len;
405  MPI_Offset start_[1], count_[1];
406 
407  len = name_len > File_HSHORT ? File_HSHORT : name_len;
408  fstr2cstr(_name, name, len);
409 
410  /* all axes are 1D */
411  start_[0] = *start - 1; /* C index is 0-based */
412  count_[0] = *count;
413 
414  *error = file_write_axis( *fid, _name, val, *precision, start_, count_ );
415 }
#define File_HSHORT
Definition: gtool_file.h:12
int32_t file_write_axis(int32_t fid, char *name, void *val, int32_t precision, MPI_Offset *start, MPI_Offset *count)
Definition: gtool_netcdf.c:797

◆ file_put_associated_coordinates_()

void file_put_associated_coordinates_ ( int32_t *  fid,
char *  name,
char *  desc,
char *  units,
char *  dim_names,
int32_t *  ndims,
int32_t *  dtype,
void *  val,
int32_t *  precision,
int32_t *  error,
int32_t  name_len,
int32_t  desc_len,
int32_t  units_len,
int32_t  dim_name_len 
)

Definition at line 417 of file gtool_file_f.c.

431 {
432  char _name[File_HSHORT+1];
433  char _desc[File_HMID+1];
434  char _units[File_HMID+1];
435  char **_dim_names;
436  int len;
437  int i;
438 
439  len = name_len > File_HSHORT ? File_HSHORT : name_len;
440  fstr2cstr(_name, name, len);
441 
442  len = desc_len > File_HMID ? File_HMID : desc_len;
443  fstr2cstr(_desc, desc, len);
444 
445  len = units_len > File_HMID ? File_HMID : units_len;
446  fstr2cstr(_units, units, len);
447 
448  _dim_names = (char**) malloc(sizeof(char*)*(*ndims));
449  len = dim_name_len > File_HSHORT ? File_HSHORT : dim_name_len;
450  for ( i=0; i<*ndims; i++ ) {
451  _dim_names[i] = (char*) malloc(sizeof(char)*(File_HSHORT+1));
452  fstr2cstr(_dim_names[i], dim_names+i*dim_name_len, len);
453  }
454  *error = file_put_associated_coordinates( *fid, _name, _desc, _units, _dim_names, *ndims, *dtype, val, *precision );
455 }
#define File_HMID
Definition: gtool_file.h:13
#define File_HSHORT
Definition: gtool_file.h:12
int32_t file_put_associated_coordinates(int32_t fid, char *name, char *desc, char *units, char **dim_names, int32_t ndims, int32_t dtype, void *val, int32_t precision)
Definition: gtool_netcdf.c:842

◆ file_def_associated_coordinates_()

void file_def_associated_coordinates_ ( int32_t *  fid,
char *  name,
char *  desc,
char *  units,
char *  dim_names,
int32_t *  ndims,
int32_t *  dtype,
int32_t *  error,
int32_t  name_len,
int32_t  desc_len,
int32_t  units_len,
int32_t  dim_name_len 
)

Definition at line 457 of file gtool_file_f.c.

469 {
470  char _name[File_HSHORT+1];
471  char _desc[File_HMID+1];
472  char _units[File_HMID+1];
473  char **_dim_names;
474  int len;
475  int i;
476 
477  len = name_len > File_HSHORT ? File_HSHORT : name_len;
478  fstr2cstr(_name, name, len);
479 
480  len = desc_len > File_HMID ? File_HMID : desc_len;
481  fstr2cstr(_desc, desc, len);
482 
483  len = units_len > File_HMID ? File_HMID : units_len;
484  fstr2cstr(_units, units, len);
485 
486  _dim_names = (char**) malloc(sizeof(char*)*(*ndims));
487  len = dim_name_len > File_HSHORT ? File_HSHORT : dim_name_len;
488  for ( i=0; i<*ndims; i++ ) {
489  _dim_names[i] = (char*) malloc(sizeof(char)*(File_HSHORT+1));
490  fstr2cstr(_dim_names[i], dim_names+i*dim_name_len, len);
491  }
492  *error = file_def_associated_coordinates( *fid, _name, _desc, _units, _dim_names, *ndims, *dtype );
493 }
#define File_HMID
Definition: gtool_file.h:13
#define File_HSHORT
Definition: gtool_file.h:12
int32_t file_def_associated_coordinates(int32_t fid, char *name, char *desc, char *units, char **dim_names, int32_t ndims, int32_t dtype)
Definition: gtool_netcdf.c:900

◆ file_write_associated_coordinates_()

void file_write_associated_coordinates_ ( int32_t *  fid,
char *  name,
void *  val,
int32_t *  precision,
int32_t *  ndims,
int32_t *  start,
int32_t *  count,
int32_t *  error,
int32_t  name_len 
)

Definition at line 495 of file gtool_file_f.c.

504 {
505  char _name[File_HSHORT+1];
506  int i, len;
507  MPI_Offset start_[4], count_[4];
508  /* all associated coordinates are up to 4D */
509 
510  len = name_len > File_HSHORT ? File_HSHORT : name_len;
511  fstr2cstr(_name, name, len);
512 
513  for (i=0; i<*ndims; i++) {
514  start_[i] = start[*ndims - i - 1] - 1;
515  count_[i] = count[*ndims - i - 1];
516  }
517  *error = file_write_associated_coordinates( *fid, _name, val, *precision, start_, count_ );
518 }
#define File_HSHORT
Definition: gtool_file.h:12
int32_t file_write_associated_coordinates(int32_t fid, char *name, void *val, int32_t precision, MPI_Offset *start, MPI_Offset *count)
Definition: gtool_netcdf.c:956

◆ file_add_variable_()

void file_add_variable_ ( int32_t *  vid,
int32_t *  fid,
char *  varname,
char *  desc,
char *  units,
char *  dims,
int32_t *  ndims,
int32_t *  dtype,
real64_t *  tint,
int32_t *  tavg,
int32_t *  error,
int32_t  varname_len,
int32_t  desc_len,
int32_t  units_len,
int32_t  dims_len 
)

Definition at line 520 of file gtool_file_f.c.

535 {
536  char _varname[File_HSHORT+1];
537  char _desc[File_HMID+1];
538  char _units[File_HMID+1];
539  char **_dims;
540  int len;
541  int i;
542 
543  len = varname_len > File_HSHORT ? File_HSHORT : varname_len;
544  fstr2cstr(_varname, varname, len);
545 
546  len = desc_len > File_HMID ? File_HMID : desc_len;
547  fstr2cstr(_desc, desc, len);
548 
549  len = units_len > File_HMID ? File_HMID : units_len;
550  fstr2cstr(_units, units, len);
551 
552  _dims = (char**) malloc(sizeof(char*)*(*ndims));
553  len = dims_len > File_HSHORT ? File_HSHORT : dims_len;
554  for ( i=0; i<*ndims; i++ ) {
555  _dims[i] = (char*) malloc(sizeof(char)*(File_HSHORT+1));
556  fstr2cstr(_dims[i], dims+i*dims_len, len);
557  }
558 
559  *error = file_add_variable( vid, *fid, _varname, _desc, _units, _dims, *ndims, *dtype, *tint, *tavg );
560 
561  for ( i=0; i<*ndims; i++ )
562  free( _dims[i] );
563  free( _dims );
564 }
#define File_HMID
Definition: gtool_file.h:13
#define File_HSHORT
Definition: gtool_file.h:12
int32_t file_add_variable(int32_t *vid, int32_t fid, char *varname, char *desc, char *units, char **dims, int32_t ndims, int32_t dtype, real64_t tint, int32_t tavg)

◆ file_write_data_()

void file_write_data_ ( int32_t *  fid,
int32_t *  vid,
void *  var,
real64_t *  t_start,
real64_t *  t_end,
int32_t *  precision,
int32_t *  ndims,
int32_t *  start,
int32_t *  count,
int32_t *  error 
)

Definition at line 566 of file gtool_file_f.c.

576 {
577  int i;
578  MPI_Offset start_[4], count_[4]; /* assume max ndims is 4 */
579 
580  for (i=0; i<*ndims; i++) {
581  start_[i] = start[*ndims - i - 1] - 1;
582  count_[i] = count[*ndims - i - 1];
583  }
584  *error = file_write_data( *fid, *vid, var, *t_start, *t_end, *precision, start_, count_ );
585 }
int32_t file_write_data(int32_t fid, int32_t vid, void *var, real64_t t_start, real64_t t_end, int32_t precision, MPI_Offset *start, MPI_Offset *count)

◆ file_close_()

void file_close_ ( int32_t *  fid,
int32_t *  error 
)

Definition at line 587 of file gtool_file_f.c.

References file_close().

589 {
590  *error = file_close( *fid );
591 }
int32_t file_close(int32_t fid)
Here is the call graph for this function:

◆ file_enddef_()

void file_enddef_ ( int32_t *  fid,
int32_t *  error 
)

Definition at line 593 of file gtool_file_f.c.

References file_enddef().

595 {
596  *error = file_enddef( *fid );
597 }
int32_t file_enddef(int32_t fid)
Here is the call graph for this function:

◆ file_attach_buffer_()

void file_attach_buffer_ ( int32_t *  fid,
int32_t *  buf_amount,
int32_t *  error 
)

Definition at line 599 of file gtool_file_f.c.

References file_attach_buffer().

602 {
603  *error = file_attach_buffer( *fid, *buf_amount );
604 }
int32_t file_attach_buffer(int32_t fid, int32_t buf_amount)
Here is the call graph for this function:

◆ file_detach_buffer_()

void file_detach_buffer_ ( int32_t *  fid,
int32_t *  error 
)

Definition at line 606 of file gtool_file_f.c.

References file_detach_buffer().

608 {
609  *error = file_detach_buffer( *fid );
610 }
int32_t file_detach_buffer(int32_t fid)
Here is the call graph for this function:

◆ file_flush_()

void file_flush_ ( int32_t *  fid,
int32_t *  error 
)

Definition at line 612 of file gtool_file_f.c.

References file_flush().

614 {
615  *error = file_flush( *fid );
616 }
int32_t file_flush(int32_t fid)
Here is the call graph for this function: