summaryrefslogtreecommitdiffstats
path: root/src/hdf-eos5-test.c
blob: b803dbdc38cd3231d673938c62ba2a5df39cd6f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/*
 * This file is part of MXE.
 * See index.html for further information.
 */

#include "HE5_HdfEosDef.h"

int main() {

  char filename[] = "test.he5";
  hid_t output_file = HE5_SWopen(filename, H5F_ACC_TRUNC);
  char swathname[] = "testswath";
  hid_t swath_id = HE5_SWcreate(output_file, swathname);

  char dimension[] = "dummydim";
  HE5_SWdefdim(swath_id, dimension, 10);
  char fieldname[] = "test_field";
  HE5_SWdefdatafield(swath_id, fieldname, dimension, NULL, HE5T_NATIVE_FLOAT, 0);

  hssize_t start[HE5_DTSETRANKMAX] = {0};
  hsize_t edge[HE5_DTSETRANKMAX] = {10};
  float testdata[10];

  for(unsigned int i=0; i<10; ++i)
    testdata[i] = (float)i;

  HE5_SWwritefield(swath_id, fieldname, start, NULL, edge, testdata);

  HE5_SWdetach(swath_id);
  HE5_SWclose(output_file);

  return 0;
}