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

Go to the source code of this file.

Functions

void file_open_c_ (int32_t *fid, const char *fname, const int32_t *mode, const int32_t *comm, int32_t *error, const int32_t fname_len)
 
void file_get_dim_length_c_ (const int32_t *fid, const char *dimname, int32_t *len, int32_t *error, const int32_t dimname_len)
 
void file_set_option_c_ (const int32_t *fid, const char *filetype, const char *key, const char *val, int32_t *error, const int32_t filetype_len, const int32_t key_len, const int32_t val_len)
 
void file_get_nvars_c_ (const int32_t *fid, int32_t *nvars, int32_t *error)
 
void file_get_varname_c_ (const int32_t *fid, const int32_t *vid, char *varname, int32_t *error, const int32_t varname_len)
 
void file_get_datainfo_c_ (datainfo_t *dinfo, const int32_t *fid, const char *varname, const int32_t *step, const int32_t *suppress, int32_t *error, const int32_t varname_len)
 
void file_get_step_size_c_ (const int32_t *fid, const char *varname, int32_t *len, int32_t *error, const int32_t varname_len)
 
void file_read_data_c_ (void *var, const datainfo_t *dinfo, const int32_t *precision, const int32_t *ntypes, const int32_t *dtype, const int32_t *start, const int32_t *count, int32_t *error)
 
void file_get_attribute_text_c_ (const int32_t *fid, const char *vname, const char *key, const int32_t *suppress, char *value, int32_t *error, const int32_t vname_len, const int32_t key_len, const int32_t value_len)
 
void file_get_attribute_int_c_ (const int32_t *fid, const char *vname, const char *key, const int32_t *len, const int32_t *suppress, int32_t *value, int32_t *error, const int32_t vname_len, const int32_t key_len)
 
void file_get_attribute_float_c_ (const int32_t *fid, const char *vname, const char *key, const int32_t *len, const int32_t *suppress, float *value, int32_t *error, const int32_t vname_len, const int32_t key_len)
 
void file_get_attribute_double_c_ (const int32_t *fid, const char *vname, const char *key, const int32_t *len, const int32_t *suppress, double *value, int32_t *error, const int32_t vname_len, const int32_t key_len)
 
void file_set_attribute_text_c_ (const int32_t *fid, const char *vname, const char *key, const char *value, int32_t *error, const int32_t vname_len, const int32_t key_len, const int32_t value_len)
 
void file_set_attribute_int_c_ (const int32_t *fid, const char *vname, const char *key, const int32_t *value, const int32_t *len, int32_t *error, const int32_t vname_len, const int32_t key_len)
 
void file_set_attribute_float_c_ (const int32_t *fid, const char *vname, const char *key, const float *value, const int32_t *len, int32_t *error, const int32_t vname_len, const int32_t key_len)
 
void file_set_attribute_double_c_ (const int32_t *fid, const char *vname, const char *key, const double *value, const int32_t *len, int32_t *error, const int32_t vname_len, const int32_t key_len)
 
void file_add_associatedvariable_c_ (const int32_t *fid, const char *vname, int32_t *error, const int32_t vname_len)
 
void file_set_tunits_c_ (const int32_t *fid, const char *time_units, const char *calendar, int32_t *error, const int32_t unit_len, const int32_t cal_len)
 
void file_put_axis_c_ (const int32_t *fid, const char *name, const char *desc, const char *units, const char *dim_name, const int32_t *dtype, const void *val, const int32_t *size, const int32_t *precision, int32_t *error, const int32_t name_len, const int32_t desc_len, const int32_t units_len, const int32_t dim_name_len)
 
void file_def_axis_c_ (const int32_t *fid, const char *name, const char *desc, const char *units, const char *dim_name, const int32_t *dtype, const int32_t *dim_size, const int32_t *bounds, int32_t *error, const int32_t name_len, const int32_t desc_len, const int32_t units_len, const int32_t dim_name_len)
 
void file_write_axis_c_ (const int32_t *fid, const char *name, const void *val, const int32_t *precision, const int32_t *start, const int32_t *count, int32_t *error, const int32_t name_len)
 
void file_put_associatedcoordinate_c_ (const int32_t *fid, const char *name, const char *desc, const char *units, const char *dim_names, const int32_t *ndims, const int32_t *dtype, const void *val, const int32_t *precision, int32_t *error, const int32_t name_len, const int32_t desc_len, const int32_t units_len, const int32_t dim_name_len)
 
void file_def_associatedcoordinate_c_ (const int32_t *fid, const char *name, const char *desc, const char *units, const char *dim_names, const int32_t *ndims, const int32_t *dtype, int32_t *error, const int32_t name_len, const int32_t desc_len, const int32_t units_len, const int32_t dim_name_len)
 
void file_write_associatedcoordinate_c_ (const int32_t *fid, const char *name, const void *val, const int32_t *precision, const int32_t *ndims, const int32_t *start, const int32_t *count, int32_t *error, const int32_t name_len)
 
void file_add_variable_c_ (const int32_t *fid, const char *varname, const char *desc, const char *units, const char *standard_name, const char *dims, const int32_t *ndims, const int32_t *dtype, const real64_t *tint, const int32_t *tavg, int32_t *vid, int32_t *error, const int32_t varname_len, const int32_t desc_len, const int32_t units_len, const int32_t stdname_len, const int32_t dims_len)
 
void file_write_data_c_ (const int32_t *fid, const int32_t *vid, const void *var, const real64_t *t_start, const real64_t *t_end, const int32_t *precision, const int32_t *ndims, const int32_t *start, const int32_t *count, int32_t *error)
 
void file_close_c_ (const int32_t *fid, int32_t *error)
 
void file_enddef_c_ (const int32_t *fid, int32_t *error)
 
void file_attach_buffer_c_ (const int32_t *fid, const int64_t *buf_amount, int32_t *error)
 
void file_detach_buffer_c_ (const int32_t *fid, int32_t *error)
 
void file_flush_c_ (const int32_t *fid, int32_t *error)
 

Function Documentation

◆ file_open_c_()

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

Definition at line 36 of file scale_file_f.c.

42 {
43  char _fname[File_HLONG+1];
44  int32_t len;
45 
46  len = fname_len > File_HLONG ? File_HLONG : fname_len;
47  fstr2cstr(_fname, fname, len);
48 
49  *error = file_open_c( fid, _fname, *mode, MPI_Comm_f2c(*comm) );
50 }
int32_t file_open_c(int32_t *fid, const char *fname, const int32_t mode, const MPI_Comm comm)
#define File_HLONG

◆ file_get_dim_length_c_()

void file_get_dim_length_c_ ( const int32_t *  fid,
const char *  dimname,
int32_t *  len,
int32_t *  error,
const int32_t  dimname_len 
)

Definition at line 52 of file scale_file_f.c.

57 {
58  char _dimname[File_HSHORT+1];
59  int32_t clen;
60 
61  clen = dimname_len > File_HSHORT ? File_HSHORT : dimname_len;
62  fstr2cstr(_dimname, dimname, clen);
63 
64  *error = file_get_dim_length_c( *fid, _dimname, len );
65 }
#define File_HSHORT
int32_t file_get_dim_length_c(const int32_t fid, const char *dimname, int32_t *len)

◆ file_set_option_c_()

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

Definition at line 67 of file scale_file_f.c.

75 {
76  char _filetype[File_HSHORT+1];
77  char _key[File_HMID+1];
78  char _val[File_HMID+1];
79  int32_t len;
80 
81  len = filetype_len > File_HSHORT ? File_HSHORT : filetype_len;
82  fstr2cstr(_filetype, filetype, len);
83 
84  len = key_len > File_HMID ? File_HMID : key_len;
85  fstr2cstr(_key, key, len);
86 
87  len = val_len > File_HMID ? File_HMID : val_len;
88  fstr2cstr(_val, val, len);
89 
90  *error = file_set_option_c(*fid, _filetype, _key, _val);
91 }
int32_t file_set_option_c(const int32_t fid, const char *filetype, const char *key, const char *val)
#define File_HSHORT
#define File_HMID

◆ file_get_nvars_c_()

void file_get_nvars_c_ ( const int32_t *  fid,
int32_t *  nvars,
int32_t *  error 
)

Definition at line 93 of file scale_file_f.c.

96 {
97  *error = file_get_nvars_c( *fid, nvars );
98 }
int32_t file_get_nvars_c(const int32_t fid, int32_t *nvars)

◆ file_get_varname_c_()

void file_get_varname_c_ ( const int32_t *  fid,
const int32_t *  vid,
char *  varname,
int32_t *  error,
const int32_t  varname_len 
)

Definition at line 100 of file scale_file_f.c.

105 {
106  char _varname[File_HSHORT+1];
107  int32_t len;
108 
109  *error = file_get_varname_c( *fid, *vid, _varname, varname_len );
110 
111  len = varname_len > File_HSHORT ? File_HSHORT : varname_len;
112  cstr2fstr(varname, _varname, len);
113 }
int32_t file_get_varname_c(const int32_t fid, const int32_t vid, char *name, const int32_t len)
#define File_HSHORT

◆ file_get_datainfo_c_()

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

Definition at line 115 of file scale_file_f.c.

122 {
123  char _varname[File_HSHORT+1];
124  int32_t len;
125  int i;
126 
127  len = varname_len > File_HSHORT ? File_HSHORT : varname_len;
128  fstr2cstr(_varname, varname, len);
129 
130  *error = file_get_datainfo_c( dinfo, *fid, _varname, *step, *suppress );
131 
132  if ( *error != SUCCESS_CODE ) return;
133 
134  cstr2fstr(dinfo->varname, dinfo->varname, File_HSHORT);
135  cstr2fstr(dinfo->description, dinfo->description, File_HMID);
136  cstr2fstr(dinfo->units, dinfo->units, File_HSHORT);
137  cstr2fstr(dinfo->standard_name,dinfo->standard_name,File_HMID);
138  cstr2fstr(dinfo->time_units, dinfo->time_units, File_HMID);
139  cstr2fstr(dinfo->calendar, dinfo->calendar, File_HSHORT);
140  for ( i=0; i<dinfo->rank; i++ )
141  cstr2fstr(dinfo->dim_name+i*File_HSHORT, dinfo->dim_name+i*File_HSHORT, File_HSHORT);
142  for ( i=0; i<dinfo->natts; i++ )
143  cstr2fstr(dinfo->att_name+i*File_HSHORT, dinfo->att_name+i*File_HSHORT, File_HSHORT);
144 }
char att_name[File_HSHORT *ATT_MAX]
Definition: scale_file.h:34
char standard_name[File_HMID]
Definition: scale_file.h:23
#define SUCCESS_CODE
char calendar[File_HSHORT]
Definition: scale_file.h:32
char dim_name[File_HSHORT *RANK_MAX]
Definition: scale_file.h:26
char description[File_HMID]
Definition: scale_file.h:21
int32_t natts
Definition: scale_file.h:33
logical, public i
Definition: scale_file.F90:171
int32_t file_get_datainfo_c(datainfo_t *dinfo, const int32_t fid, const char *varname, const int32_t step, const int32_t suppress)
#define File_HSHORT
#define File_HMID
char time_units[File_HMID]
Definition: scale_file.h:31
char units[File_HSHORT]
Definition: scale_file.h:22
char varname[File_HSHORT]
Definition: scale_file.h:20
int32_t rank
Definition: scale_file.h:25

◆ file_get_step_size_c_()

void file_get_step_size_c_ ( const int32_t *  fid,
const char *  varname,
int32_t *  len,
int32_t *  error,
const int32_t  varname_len 
)

Definition at line 146 of file scale_file_f.c.

151 {
152  char _varname[File_HSHORT+1];
153  int32_t clen;
154 
155  clen = varname_len > File_HSHORT ? File_HSHORT : varname_len;
156  fstr2cstr(_varname, varname, clen);
157 
158  *error = file_get_step_size_c( *fid, _varname, len );
159 }
int32_t file_get_step_size_c(const int32_t fid, const char *varname, int32_t *len)
#define File_HSHORT

◆ file_read_data_c_()

void file_read_data_c_ ( void *  var,
const datainfo_t dinfo,
const int32_t *  precision,
const int32_t *  ntypes,
const int32_t *  dtype,
const int32_t *  start,
const int32_t *  count,
int32_t *  error 
)

Definition at line 161 of file scale_file_f.c.

169 {
170  datainfo_t cdinfo;
171  MPI_Offset ntypes_;
172  MPI_Datatype dtype_;
173  int i;
174 
175  cdinfo.datatype = dinfo->datatype;
176  cdinfo.rank = dinfo->rank;
177  for ( i=0; i<dinfo->rank; i++ ) cdinfo.dim_size[i] = dinfo->dim_size[i];
178  cdinfo.step = dinfo->step;
179  cdinfo.time_start = dinfo->time_start;
180  cdinfo.time_end = dinfo->time_end;
181  cdinfo.fid = dinfo->fid;
182  fstr2cstr(cdinfo.varname, dinfo->varname, File_HSHORT-1);
183  fstr2cstr(cdinfo.description, dinfo->description, File_HMID-1);
184  fstr2cstr(cdinfo.units, dinfo->units, File_HSHORT-1);
185  fstr2cstr(cdinfo.standard_name, dinfo->standard_name, File_HMID-1);
186  fstr2cstr(cdinfo.time_units, dinfo->time_units, File_HMID-1);
187  fstr2cstr(cdinfo.calendar, dinfo->calendar, File_HSHORT-1);
188  for ( i=0; i<RANK_MAX; i++ )
189  fstr2cstr(cdinfo.dim_name+i*File_HSHORT, dinfo->dim_name+i*File_HSHORT, File_HSHORT-1);
190  for ( i=0; i<ATT_MAX; i++ )
191  fstr2cstr(cdinfo.att_name+i*File_HSHORT, dinfo->att_name+i*File_HSHORT, File_HSHORT-1);
192 
193  ntypes_ = (MPI_Offset) (*ntypes);
194 
195  dtype_ = dtype==0 ? MPI_DATATYPE_NULL : MPI_Type_f2c(*dtype);
196 
197  if ( *start == -1 )
198  *error = file_read_data_c( var, &cdinfo, *precision, ntypes_, dtype_, NULL, NULL );
199  else
200  *error = file_read_data_c( var, &cdinfo, *precision, ntypes_, dtype_, start, count );
201 }
char att_name[File_HSHORT *ATT_MAX]
Definition: scale_file.h:34
char standard_name[File_HMID]
Definition: scale_file.h:23
int32_t step
Definition: scale_file.h:28
char calendar[File_HSHORT]
Definition: scale_file.h:32
char dim_name[File_HSHORT *RANK_MAX]
Definition: scale_file.h:26
char description[File_HMID]
Definition: scale_file.h:21
real64_t time_start
Definition: scale_file.h:29
#define RANK_MAX
logical, public i
Definition: scale_file.F90:171
int32_t dim_size[RANK_MAX]
Definition: scale_file.h:27
#define ATT_MAX
#define File_HSHORT
int32_t fid
Definition: scale_file.h:37
int32_t file_read_data_c(void *var, const datainfo_t *dinfo, const int32_t precision, const MPI_Offset ntypes, const MPI_Datatype dtype, const int32_t *start, const int32_t *count)
#define File_HMID
char time_units[File_HMID]
Definition: scale_file.h:31
real64_t time_end
Definition: scale_file.h:30
char units[File_HSHORT]
Definition: scale_file.h:22
char varname[File_HSHORT]
Definition: scale_file.h:20
int32_t datatype
Definition: scale_file.h:24
int32_t rank
Definition: scale_file.h:25

◆ file_get_attribute_text_c_()

void file_get_attribute_text_c_ ( const int32_t *  fid,
const char *  vname,
const char *  key,
const int32_t *  suppress,
char *  value,
int32_t *  error,
const int32_t  vname_len,
const int32_t  key_len,
const int32_t  value_len 
)

Definition at line 203 of file scale_file_f.c.

212 {
213  char _vname[File_HSHORT+1];
214  char _key[File_HMID+1];
215  char _value[File_HLONG+1];
216  int32_t l;
217 
218  l = vname_len > File_HSHORT ? File_HSHORT : vname_len;
219  fstr2cstr(_vname, vname, l);
220 
221  l = key_len > File_HMID ? File_HMID : key_len;
222  fstr2cstr(_key, key, l);
223 
224  *error = file_get_attribute_text_c( *fid, _vname, _key, *suppress, _value, value_len );
225 
226  if ( *error != SUCCESS_CODE ) return;
227 
228  l = value_len > File_HLONG ? File_HLONG : value_len;
229  cstr2fstr(value, _value, l);
230 }
#define SUCCESS_CODE
int32_t file_get_attribute_text_c(const int32_t fid, const char *vname, const char *key, const int32_t suppress, char *value, const int32_t len)
#define File_HLONG
#define File_HSHORT
#define File_HMID

◆ file_get_attribute_int_c_()

void file_get_attribute_int_c_ ( const int32_t *  fid,
const char *  vname,
const char *  key,
const int32_t *  len,
const int32_t *  suppress,
int32_t *  value,
int32_t *  error,
const int32_t  vname_len,
const int32_t  key_len 
)

Definition at line 232 of file scale_file_f.c.

241 {
242  char _vname[File_HSHORT+1];
243  char _key[File_HMID+1];
244  int32_t l;
245 
246  l = vname_len > File_HSHORT ? File_HSHORT : vname_len;
247  fstr2cstr(_vname, vname, l);
248 
249  l = key_len > File_HMID ? File_HMID : key_len;
250  fstr2cstr(_key, key, l);
251 
252  *error = file_get_attribute_int_c( *fid, _vname, _key, *suppress, value, (size_t)*len );
253 }
int32_t file_get_attribute_int_c(const int32_t fid, const char *vname, const char *key, const int32_t suppress, int32_t *value, const size_t len)
#define File_HSHORT
#define File_HMID

◆ file_get_attribute_float_c_()

void file_get_attribute_float_c_ ( const int32_t *  fid,
const char *  vname,
const char *  key,
const int32_t *  len,
const int32_t *  suppress,
float value,
int32_t *  error,
const int32_t  vname_len,
const int32_t  key_len 
)

Definition at line 255 of file scale_file_f.c.

264 {
265  char _vname[File_HSHORT+1];
266  char _key[File_HMID+1];
267  int32_t l;
268 
269  l = vname_len > File_HSHORT ? File_HSHORT : vname_len;
270  fstr2cstr(_vname, vname, l);
271 
272  l = key_len > File_HMID ? File_HMID : key_len;
273  fstr2cstr(_key, key, l);
274 
275  *error = file_get_attribute_float_c( *fid, _vname, _key, *suppress, value, (size_t)*len );
276 }
#define File_HSHORT
#define File_HMID
int32_t file_get_attribute_float_c(const int32_t fid, const char *vname, const char *key, const int32_t suppress, float *value, const size_t len)

◆ file_get_attribute_double_c_()

void file_get_attribute_double_c_ ( const int32_t *  fid,
const char *  vname,
const char *  key,
const int32_t *  len,
const int32_t *  suppress,
double value,
int32_t *  error,
const int32_t  vname_len,
const int32_t  key_len 
)

Definition at line 278 of file scale_file_f.c.

287 {
288  char _vname[File_HSHORT+1];
289  char _key[File_HMID+1];
290  int32_t l;
291 
292  l = vname_len > File_HSHORT ? File_HSHORT : vname_len;
293  fstr2cstr(_vname, vname, l);
294 
295  l = key_len > File_HMID ? File_HMID : key_len;
296  fstr2cstr(_key, key, l);
297 
298  *error = file_get_attribute_double_c( *fid, _vname, _key, *suppress, value, (size_t)*len );
299 }
int32_t file_get_attribute_double_c(const int32_t fid, const char *vname, const char *key, const int32_t suppress, double *value, const size_t len)
#define File_HSHORT
#define File_HMID

◆ file_set_attribute_text_c_()

void file_set_attribute_text_c_ ( const int32_t *  fid,
const char *  vname,
const char *  key,
const char *  value,
int32_t *  error,
const int32_t  vname_len,
const int32_t  key_len,
const int32_t  value_len 
)

Definition at line 301 of file scale_file_f.c.

309 {
310  char _vname[File_HSHORT+1];
311  char _key[File_HMID+1];
312  char _value[File_HLONG+1];
313  int32_t l;
314 
315  l = vname_len > File_HSHORT ? File_HSHORT : vname_len;
316  fstr2cstr(_vname, vname, l);
317 
318  l = key_len > File_HMID ? File_HMID : key_len;
319  fstr2cstr(_key, key, l);
320 
321  l = value_len > File_HLONG ? File_HLONG : value_len;
322  fstr2cstr(_value, value, l);
323 
324  *error = file_set_attribute_text_c( *fid, _vname, _key, _value );
325 }
#define File_HLONG
#define File_HSHORT
int32_t file_set_attribute_text_c(const int32_t fid, const char *vname, const char *key, const char *value)
#define File_HMID

◆ file_set_attribute_int_c_()

void file_set_attribute_int_c_ ( const int32_t *  fid,
const char *  vname,
const char *  key,
const int32_t *  value,
const int32_t *  len,
int32_t *  error,
const int32_t  vname_len,
const int32_t  key_len 
)

Definition at line 327 of file scale_file_f.c.

335 {
336  char _vname[File_HSHORT+1];
337  char _key[File_HMID+1];
338  int32_t l;
339 
340  l = vname_len > File_HSHORT ? File_HSHORT : vname_len;
341  fstr2cstr(_vname, vname, l);
342 
343  l = key_len > File_HMID ? File_HMID : key_len;
344  fstr2cstr(_key, key, l);
345 
346  *error = file_set_attribute_int_c( *fid, _vname, _key, value, (size_t)*len );
347 }
int32_t file_set_attribute_int_c(const int32_t fid, const char *vname, const char *key, const int32_t *value, const size_t len)
#define File_HSHORT
#define File_HMID

◆ file_set_attribute_float_c_()

void file_set_attribute_float_c_ ( const int32_t *  fid,
const char *  vname,
const char *  key,
const float value,
const int32_t *  len,
int32_t *  error,
const int32_t  vname_len,
const int32_t  key_len 
)

Definition at line 349 of file scale_file_f.c.

357 {
358  char _vname[File_HSHORT+1];
359  char _key[File_HMID+1];
360  int32_t l;
361 
362  l = vname_len > File_HSHORT ? File_HSHORT : vname_len;
363  fstr2cstr(_vname, vname, l);
364 
365  l = key_len > File_HMID ? File_HMID : key_len;
366  fstr2cstr(_key, key, l);
367 
368  *error = file_set_attribute_float_c( *fid, _vname, _key, value, (size_t)*len );
369 }
#define File_HSHORT
#define File_HMID
int32_t file_set_attribute_float_c(const int32_t fid, const char *vname, const char *key, const float *value, const size_t len)

◆ file_set_attribute_double_c_()

void file_set_attribute_double_c_ ( const int32_t *  fid,
const char *  vname,
const char *  key,
const double value,
const int32_t *  len,
int32_t *  error,
const int32_t  vname_len,
const int32_t  key_len 
)

Definition at line 371 of file scale_file_f.c.

379 {
380  char _vname[File_HSHORT+1];
381  char _key[File_HMID+1];
382  int32_t l;
383 
384  l = vname_len > File_HSHORT ? File_HSHORT : vname_len;
385  fstr2cstr(_vname, vname, l);
386 
387  l = key_len > File_HMID ? File_HMID : key_len;
388  fstr2cstr(_key, key, l);
389 
390  *error = file_set_attribute_double_c( *fid, _vname, _key, value, (size_t)*len );
391 }
int32_t file_set_attribute_double_c(const int32_t fid, const char *vname, const char *key, const double *value, const size_t len)
#define File_HSHORT
#define File_HMID

◆ file_add_associatedvariable_c_()

void file_add_associatedvariable_c_ ( const int32_t *  fid,
const char *  vname,
int32_t *  error,
const int32_t  vname_len 
)

Definition at line 393 of file scale_file_f.c.

397 {
398  char _vname[File_HSHORT+1];
399  int32_t l;
400 
401  l = vname_len > File_HSHORT ? File_HSHORT : vname_len;
402  fstr2cstr(_vname, vname, l);
403 
404  *error = file_add_associatedvariable_c( *fid, _vname );
405 }
#define File_HSHORT
int32_t file_add_associatedvariable_c(const int32_t fid, const char *vname)

◆ file_set_tunits_c_()

void file_set_tunits_c_ ( const int32_t *  fid,
const char *  time_units,
const char *  calendar,
int32_t *  error,
const int32_t  unit_len,
const int32_t  cal_len 
)

Definition at line 407 of file scale_file_f.c.

413 {
414  char _time_units[File_HMID+1];
415  char _calendar[File_HSHORT+1];
416  int32_t l;
417 
418  l = unit_len > File_HMID ? File_HMID : unit_len;
419  fstr2cstr(_time_units, time_units, l);
420 
421  l = cal_len > File_HSHORT ? File_HSHORT : cal_len;
422  fstr2cstr(_calendar, calendar, l);
423 
424  *error = file_set_tunits_c( *fid, _time_units, _calendar );
425 }
int32_t file_set_tunits_c(const int32_t fid, const char *time_units, const char *calendar)
#define File_HSHORT
#define File_HMID

◆ file_put_axis_c_()

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

Definition at line 427 of file scale_file_f.c.

441 {
442  char _name[File_HSHORT+1];
443  char _desc[File_HMID+1];
444  char _units[File_HMID+1];
445  char _dim_name[File_HSHORT+1];
446  int len;
447 
448  len = name_len > File_HSHORT ? File_HSHORT : name_len;
449  fstr2cstr(_name, name, len);
450 
451  len = desc_len > File_HMID ? File_HMID : desc_len;
452  fstr2cstr(_desc, desc, len);
453 
454  len = units_len > File_HMID ? File_HMID : units_len;
455  fstr2cstr(_units, units, len);
456 
457  len = dim_name_len > File_HSHORT ? File_HSHORT : dim_name_len;
458  fstr2cstr(_dim_name, dim_name, len);
459 
460  *error = file_put_axis_c( *fid, _name, _desc, _units, _dim_name, *dtype, val, *size, *precision );
461 }
int32_t file_put_axis_c(const int32_t fid, const char *name, const char *desc, const char *units, const char *dim_name, const int32_t dtype, const void *val, const int32_t size, const int32_t precision)
#define File_HSHORT
#define File_HMID

◆ file_def_axis_c_()

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

Definition at line 463 of file scale_file_f.c.

476 {
477  char _name[File_HSHORT+1];
478  char _desc[File_HMID+1];
479  char _units[File_HMID+1];
480  char _dim_name[File_HSHORT+1];
481  int len;
482 
483  len = name_len > File_HSHORT ? File_HSHORT : name_len;
484  fstr2cstr(_name, name, len);
485 
486  len = desc_len > File_HMID ? File_HMID : desc_len;
487  fstr2cstr(_desc, desc, len);
488 
489  len = units_len > File_HMID ? File_HMID : units_len;
490  fstr2cstr(_units, units, len);
491 
492  len = dim_name_len > File_HSHORT ? File_HSHORT : dim_name_len;
493  fstr2cstr(_dim_name, dim_name, len);
494 
495  *error = file_def_axis_c( *fid, _name, _desc, _units, _dim_name, *dtype, *dim_size, *bounds );
496 }
#define File_HSHORT
#define File_HMID
int32_t file_def_axis_c(const int32_t fid, const char *name, const char *desc, const char *units, const char *dim_name, const int32_t dtype, const int32_t dim_size, const int32_t bounds)

◆ file_write_axis_c_()

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

Definition at line 498 of file scale_file_f.c.

506 {
507  char _name[File_HSHORT+1];
508  int len;
509  MPI_Offset start_[1], count_[1];
510 
511  len = name_len > File_HSHORT ? File_HSHORT : name_len;
512  fstr2cstr(_name, name, len);
513 
514  /* all axes are 1D */
515  start_[0] = *start - 1; /* C index is 0-based */
516  count_[0] = *count;
517 
518  *error = file_write_axis_c( *fid, _name, val, *precision, start_, count_ );
519 }
int32_t file_write_axis_c(const int32_t fid, const char *name, const void *val, const int32_t precision, const MPI_Offset *start, const MPI_Offset *count)
#define File_HSHORT

◆ file_put_associatedcoordinate_c_()

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

Definition at line 521 of file scale_file_f.c.

535 {
536  char _name[File_HSHORT+1];
537  char _desc[File_HMID+1];
538  char _units[File_HMID+1];
539  char **_dim_names;
540  int len;
541  int i;
542 
543  len = name_len > File_HSHORT ? File_HSHORT : name_len;
544  fstr2cstr(_name, name, 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  _dim_names = (char**) malloc(sizeof(char*)*(*ndims));
553  len = dim_name_len > File_HSHORT ? File_HSHORT : dim_name_len;
554  for ( i=0; i<*ndims; i++ ) {
555  _dim_names[i] = (char*) malloc(sizeof(char)*(File_HSHORT+1));
556  fstr2cstr(_dim_names[i], dim_names+i*dim_name_len, len);
557  }
558 
559  *error = file_put_associatedcoordinate_c( *fid, _name, _desc, _units, (const char**)_dim_names, *ndims, *dtype, val, *precision );
560 
561  for ( i=0; i<*ndims; i++ ) free(_dim_names[i]);
562  free(_dim_names);
563 }
int32_t file_put_associatedcoordinate_c(const int32_t fid, const char *name, const char *desc, const char *units, const char **dim_names, const int32_t ndims, const int32_t dtype, const void *val, const int32_t precision)
logical, public i
Definition: scale_file.F90:171
#define File_HSHORT
#define File_HMID

◆ file_def_associatedcoordinate_c_()

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

Definition at line 565 of file scale_file_f.c.

577 {
578  char _name[File_HSHORT+1];
579  char _desc[File_HMID+1];
580  char _units[File_HMID+1];
581  char **_dim_names;
582  int len;
583  int i;
584 
585  len = name_len > File_HSHORT ? File_HSHORT : name_len;
586  fstr2cstr(_name, name, len);
587 
588  len = desc_len > File_HMID ? File_HMID : desc_len;
589  fstr2cstr(_desc, desc, len);
590 
591  len = units_len > File_HMID ? File_HMID : units_len;
592  fstr2cstr(_units, units, len);
593 
594  _dim_names = (char**) malloc(sizeof(char*)*(*ndims));
595  len = dim_name_len > File_HSHORT ? File_HSHORT : dim_name_len;
596  for ( i=0; i<*ndims; i++ ) {
597  _dim_names[i] = (char*) malloc(sizeof(char)*(File_HSHORT+1));
598  fstr2cstr(_dim_names[i], dim_names+i*dim_name_len, len);
599  }
600 
601  *error = file_def_associatedcoordinate_c( *fid, _name, _desc, _units, (const char**)_dim_names, *ndims, *dtype );
602 
603  for ( i=0; i<*ndims; i++ ) free(_dim_names[i]);
604  free(_dim_names);
605 }
logical, public i
Definition: scale_file.F90:171
#define File_HSHORT
int32_t file_def_associatedcoordinate_c(const int32_t fid, const char *name, const char *desc, const char *units, const char **dim_names, const int32_t ndims, const int32_t dtype)
#define File_HMID

◆ file_write_associatedcoordinate_c_()

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

Definition at line 607 of file scale_file_f.c.

616 {
617  char _name[File_HSHORT+1];
618  int i, len;
619  MPI_Offset start_[4], count_[4];
620  /* all associated coordinate are up to 4D */
621 
622  len = name_len > File_HSHORT ? File_HSHORT : name_len;
623  fstr2cstr(_name, name, len);
624 
625  for (i=0; i<*ndims; i++) {
626  start_[i] = start[*ndims - i - 1] - 1;
627  count_[i] = count[*ndims - i - 1];
628  }
629  *error = file_write_associatedcoordinate_c( *fid, _name, val, *precision, start_, count_ );
630 }
int32_t file_write_associatedcoordinate_c(const int32_t fid, const char *name, const void *val, const int32_t precision, const MPI_Offset *start, const MPI_Offset *count)
logical, public i
Definition: scale_file.F90:171
#define File_HSHORT

◆ file_add_variable_c_()

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

Definition at line 632 of file scale_file_f.c.

649 {
650  char _varname[File_HSHORT+1];
651  char _desc[File_HMID+1];
652  char _stdname[File_HMID+1];
653  char _units[File_HMID+1];
654  char **_dims;
655  int len;
656  int i;
657 
658  len = varname_len > File_HSHORT ? File_HSHORT : varname_len;
659  fstr2cstr(_varname, varname, len);
660 
661  len = desc_len > File_HMID ? File_HMID : desc_len;
662  fstr2cstr(_desc, desc, len);
663 
664  len = stdname_len > File_HMID ? File_HMID : stdname_len;
665  fstr2cstr(_stdname, standard_name, len);
666 
667  len = units_len > File_HMID ? File_HMID : units_len;
668  fstr2cstr(_units, units, len);
669 
670  _dims = (char**) malloc(sizeof(char*)*(*ndims));
671  len = dims_len > File_HSHORT ? File_HSHORT : dims_len;
672  for ( i=0; i<*ndims; i++ ) {
673  _dims[i] = (char*) malloc(sizeof(char)*(File_HSHORT+1));
674  fstr2cstr(_dims[i], dims+i*dims_len, len);
675  }
676 
677  *error = file_add_variable_c( *fid, _varname, _desc, _units, _stdname, (const char**)_dims, *ndims, *dtype, *tint, *tavg, vid );
678 
679  for ( i=0; i<*ndims; i++ ) free( _dims[i] );
680  free( _dims );
681 }
logical, public i
Definition: scale_file.F90:171
int32_t file_add_variable_c(const int32_t fid, const char *varname, const char *desc, const char *units, const char *stdname, const char **dims, const int32_t ndims, const int32_t dtype, const real64_t tint, const int32_t tavg, int32_t *vid)
#define File_HSHORT
#define File_HMID

◆ file_write_data_c_()

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

Definition at line 683 of file scale_file_f.c.

693 {
694  *error = file_write_data_c( *fid, *vid, var, *t_start, *t_end, *precision, *ndims, start, count );
695 }
int32_t file_write_data_c(const int32_t fid, const int32_t vid, const void *var, const real64_t t_start, const real64_t t_end, const int32_t precision, const int32_t ndims, const int32_t *start, const int32_t *count)

◆ file_close_c_()

void file_close_c_ ( const int32_t *  fid,
int32_t *  error 
)

Definition at line 697 of file scale_file_f.c.

699 {
700  *error = file_close_c( *fid );
701 }
int32_t file_close_c(const int32_t fid)

◆ file_enddef_c_()

void file_enddef_c_ ( const int32_t *  fid,
int32_t *  error 
)

Definition at line 703 of file scale_file_f.c.

705 {
706  *error = file_enddef_c( *fid );
707 }
int32_t file_enddef_c(const int32_t fid)

◆ file_attach_buffer_c_()

void file_attach_buffer_c_ ( const int32_t *  fid,
const int64_t *  buf_amount,
int32_t *  error 
)

Definition at line 709 of file scale_file_f.c.

712 {
713  *error = file_attach_buffer_c( *fid, *buf_amount );
714 }
int32_t file_attach_buffer_c(const int32_t fid, const int64_t buf_amount)

◆ file_detach_buffer_c_()

void file_detach_buffer_c_ ( const int32_t *  fid,
int32_t *  error 
)

Definition at line 716 of file scale_file_f.c.

718 {
719  *error = file_detach_buffer_c( *fid );
720 }
int32_t file_detach_buffer_c(const int32_t fid)

◆ file_flush_c_()

void file_flush_c_ ( const int32_t *  fid,
int32_t *  error 
)

Definition at line 722 of file scale_file_f.c.

724 {
725  *error = file_flush_c( *fid );
726 }
int32_t file_flush_c(const int32_t fid)