summaryrefslogtreecommitdiffstats
path: root/src/hdf-eos5-test.c
blob: 1f90623fe1462b3a814715559b1b011f375be2a7 (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
/*
 * This file is part of MXE. See LICENSE.md for licensing 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;
}