SDDS ToolKit Programs and Libraries for C and Python
All Classes Files Functions Variables Macros Pages
sdds2dinterpolate.c File Reference

Detailed Description

Interpolates scalar 2D data at specified points using various algorithms like Natural Neighbours or Cubic Spline Approximation.

This program reads 2D scalar data from an SDDS file, interpolates at specified output points, and writes the interpolated data to an output SDDS file. It supports multiple interpolation algorithms and various options to control the interpolation process, scaling, output grid, and more.

Usage

sdds2dinterpolate <input> <output>
[-pipe=[input][,output]]
[-independentColumn=xcolumn=<string>,ycolumn=<string>[,errorColumn=<string>]]
[-dependentColumn=<list of z column names separated by commas>]
[-scale=circle|square]
[-outDimension=xdimension=<nx>,ydimension=<ny>]
[-range=xminimum=<value>,xmaximum=<value>,yminimum=<value>,ymaximum=<value>]
[-zoom=<value>]
[-dimensionThin=xdimension=<nx>,ydimension=<ny>]
[-clusterThin=<value>]
[-preprocess]
[-algorithm=linear|sibson|nonsibson[,average=<value>][,sensitivity=<value>]]
[-weight=<value>]
[-vertex=<id>]
[-npoints=<integer>]
[-verbose]
[-merge]
[-file=<output points file>[,<xName>,<yName>]]
[-majorOrder=row|column]

Options

Optional Description
-pipe Specifies input/output pipes for data streaming.
-independentColumn Specifies x and y independent columns with an optional error column.
-dependentColumn Specifies dependent z columns for interpolation.
-scale Selects scaling mode (circle or square).
-outDimension Sets dimensions of the output grid.
-range Sets range for x and y values in the output grid.
-zoom Scales the output grid by a zoom factor.
-dimensionThin Reduces input data using average within specified dimensions.
-clusterThin Reduces input data by clustering points within a maximum distance.
-preprocess Outputs preprocessed data without interpolation.
-algorithm Selects interpolation algorithm with optional parameters.
-weight Sets minimum interpolation weight.
-vertex Outputs detailed information for a specified vertex.
-npoints Specifies the number of output points.
-verbose Enables verbose logging for debugging.
-merge Merges all input pages before processing.
-file Specifies an output file for grid points with optional column names.
-majorOrder Sets the major order for output data (row or column).

Incompatibilities

  • -preprocess is incompatible with:
    • -algorithm
    • -merge
  • Only one of the following options can be specified:
    • -zoom
    • -range
  • -algorithm=sibson requires:
    • -weight
    • -npoints
License
This file is distributed under the terms of the Software License Agreement found in the file LICENSE included with this distribution.
Authors
Hairong Shang, R. Soliday, L. Emery, M. Borland

Definition in file sdds2dinterpolate.c.

#include "SDDS.h"
#include "mdb.h"
#include "scan.h"
#include "nn_2d_interpolate.h"
#include "csa.h"

Go to the source code of this file.

Functions

void ReadInputFile (char *inputFile, char *xCol, char *yCol, char **zColMatch, long zColMatches, char ***zCol, int32_t *zCols, char *stdCol, long *pages, long **rows, double ***x, double ***y, double ****z, double ***std, SDDS_DATASET *SDDS_in)
 
void SetupOutputFile (SDDS_DATASET *SDDS_out, SDDS_DATASET *SDDS_in, char *outputFile, char *xCol, char *yCol, char *xName, char *yName, char **zCol, long zCols, short columnMajorOrder)
 
void WriteOutputPage (SDDS_DATASET *SDDS_out, char *xCol, char *yCol, char *zCol, specs *spec, int nout, point *pout, long writepage)
 
void ReadPointFile (char *pointsFile, char *xCol, char *yCol, long *point_pages, OUT_POINT **out_point)
 
int interpolate_output_points (int nin, point **pin, double *std, char *xCol, char *yCol, char *xName, char *yName, char **zCol, long zCols, specs *spec, long pages, OUT_POINT *out_point, SDDS_DATASET *SDDS_out)
 
int main (int argc, char *argv[])
 

Function Documentation

◆ interpolate_output_points()

int interpolate_output_points ( int nin,
point ** pin,
double * std,
char * xCol,
char * yCol,
char * xName,
char * yName,
char ** zCol,
long zCols,
specs * spec,
long pages,
OUT_POINT * out_point,
SDDS_DATASET * SDDS_out )

Definition at line 886 of file sdds2dinterpolate.c.

887 {
888 int nout, page, k, writepage = 0, i;
889 point *pout = NULL;
890
891 for (page = 0; page < pages; page++) {
892 nout = out_point[page].nout;
893 pout = out_point[page].pout;
894 spec->nx = out_point[page].nx;
895 spec->ny = out_point[page].ny;
896 spec->xmin = out_point[page].xmin;
897 spec->xmax = out_point[page].xmax;
898 spec->dx = out_point[page].dx;
899 spec->ymin = out_point[page].ymin;
900 spec->ymax = out_point[page].ymax;
901 spec->dy = out_point[page].dy;
902 for (k = 0; k < zCols; k++) {
903 if (spec->method == NN) {
904 do_nn_2d_interpolate(spec, &nin, &pin[k], &nout, &pout);
905 } else {
906 do_csa_2d_interpolate(spec, nin, pin[k], &nout, &pout, std);
907 }
908 if (!spec->nointerp) {
909 if (!writepage) {
910 WriteOutputPage(SDDS_out, xName ? xName : xCol, yName ? yName : yCol, zCol[k], spec, nout, pout, 0);
911 writepage = 1;
912 } else {
913 for (i = 0; i < nout; i++) {
914 if (!SDDS_SetRowValues(SDDS_out, SDDS_SET_BY_NAME | SDDS_PASS_BY_VALUE, i,
915 zCol[k], pout[i].z, NULL))
916 SDDS_PrintErrors(stderr, SDDS_VERBOSE_PrintErrors | SDDS_EXIT_PrintErrors);
917 }
918 }
919 }
920 }
921 }
922 if (writepage && !SDDS_WritePage(SDDS_out))
923 SDDS_PrintErrors(stderr, SDDS_VERBOSE_PrintErrors | SDDS_EXIT_PrintErrors);
924 return 1;
925}
int32_t SDDS_SetRowValues(SDDS_DATASET *SDDS_dataset, int32_t mode, int64_t row,...)
int32_t SDDS_WritePage(SDDS_DATASET *SDDS_dataset)
Writes the current data table to the output file.
void SDDS_PrintErrors(FILE *fp, int32_t mode)
Prints recorded error messages to a specified file stream.
Definition SDDS_utils.c:432

◆ main()

int main ( int argc,
char * argv[] )

Definition at line 182 of file sdds2dinterpolate.c.

182 {
183 SDDS_DATASET SDDS_out, SDDS_in;
184 char *inputFile, *outputFile, *xCol = "x", *yCol = "y", **zCol = NULL, *stdCol = "StdError", *pointsFile = NULL, **zColMatch = NULL;
185 char *pointsFileXName = NULL, *pointsFileYName = NULL;
186 long i, j, i_arg, k, scale, *rows, pages, merge = 0, point_pages = 0, writepage = 0, zColMatches = 0;
187 int32_t zCols = 1;
188 unsigned long dummyFlags = 0, pipeFlags = 0, majorOrderFlag;
189 SCANNED_ARG *s_arg;
190 double **x = NULL, **y = NULL, ***z = NULL, xmin = 0, xmax = 0, ymin = 0, ymax = 0, **std = NULL, *std_all = NULL;
191 specs *spec = specs_create();
192 int nin = 0;
193 point **pin = NULL;
194 int nout = 0;
195 point *pout = NULL;
196 OUT_POINT *out_point = NULL;
197 short columnMajorOrder = -1;
198
199 /* Turn off the extrapolation by default */
200 spec->wmin = 0;
201 inputFile = outputFile = NULL;
203 argc = scanargs(&s_arg, argc, argv);
204 if (argc < 2) {
205 fprintf(stderr, "%s", USAGE);
206 return EXIT_FAILURE;
207 }
208
209 for (i_arg = 1; i_arg < argc; i_arg++) {
210 if (s_arg[i_arg].arg_type == OPTION) {
211 delete_chars(s_arg[i_arg].list[0], "_");
212 switch (match_string(s_arg[i_arg].list[0], option, N_OPTIONS, 0)) {
213 case CLO_MAJOR_ORDER:
214 majorOrderFlag = 0;
215 s_arg[i_arg].n_items -= 1;
216 if (s_arg[i_arg].n_items > 0 &&
217 (!scanItemList(&majorOrderFlag, s_arg[i_arg].list + 1, &s_arg[i_arg].n_items, 0,
218 "row", -1, NULL, 0, SDDS_ROW_MAJOR_ORDER,
219 "column", -1, NULL, 0, SDDS_COLUMN_MAJOR_ORDER, NULL))) {
220 SDDS_Bomb("Invalid -majorOrder syntax/values");
221 }
222 if (majorOrderFlag & SDDS_COLUMN_MAJOR_ORDER)
223 columnMajorOrder = 1;
224 else if (majorOrderFlag & SDDS_ROW_MAJOR_ORDER)
225 columnMajorOrder = 0;
226 break;
227 case CLO_FILE:
228 if (s_arg[i_arg].n_items != 2 && s_arg[i_arg].n_items != 4)
229 SDDS_Bomb("Invalid -file syntax.");
230 pointsFile = s_arg[i_arg].list[1];
231 if (s_arg[i_arg].n_items == 4) {
232 pointsFileXName = s_arg[i_arg].list[2];
233 pointsFileYName = s_arg[i_arg].list[3];
234 }
235 break;
236 case CLO_PIPE:
237 if (!processPipeOption(s_arg[i_arg].list + 1, s_arg[i_arg].n_items - 1, &pipeFlags))
238 SDDS_Bomb("Invalid -pipe syntax");
239 break;
240 case CLO_INDEPENDENT_COLUMN:
241 if (s_arg[i_arg].n_items < 3)
242 SDDS_Bomb("Invalid -independentColumn syntax.");
243 s_arg[i_arg].n_items--;
244 if (!scanItemList(&dummyFlags, s_arg[i_arg].list + 1, &s_arg[i_arg].n_items, 0,
245 "xcolumn", SDDS_STRING, &xCol, 1, 0,
246 "ycolumn", SDDS_STRING, &yCol, 1, 0,
247 "errorcolumn", SDDS_STRING, &stdCol, 1, 0, NULL))
248 SDDS_Bomb("Invalid -independentColumn syntax");
249 s_arg[i_arg].n_items++;
250 break;
251 case CLO_DEPENDENT_COLUMN:
252 if (s_arg[i_arg].n_items < 2)
253 SDDS_Bomb("Invalid -dependentColumn syntax.");
254 zColMatches = s_arg[i_arg].n_items - 1;
255 zColMatch = tmalloc(sizeof(*zColMatch) * zColMatches);
256 for (i = 0; i < zColMatches; i++)
257 zColMatch[i] = s_arg[i_arg].list[i + 1];
258 break;
259 case CLO_SCALE:
260 if (s_arg[i_arg].n_items != 2)
261 SDDS_Bomb("Invalid -scale syntax.");
262 if ((scale = match_string(s_arg[i_arg].list[1], scale_option, SCALE_OPTIONS, 0)) == -1) {
263 fprintf(stderr, "Invalid scale option - %s provided.\n", s_arg[i_arg].list[1]);
264 exit(EXIT_FAILURE);
265 }
266 spec->square = !scale;
267 spec->invariant = scale;
268 break;
269 case CLO_OUT_DIMENSION:
270 if (s_arg[i_arg].n_items != 3)
271 SDDS_Bomb("Invalid -outDimension syntax.");
272 s_arg[i_arg].n_items--;
273 if (!scanItemList(&dummyFlags, s_arg[i_arg].list + 1, &s_arg[i_arg].n_items, 0,
274 "xdimension", SDDS_LONG, &spec->nx, 1, 0,
275 "ydimension", SDDS_LONG, &spec->ny, 1, 0, NULL))
276 SDDS_Bomb("Invalid -outDimension syntax");
277 s_arg[i_arg].n_items++;
278 if (spec->nx <= 0 || spec->nx > NMAX || spec->ny <= 0 || spec->ny > NMAX)
279 SDDS_Bomb("Invalid size for output grid.");
280 spec->generate_points = 1;
281 break;
282 case CLO_RANGE:
283 if (s_arg[i_arg].n_items < 2)
284 SDDS_Bomb("Invalid -range syntax.");
285 s_arg[i_arg].n_items--;
286 if (!scanItemList(&dummyFlags, s_arg[i_arg].list + 1, &s_arg[i_arg].n_items, 0,
287 "xminimum", SDDS_DOUBLE, &spec->xmin, 1, 0,
288 "xmaximum", SDDS_DOUBLE, &spec->xmax, 1, 0,
289 "yminimum", SDDS_DOUBLE, &spec->ymin, 1, 0,
290 "ymaximum", SDDS_DOUBLE, &spec->ymax, 1, 0, NULL))
291 SDDS_Bomb("Invalid -range syntax");
292 s_arg[i_arg].n_items++;
293 if (spec->xmin > spec->xmax || spec->ymin > spec->ymax ||
294 isnan(spec->xmin) || isnan(spec->xmax) || isnan(spec->ymin) || isnan(spec->ymax))
295 SDDS_Bomb("Invalid -range provided.");
296 spec->range = 1;
297 break;
298 case CLO_ZOOM:
299 if (s_arg[i_arg].n_items != 2)
300 SDDS_Bomb("Invalid -zoom syntax.");
301 if (!get_double(&spec->zoom, s_arg[i_arg].list[1]))
302 SDDS_Bomb("Invalid -zoom value provided.");
303 break;
304 case CLO_DIMENSION_THIN:
305 if (s_arg[i_arg].n_items != 3)
306 SDDS_Bomb("Invalid -dimensionThin syntax.");
307 s_arg[i_arg].n_items--;
308 if (!scanItemList(&dummyFlags, s_arg[i_arg].list + 1, &s_arg[i_arg].n_items, 0,
309 "xdimension", SDDS_LONG, &spec->nxd, 1, 0,
310 "ydimension", SDDS_LONG, &spec->nyd, 1, 0, NULL))
311 SDDS_Bomb("Invalid -dimensionThin syntax");
312 s_arg[i_arg].n_items++;
313 spec->thin = 1;
314 break;
315 case CLO_CLUSTER_THIN:
316 if (s_arg[i_arg].n_items != 2)
317 SDDS_Bomb("Invalid -clusterThin syntax.");
318 if (!get_double(&spec->rmax, s_arg[i_arg].list[1]))
319 SDDS_Bomb("Invalid -clusterThin value provided.");
320 spec->thin = 2;
321 break;
322 case CLO_PREPROCESS:
323 spec->nointerp = 1;
324 break;
325 case CLO_ALGORITHM:
326 if (s_arg[i_arg].n_items < 2)
327 SDDS_Bomb("Invalid -algorithm syntax!");
328 if ((spec->method = match_string(s_arg[i_arg].list[1], algorithm_option, ALGORITHMS, 0)) == -1) {
329 fprintf(stderr, "Invalid algorithm - %s provided, has to be nn or csa.\n", s_arg[i_arg].list[1]);
330 exit(EXIT_FAILURE);
331 }
332 dummyFlags = 0;
333 s_arg[i_arg].n_items -= 2;
334 if (!scanItemList(&dummyFlags, s_arg[i_arg].list + 2, &s_arg[i_arg].n_items, 0,
335 "linear", -1, NULL, 0, LINEAR_NN,
336 "sibson", -1, NULL, 0, SIBSON_NN,
337 "nonSibson", -1, NULL, 0, NONSIBSON_NN,
338 "average", SDDS_LONG, &spec->nppc, 1, 0,
339 "sensitivity", SDDS_DOUBLE, &spec->k, 1, 0, NULL))
340 SDDS_Bomb("Invalid -algorithm syntax!");
341 spec->linear = 0;
342 if (!dummyFlags || dummyFlags & LINEAR_NN) {
343 spec->linear = 1;
344 } else if (dummyFlags & SIBSON_NN) {
345 nn_rule = SIBSON;
346 } else if (dummyFlags & NONSIBSON_NN) {
347 nn_rule = NON_SIBSONIAN;
348 }
349 s_arg[i_arg].n_items += 2;
350 break;
351 case CLO_WEIGHT:
352 if (s_arg[i_arg].n_items != 2)
353 SDDS_Bomb("Invalid -weight syntax.");
354 if (match_string(s_arg[i_arg].list[1], INFINITY_OPTION, 1, 0) == 0)
355 spec->wmin = -DBL_MAX;
356 else {
357 if (!get_double(&spec->wmin, s_arg[i_arg].list[1]))
358 SDDS_Bomb("Invalid weight value provided.");
359 }
360 break;
361 case CLO_VERTEX:
362 if (s_arg[i_arg].n_items != 2)
363 SDDS_Bomb("Invalid -vertex syntax.");
364 if (!get_int(&nn_test_vertice, s_arg[i_arg].list[1]))
365 SDDS_Bomb("Invalid vertex value provided.");
366 nn_verbose = 1;
367 break;
368 case CLO_NPOINTS:
369 if (s_arg[i_arg].n_items != 2)
370 SDDS_Bomb("Invalid -npoints syntax.");
371 if (!get_int(&spec->npoints, s_arg[i_arg].list[1]))
372 SDDS_Bomb("Invalid npoints value provided.");
373 break;
374 case CLO_VERBOSE:
375 nn_verbose = 2;
376 break;
377 case CLO_MERGE:
378 merge = 1;
379 break;
380 default:
381 fprintf(stderr, "Unknown option - %s provided.\n", s_arg[i_arg].list[0]);
382 exit(EXIT_FAILURE);
383 break;
384 }
385 } else {
386 if (!inputFile)
387 inputFile = s_arg[i_arg].list[0];
388 else if (!outputFile)
389 outputFile = s_arg[i_arg].list[0];
390 else
391 SDDS_Bomb("Too many files given!");
392 }
393 }
394
395 processFilenames("sdds2dinterpolate", &inputFile, &outputFile, pipeFlags, 0, NULL);
396 if (!spec->generate_points && !spec->nointerp && !pointsFile) {
397 fprintf(stderr, "No output grid specified.\n");
398 exit(EXIT_FAILURE);
399 }
400 if (spec->thin) {
401 if (spec->nxd == -1)
402 spec->nxd = spec->nx;
403 if (spec->nyd == -1)
404 spec->nyd = spec->ny;
405 if (spec->nxd <= 0 || spec->nyd <= 0) {
406 fprintf(stderr, "Invalid grid size for thinning.\n");
407 exit(EXIT_FAILURE);
408 }
409 }
410 if (spec->npoints == 1) {
411 if (spec->nx <= 0)
412 spec->npoints = 0;
413 else
414 spec->npoints = spec->nx * spec->ny;
415 }
416 ReadInputFile(inputFile, xCol, yCol, zColMatch, zColMatches, &zCol, &zCols, stdCol, &pages, &rows, &x, &y, &z, &std, &SDDS_in);
417 if (!spec->nointerp)
418 SetupOutputFile(&SDDS_out, &SDDS_in, outputFile, xCol, yCol, pointsFileXName, pointsFileYName,
419 zCol, zCols, columnMajorOrder);
420 if (!SDDS_Terminate(&SDDS_in))
421 SDDS_PrintErrors(stderr, SDDS_VERBOSE_PrintErrors | SDDS_EXIT_PrintErrors);
422 if (pointsFile)
423 ReadPointFile(pointsFile, pointsFileXName ? pointsFileXName : xCol, pointsFileYName ? pointsFileYName : yCol,
424 &point_pages, &out_point);
425 pin = tmalloc(sizeof(*pin) * zCols);
426 if (merge) {
427 for (i = 0; i < pages; i++) {
428 if (!i) {
429 xmin = xmax = x[0][0];
430 ymin = ymax = y[0][0];
431 }
432 for (k = 0; k < zCols; k++)
433 pin[k] = SDDS_Realloc(pin[k], sizeof(**pin) * (nin + rows[i]));
434 if (std)
435 std_all = SDDS_Realloc(std_all, sizeof(*std_all) * (nin + rows[i]));
436 for (j = 0; j < rows[i]; j++) {
437 if (x[i][j] < xmin)
438 xmin = x[i][j];
439 else if (x[i][j] > xmax)
440 xmax = x[i][j];
441 if (y[i][j] < ymin)
442 ymin = y[i][j];
443 else if (y[i][j] > ymax)
444 ymax = y[i][j];
445 for (k = 0; k < zCols; k++) {
446 pin[k][nin + j].x = x[i][j];
447 pin[k][nin + j].y = y[i][j];
448 pin[k][nin + j].z = z[k][i][j];
449 }
450 if (std)
451 std_all[nin + j] = std[i][j];
452 }
453 nin += rows[i];
454 free(x[i]);
455 free(y[i]);
456 for (k = 0; k < zCols; k++) {
457 free(z[k][i]);
458 z[k][i] = NULL;
459 }
460 if (std && std[i]) {
461 free(std[i]);
462 std[i] = NULL;
463 }
464 x[i] = y[i] = NULL;
465 }
466 free(x);
467 free(y);
468 x = y = NULL;
469 for (k = 0; k < zCols; k++) {
470 free(z[k]);
471 z[k] = NULL;
472 }
473 free(z);
474 z = NULL;
475 if (std)
476 free(std);
477 std = NULL;
478 if (!spec->range) {
479 spec->xmin = xmin;
480 spec->ymin = ymin;
481 spec->xmax = xmax;
482 spec->ymax = ymax;
483 }
484 if (pointsFile) {
485 if (!interpolate_output_points(nin, pin, std_all, xCol, yCol, pointsFileXName, pointsFileYName,
486 zCol, zCols, spec, pages, out_point, &SDDS_out))
487 exit(EXIT_FAILURE);
488 writepage = 1;
489 } else {
490 for (k = 0; k < zCols; k++) {
491 if (spec->method == NN) {
492 do_nn_2d_interpolate(spec, &nin, &pin[k], &nout, &pout);
493 } else if (spec->method == CSA) {
494 do_csa_2d_interpolate(spec, nin, pin[k], &nout, &pout, std_all);
495 }
496 if (!spec->nointerp) {
497 if (!writepage) {
498 WriteOutputPage(&SDDS_out, pointsFileXName ? pointsFileXName : xCol,
499 pointsFileYName ? pointsFileYName : yCol,
500 zCol[k], spec, nout, pout, 0);
501 writepage = 1;
502 } else {
503 for (i = 0; i < nout; i++) {
504 if (!SDDS_SetRowValues(&SDDS_out, SDDS_SET_BY_NAME | SDDS_PASS_BY_VALUE, i,
505 zCol[k], pout[i].z, NULL))
506 SDDS_PrintErrors(stderr, SDDS_VERBOSE_PrintErrors | SDDS_EXIT_PrintErrors);
507 }
508 }
509 }
510 }
511 if (writepage && !SDDS_WritePage(&SDDS_out))
512 SDDS_PrintErrors(stderr, SDDS_VERBOSE_PrintErrors | SDDS_EXIT_PrintErrors);
513 }
514 } else {
515 for (i = 0; i < pages; i++) {
516 xmin = xmax = x[i][0];
517 ymin = ymax = y[i][0];
518 nin = rows[i];
519 for (j = 0; j < nin; j++) {
520 if (x[i][j] < xmin)
521 xmin = x[i][j];
522 else if (x[i][j] > xmax)
523 xmax = x[i][j];
524 if (y[i][j] < ymin)
525 ymin = y[i][j];
526 else if (y[i][j] > ymax)
527 ymax = y[i][j];
528 }
529 if (!spec->range) {
530 spec->xmin = xmin;
531 spec->ymin = ymin;
532 spec->xmax = xmax;
533 spec->ymax = ymax;
534 }
535 for (k = 0; k < zCols; k++) {
536 pin[k] = malloc(sizeof(**pin) * nin);
537 for (j = 0; j < rows[i]; j++) {
538 pin[k][j].x = x[i][j];
539 pin[k][j].y = y[i][j];
540 pin[k][j].z = z[k][i][j];
541 }
542 free(z[k][i]);
543 }
544 free(x[i]);
545 free(y[i]);
546 x[i] = y[i] = NULL;
547 if (std && std[i])
548 std_all = std[i];
549 else
550 std_all = NULL;
551 if (pointsFile) {
552 if (!interpolate_output_points(nin, pin, std_all, xCol, yCol, pointsFileXName, pointsFileYName,
553 zCol, zCols, spec, point_pages, out_point, &SDDS_out))
554 exit(EXIT_FAILURE);
555 writepage = 1;
556 } else {
557 for (k = 0; k < zCols; k++) {
558 if (spec->method == NN) {
559 do_nn_2d_interpolate(spec, &nin, &pin[k], &nout, &pout);
560 } else if (spec->method == CSA) {
561 do_csa_2d_interpolate(spec, nin, pin[k], &nout, &pout, std_all);
562 }
563 if (!spec->nointerp) {
564 if (!writepage) {
565 WriteOutputPage(&SDDS_out, pointsFileXName ? pointsFileXName : xCol,
566 pointsFileYName ? pointsFileYName : yCol,
567 zCol[k], spec, nout, pout, 0);
568 writepage = 1;
569 } else {
570 for (j = 0; j < nout; j++) {
571 if (!SDDS_SetRowValues(&SDDS_out, SDDS_SET_BY_NAME | SDDS_PASS_BY_VALUE, j,
572 zCol[k], pout[j].z, NULL))
573 SDDS_PrintErrors(stderr, SDDS_VERBOSE_PrintErrors | SDDS_EXIT_PrintErrors);
574 }
575 }
576 }
577 }
578 if (std && std[i]) {
579 free(std[i]);
580 std[i] = NULL;
581 }
582 if (writepage && !SDDS_WritePage(&SDDS_out))
583 SDDS_PrintErrors(stderr, SDDS_VERBOSE_PrintErrors | SDDS_EXIT_PrintErrors);
584 }
585 }
586 free(x);
587 free(y);
588 for (k = 0; k < zCols; k++)
589 free(z[k]);
590 free(z);
591 x = y = NULL;
592 }
593 if (std)
594 free(std);
595 for (k = 0; k < zCols; k++)
596 free(pin[k]);
597 free(pin);
598 if (writepage && !SDDS_Terminate(&SDDS_out))
599 SDDS_PrintErrors(stderr, SDDS_VERBOSE_PrintErrors | SDDS_EXIT_PrintErrors);
600 if (point_pages && out_point) {
601 for (i = 0; i < point_pages; i++) {
602 free(out_point[i].pout);
603 }
604 free(out_point);
605 }
606 if (pout)
607 free(pout);
608 free(spec);
609 free(rows);
610 for (i = 0; i < zCols; i++)
611 free(zCol[i]);
612 free(zCol);
613 free_scanargs(&s_arg, argc);
614 return EXIT_SUCCESS;
615}
int32_t SDDS_Terminate(SDDS_DATASET *SDDS_dataset)
void SDDS_RegisterProgramName(const char *name)
Registers the executable program name for use in error messages.
Definition SDDS_utils.c:288
void SDDS_Bomb(char *message)
Terminates the program after printing an error message and recorded errors.
Definition SDDS_utils.c:342
void * SDDS_Realloc(void *old_ptr, size_t new_size)
Reallocates memory to a new size.
Definition SDDS_utils.c:677
#define SDDS_STRING
Identifier for the string data type.
Definition SDDStypes.h:85
#define SDDS_LONG
Identifier for the signed 32-bit integer data type.
Definition SDDStypes.h:61
#define SDDS_DOUBLE
Identifier for the double data type.
Definition SDDStypes.h:37
void * tmalloc(uint64_t size_of_block)
Allocates a memory block of the specified size with zero initialization.
Definition array.c:59
int get_double(double *dptr, char *s)
Parses a double value from the given string.
Definition data_scan.c:40
int get_int(int *iptr, char *s)
Parses an integer value from the given string.
Definition data_scan.c:380
char * delete_chars(char *s, char *t)
Removes all occurrences of characters found in string t from string s.
long match_string(char *string, char **option, long n_options, long mode)
Matches a given string against an array of option strings based on specified modes.
int scanargs(SCANNED_ARG **scanned, int argc, char **argv)
Definition scanargs.c:36
long processPipeOption(char **item, long items, unsigned long *flags)
Definition scanargs.c:356
void processFilenames(char *programName, char **input, char **output, unsigned long pipeFlags, long noWarnings, long *tmpOutputUsed)
Definition scanargs.c:390
void free_scanargs(SCANNED_ARG **scanned, int argc)
Definition scanargs.c:584
long scanItemList(unsigned long *flags, char **item, long *items, unsigned long mode,...)
Scans a list of items and assigns values based on provided keywords and types.

◆ ReadInputFile()

void ReadInputFile ( char * inputFile,
char * xCol,
char * yCol,
char ** zColMatch,
long zColMatches,
char *** zCol,
int32_t * zCols,
char * stdCol,
long * pages,
long ** rows,
double *** x,
double *** y,
double **** z,
double *** std,
SDDS_DATASET * SDDS_in )

Definition at line 617 of file sdds2dinterpolate.c.

618 {
619 int64_t rows1 = 0;
620 long i, pages0 = 0, std_exist = 0;
621
622 if (!SDDS_InitializeInput(SDDS_in, inputFile))
623 SDDS_PrintErrors(stderr, SDDS_VERBOSE_PrintErrors | SDDS_EXIT_PrintErrors);
624 if (!zColMatches) {
625 *zCol = tmalloc(sizeof(**zCol));
626 SDDS_CopyString(zCol[0], "z");
627 *zCols = 1;
628 } else {
629 *zCol = getMatchingSDDSNames(SDDS_in, zColMatch, zColMatches, zCols, SDDS_MATCH_COLUMN);
630 free(zColMatch);
631 if (!(*zCols)) {
632 fprintf(stderr, "No dependent columns found in input file.\n");
633 exit(EXIT_FAILURE);
634 }
635 }
636 *z = tmalloc(sizeof(**z) * (*zCols));
637 *rows = NULL;
638 if (SDDS_CheckColumn(SDDS_in, xCol, NULL, SDDS_ANY_NUMERIC_TYPE, stderr) != SDDS_CHECK_OK) {
639 fprintf(stderr, "X column - %s does not exist!\n", xCol);
640 exit(EXIT_FAILURE);
641 }
642 if (SDDS_CheckColumn(SDDS_in, yCol, NULL, SDDS_ANY_NUMERIC_TYPE, stderr) != SDDS_CHECK_OK) {
643 fprintf(stderr, "Y column - %s does not exist!\n", yCol);
644 exit(EXIT_FAILURE);
645 }
646 for (i = 0; i < *zCols; i++) {
647 if (SDDS_CheckColumn(SDDS_in, (*zCol)[i], NULL, SDDS_ANY_NUMERIC_TYPE, stderr) != SDDS_CHECK_OK) {
648 fprintf(stderr, "Z column - %s does not exist!\n", (*zCol)[i]);
649 exit(EXIT_FAILURE);
650 }
651 }
652 if (SDDS_CheckColumn(SDDS_in, stdCol, NULL, SDDS_ANY_NUMERIC_TYPE, NULL) == SDDS_CHECK_OK)
653 std_exist = 1;
654
655 while (SDDS_ReadPage(SDDS_in) > 0) {
656 rows1 = SDDS_CountRowsOfInterest(SDDS_in);
657 if (!rows1)
658 continue;
659 if (rows1 > INT32_MAX) {
660 fprintf(stderr, "Too many input rows for 2D interpolate library routines.\n");
661 exit(EXIT_FAILURE);
662 }
663 *rows = SDDS_Realloc(*rows, sizeof(**rows) * (pages0 + 1));
664 (*rows)[pages0] = rows1;
665 if (!(*x = SDDS_Realloc(*x, sizeof(**x) * (pages0 + 1))) ||
666 !(*y = SDDS_Realloc(*y, sizeof(**y) * (pages0 + 1)))) {
667 fprintf(stderr, "Memory allocation error for X and Y data.\n");
668 exit(EXIT_FAILURE);
669 }
670 for (i = 0; i < *zCols; i++) {
671 if (!((*z)[i] = SDDS_Realloc((*z)[i], sizeof(***z) * (pages0 + 1)))) {
672 fprintf(stderr, "Memory allocation error for Z data.\n");
673 exit(EXIT_FAILURE);
674 }
675 }
676 if (std_exist) {
677 if (!(*std = SDDS_Realloc(*std, sizeof(**std) * (pages0 + 1)))) {
678 fprintf(stderr, "Memory allocation error for standard error.\n");
679 exit(EXIT_FAILURE);
680 }
681 (*std)[pages0] = NULL;
682 }
683
684 (*x)[pages0] = (*y)[pages0] = NULL;
685 if (!((*x)[pages0] = (double *)SDDS_GetColumnInDoubles(SDDS_in, xCol)) ||
686 !((*y)[pages0] = (double *)SDDS_GetColumnInDoubles(SDDS_in, yCol)))
687 SDDS_PrintErrors(stderr, SDDS_VERBOSE_PrintErrors | SDDS_EXIT_PrintErrors);
688 for (i = 0; i < *zCols; i++) {
689 (*z)[i][pages0] = NULL;
690 if (!((*z)[i][pages0] = (double *)SDDS_GetColumnInDoubles(SDDS_in, (*zCol)[i])))
691 SDDS_PrintErrors(stderr, SDDS_VERBOSE_PrintErrors | SDDS_EXIT_PrintErrors);
692 }
693 if (std_exist && !((*std)[pages0] = (double *)SDDS_GetColumnInDoubles(SDDS_in, stdCol)))
694 SDDS_PrintErrors(stderr, SDDS_VERBOSE_PrintErrors | SDDS_EXIT_PrintErrors);
695 pages0++;
696 }
697
698 if (!pages0) {
699 fprintf(stderr, "No data found in the input file.\n");
700 exit(EXIT_FAILURE);
701 }
702 *pages = pages0;
703 return;
704}
int64_t SDDS_CountRowsOfInterest(SDDS_DATASET *SDDS_dataset)
Counts the number of rows marked as "of interest" in the current data table.
double * SDDS_GetColumnInDoubles(SDDS_DATASET *SDDS_dataset, char *column_name)
Retrieves the data of a specified numerical column as an array of doubles, considering only rows mark...
int32_t SDDS_InitializeInput(SDDS_DATASET *SDDS_dataset, char *filename)
Definition SDDS_input.c:49
int32_t SDDS_ReadPage(SDDS_DATASET *SDDS_dataset)
char ** getMatchingSDDSNames(SDDS_DATASET *dataset, char **matchName, int32_t matches, int32_t *names, short type)
Retrieves an array of matching SDDS entity names based on specified criteria.
int32_t SDDS_CheckColumn(SDDS_DATASET *SDDS_dataset, char *name, char *units, int32_t type, FILE *fp_message)
Checks if a column exists in the SDDS dataset with the specified name, units, and type.
int32_t SDDS_CopyString(char **target, const char *source)
Copies a source string to a target string with memory allocation.
Definition SDDS_utils.c:856
#define SDDS_ANY_NUMERIC_TYPE
Special identifier used by SDDS_Check*() routines to accept any numeric type.
Definition SDDStypes.h:157

◆ ReadPointFile()

void ReadPointFile ( char * pointsFile,
char * xCol,
char * yCol,
long * point_pages,
OUT_POINT ** out_point )

Definition at line 806 of file sdds2dinterpolate.c.

806 {
807 SDDS_DATASET SDDS_in;
808 int64_t rows1 = 0;
809 long pages0 = 0;
810 double *x, *y, xmin, xmax, firstx, firsty, ymin, ymax;
811 int nx, ny, i;
812
813 if (!SDDS_InitializeInput(&SDDS_in, inputFile))
814 SDDS_PrintErrors(stderr, SDDS_VERBOSE_PrintErrors | SDDS_EXIT_PrintErrors);
815 if (SDDS_CheckColumn(&SDDS_in, xCol, NULL, SDDS_ANY_NUMERIC_TYPE, stderr) != SDDS_CHECK_OK) {
816 fprintf(stderr, "X column - %s does not exist!\n", xCol);
817 exit(EXIT_FAILURE);
818 }
819 if (SDDS_CheckColumn(&SDDS_in, yCol, NULL, SDDS_ANY_NUMERIC_TYPE, stderr) != SDDS_CHECK_OK) {
820 fprintf(stderr, "Y column - %s does not exist!\n", yCol);
821 exit(EXIT_FAILURE);
822 }
823 while (SDDS_ReadPage(&SDDS_in) > 0) {
824 rows1 = SDDS_CountRowsOfInterest(&SDDS_in);
825 if (!rows1)
826 continue;
827 if (rows1 > INT32_MAX) {
828 fprintf(stderr, "Too many input rows for 2D interpolate library routines.\n");
829 exit(EXIT_FAILURE);
830 }
831 *out_point = SDDS_Realloc(*out_point, sizeof(**out_point) * (pages0 + 1));
832 x = y = NULL;
833 (*out_point)[pages0].pout = malloc(sizeof(point) * rows1);
834 (*out_point)[pages0].nout = rows1;
835 if (!(x = (double *)SDDS_GetColumnInDoubles(&SDDS_in, xCol)) ||
836 !(y = (double *)SDDS_GetColumnInDoubles(&SDDS_in, yCol)))
837 SDDS_PrintErrors(stderr, SDDS_VERBOSE_PrintErrors | SDDS_EXIT_PrintErrors);
838 xmin = xmax = firstx = x[0];
839 ymin = ymax = firsty = y[0];
840 nx = ny = 0;
841
842 for (i = 0; i < rows1; i++) {
843 (*out_point)[pages0].pout[i].x = x[i];
844 (*out_point)[pages0].pout[i].y = y[i];
845 if (x[i] < xmin)
846 xmin = x[i];
847 else if (x[i] > xmax)
848 xmax = x[i];
849 if (x[i] == firstx)
850 ny++;
851 if (y[i] < ymin)
852 ymin = y[i];
853 else if (y[i] > ymax)
854 ymax = y[i];
855 if (y[i] == firsty)
856 nx++;
857 }
858 free(x);
859 free(y);
860 (*out_point)[pages0].xmin = xmin;
861 (*out_point)[pages0].xmax = xmax;
862 (*out_point)[pages0].ymin = ymin;
863 (*out_point)[pages0].ymax = ymax;
864 (*out_point)[pages0].nx = nx;
865 (*out_point)[pages0].ny = ny;
866 if (nx > 1)
867 (*out_point)[pages0].dx = (xmax - xmin) / (nx - 1);
868 else
869 (*out_point)[pages0].dx = 0;
870 if (ny > 1)
871 (*out_point)[pages0].dy = (ymax - ymin) / (ny - 1);
872 else
873 (*out_point)[pages0].dy = 0;
874 pages0++;
875 }
876 if (!SDDS_Terminate(&SDDS_in))
877 SDDS_PrintErrors(stderr, SDDS_VERBOSE_PrintErrors | SDDS_EXIT_PrintErrors);
878 if (!pages0) {
879 fprintf(stderr, "No data found in the points file.\n");
880 exit(EXIT_FAILURE);
881 }
882 *pages = pages0;
883 return;
884}

◆ SetupOutputFile()

void SetupOutputFile ( SDDS_DATASET * SDDS_out,
SDDS_DATASET * SDDS_in,
char * outputFile,
char * xCol,
char * yCol,
char * xName,
char * yName,
char ** zCol,
long zCols,
short columnMajorOrder )

Definition at line 706 of file sdds2dinterpolate.c.

707 {
708 char tmpstr[256], *xUnits = NULL, *yUnits = NULL;
709 long i;
710
711 if (!SDDS_InitializeOutput(SDDS_out, SDDS_BINARY, 1, NULL, NULL, outputFile))
712 SDDS_PrintErrors(stderr, SDDS_VERBOSE_PrintErrors | SDDS_EXIT_PrintErrors);
713 if (!SDDS_DefineSimpleParameter(SDDS_out, "Variable1Name", NULL, SDDS_STRING) ||
714 !SDDS_DefineSimpleParameter(SDDS_out, "Variable2Name", NULL, SDDS_STRING) ||
715 !SDDS_TransferColumnDefinition(SDDS_out, SDDS_in, xCol, xName) ||
716 !SDDS_TransferColumnDefinition(SDDS_out, SDDS_in, yCol, yName))
717 SDDS_PrintErrors(stderr, SDDS_VERBOSE_PrintErrors | SDDS_EXIT_PrintErrors);
718 if (columnMajorOrder != -1)
719 SDDS_out->layout.data_mode.column_major = columnMajorOrder;
720 else
721 SDDS_out->layout.data_mode.column_major = SDDS_in->layout.data_mode.column_major;
722 for (i = 0; i < zCols; i++) {
723 if (!SDDS_TransferColumnDefinition(SDDS_out, SDDS_in, zCol[i], NULL))
724 SDDS_PrintErrors(stderr, SDDS_VERBOSE_PrintErrors | SDDS_EXIT_PrintErrors);
725 }
726 if (SDDS_GetColumnInformation(SDDS_in, "units", &xUnits, SDDS_GET_BY_NAME, xCol) != SDDS_STRING ||
727 SDDS_GetColumnInformation(SDDS_in, "units", &yUnits, SDDS_GET_BY_NAME, yCol) != SDDS_STRING)
728 SDDS_PrintErrors(stderr, SDDS_VERBOSE_PrintErrors | SDDS_EXIT_PrintErrors);
729 sprintf(tmpstr, "%sDimension", xName ? xName : xCol);
730 if (!SDDS_DefineSimpleParameter(SDDS_out, tmpstr, NULL, SDDS_LONG))
731 SDDS_PrintErrors(stderr, SDDS_VERBOSE_PrintErrors | SDDS_EXIT_PrintErrors);
732 sprintf(tmpstr, "%sDimension", yName ? yName : yCol);
733 if (!SDDS_DefineSimpleParameter(SDDS_out, tmpstr, NULL, SDDS_LONG))
734 SDDS_PrintErrors(stderr, SDDS_VERBOSE_PrintErrors | SDDS_EXIT_PrintErrors);
735 sprintf(tmpstr, "%sInterval", xName ? xName : xCol);
736 if (!SDDS_DefineSimpleParameter(SDDS_out, tmpstr, xUnits, SDDS_DOUBLE))
737 SDDS_PrintErrors(stderr, SDDS_VERBOSE_PrintErrors | SDDS_EXIT_PrintErrors);
738 sprintf(tmpstr, "%sInterval", yName ? yName : yCol);
739 if (!SDDS_DefineSimpleParameter(SDDS_out, tmpstr, yUnits, SDDS_DOUBLE))
740 SDDS_PrintErrors(stderr, SDDS_VERBOSE_PrintErrors | SDDS_EXIT_PrintErrors);
741 sprintf(tmpstr, "%sMinimum", xName ? xName : xCol);
742 if (!SDDS_DefineSimpleParameter(SDDS_out, tmpstr, xUnits, SDDS_DOUBLE))
743 SDDS_PrintErrors(stderr, SDDS_VERBOSE_PrintErrors | SDDS_EXIT_PrintErrors);
744 sprintf(tmpstr, "%sMinimum", yName ? yName : yCol);
745 if (!SDDS_DefineSimpleParameter(SDDS_out, tmpstr, yUnits, SDDS_DOUBLE))
746 SDDS_PrintErrors(stderr, SDDS_VERBOSE_PrintErrors | SDDS_EXIT_PrintErrors);
747 sprintf(tmpstr, "%sMaximum", xName ? xName : xCol);
748 if (!SDDS_DefineSimpleParameter(SDDS_out, tmpstr, xUnits, SDDS_DOUBLE))
749 SDDS_PrintErrors(stderr, SDDS_VERBOSE_PrintErrors | SDDS_EXIT_PrintErrors);
750 sprintf(tmpstr, "%sMaximum", yName ? yName : yCol);
751 if (!SDDS_DefineSimpleParameter(SDDS_out, tmpstr, yUnits, SDDS_DOUBLE))
752 SDDS_PrintErrors(stderr, SDDS_VERBOSE_PrintErrors | SDDS_EXIT_PrintErrors);
753 if (!SDDS_WriteLayout(SDDS_out))
754 SDDS_PrintErrors(stderr, SDDS_VERBOSE_PrintErrors | SDDS_EXIT_PrintErrors);
755 if (xUnits)
756 free(xUnits);
757 if (yUnits)
758 free(yUnits);
759}
int32_t SDDS_GetColumnInformation(SDDS_DATASET *SDDS_dataset, char *field_name, void *memory, int32_t mode,...)
Retrieves information about a specified column in the SDDS dataset.
Definition SDDS_info.c:41
int32_t SDDS_InitializeOutput(SDDS_DATASET *SDDS_dataset, int32_t data_mode, int32_t lines_per_row, const char *description, const char *contents, const char *filename)
Initializes the SDDS output dataset.
int32_t SDDS_DefineSimpleParameter(SDDS_DATASET *SDDS_dataset, const char *name, const char *unit, int32_t type)
Defines a simple data parameter within the SDDS dataset.
int32_t SDDS_WriteLayout(SDDS_DATASET *SDDS_dataset)
Writes the SDDS layout header to the output file.
int32_t SDDS_TransferColumnDefinition(SDDS_DATASET *target, SDDS_DATASET *source, char *name, char *newName)
Transfers a column definition from a source dataset to a target dataset.

◆ WriteOutputPage()

void WriteOutputPage ( SDDS_DATASET * SDDS_out,
char * xCol,
char * yCol,
char * zCol,
specs * spec,
int nout,
point * pout,
long writepage )

Definition at line 761 of file sdds2dinterpolate.c.

761 {
762 char tmpstr[256];
763 int i;
764
765 if (!SDDS_StartPage(SDDS_out, nout))
766 SDDS_PrintErrors(stderr, SDDS_VERBOSE_PrintErrors | SDDS_EXIT_PrintErrors);
767 if (!SDDS_SetParameters(SDDS_out, SDDS_SET_BY_NAME | SDDS_PASS_BY_VALUE,
768 "Variable1Name", xCol,
769 "Variable2Name", yCol, NULL))
770 SDDS_PrintErrors(stderr, SDDS_VERBOSE_PrintErrors | SDDS_EXIT_PrintErrors);
771 sprintf(tmpstr, "%sDimension", xCol);
772 if (!SDDS_SetParameters(SDDS_out, SDDS_SET_BY_NAME | SDDS_PASS_BY_VALUE, tmpstr, spec->nx, NULL))
773 SDDS_PrintErrors(stderr, SDDS_VERBOSE_PrintErrors | SDDS_EXIT_PrintErrors);
774 sprintf(tmpstr, "%sDimension", yCol);
775 if (!SDDS_SetParameters(SDDS_out, SDDS_SET_BY_NAME | SDDS_PASS_BY_VALUE, tmpstr, spec->ny, NULL))
776 SDDS_PrintErrors(stderr, SDDS_VERBOSE_PrintErrors | SDDS_EXIT_PrintErrors);
777 sprintf(tmpstr, "%sInterval", xCol);
778 if (!SDDS_SetParameters(SDDS_out, SDDS_SET_BY_NAME | SDDS_PASS_BY_VALUE, tmpstr, spec->dx, NULL))
779 SDDS_PrintErrors(stderr, SDDS_VERBOSE_PrintErrors | SDDS_EXIT_PrintErrors);
780 sprintf(tmpstr, "%sInterval", yCol);
781 if (!SDDS_SetParameters(SDDS_out, SDDS_SET_BY_NAME | SDDS_PASS_BY_VALUE, tmpstr, spec->dy, NULL))
782 SDDS_PrintErrors(stderr, SDDS_VERBOSE_PrintErrors | SDDS_EXIT_PrintErrors);
783 sprintf(tmpstr, "%sMinimum", xCol);
784 if (!SDDS_SetParameters(SDDS_out, SDDS_SET_BY_NAME | SDDS_PASS_BY_VALUE, tmpstr, spec->xmin, NULL))
785 SDDS_PrintErrors(stderr, SDDS_VERBOSE_PrintErrors | SDDS_EXIT_PrintErrors);
786 sprintf(tmpstr, "%sMinimum", yCol);
787 if (!SDDS_SetParameters(SDDS_out, SDDS_SET_BY_NAME | SDDS_PASS_BY_VALUE, tmpstr, spec->ymin, NULL))
788 SDDS_PrintErrors(stderr, SDDS_VERBOSE_PrintErrors | SDDS_EXIT_PrintErrors);
789 sprintf(tmpstr, "%sMaximum", xCol);
790 if (!SDDS_SetParameters(SDDS_out, SDDS_SET_BY_NAME | SDDS_PASS_BY_VALUE, tmpstr, spec->xmax, NULL))
791 SDDS_PrintErrors(stderr, SDDS_VERBOSE_PrintErrors | SDDS_EXIT_PrintErrors);
792 sprintf(tmpstr, "%sMaximum", yCol);
793 if (!SDDS_SetParameters(SDDS_out, SDDS_SET_BY_NAME | SDDS_PASS_BY_VALUE, tmpstr, spec->ymax, NULL))
794 SDDS_PrintErrors(stderr, SDDS_VERBOSE_PrintErrors | SDDS_EXIT_PrintErrors);
795 for (i = 0; i < nout; i++) {
796 if (!SDDS_SetRowValues(SDDS_out, SDDS_SET_BY_NAME | SDDS_PASS_BY_VALUE, i,
797 xCol, pout[i].x,
798 yCol, pout[i].y,
799 zCol, pout[i].z, NULL))
800 SDDS_PrintErrors(stderr, SDDS_VERBOSE_PrintErrors | SDDS_EXIT_PrintErrors);
801 }
802 if (writepage && !SDDS_WritePage(SDDS_out))
803 SDDS_PrintErrors(stderr, SDDS_VERBOSE_PrintErrors | SDDS_EXIT_PrintErrors);
804}
int32_t SDDS_StartPage(SDDS_DATASET *SDDS_dataset, int64_t expected_n_rows)
int32_t SDDS_SetParameters(SDDS_DATASET *SDDS_dataset, int32_t mode,...)