summaryrefslogtreecommitdiffstats
path: root/src/hdf-eos2-test.c
diff options
context:
space:
mode:
authorThomas Danckaert <thomas.danckaert@gmail.com>2016-03-03 16:20:11 (GMT)
committerThomas Danckaert <thomas.danckaert@gmail.com>2016-05-30 11:45:27 (GMT)
commit88024041f535cbbdb590ef2f0abeeb9ceaa8ab4d (patch)
treedad592b13cd8c395c409c655f1d6ea269f12daec /src/hdf-eos2-test.c
parentb21ca7c1b6cb6a5c9714bcad30d87ab71f1d3e21 (diff)
downloadmxe-88024041f535cbbdb590ef2f0abeeb9ceaa8ab4d.zip
mxe-88024041f535cbbdb590ef2f0abeeb9ceaa8ab4d.tar.gz
mxe-88024041f535cbbdb590ef2f0abeeb9ceaa8ab4d.tar.bz2
Add package 'HDF-EOS2'.
http://hdfeos.org/software/library.php "The HDF-EOS2 is a software library designed built on HDF4 to support EOS-specific data structures, namely Grid, Point, and Swath. The new data structures are constructed from standard HDF data objects, using EOS conventions, through the use of a software library. A key feature of HDF-EOS files is that instrument-independent services, such as subsetting by geolocation, can be applied to the files across a wide variety of data products."
Diffstat (limited to 'src/hdf-eos2-test.c')
-rw-r--r--src/hdf-eos2-test.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/hdf-eos2-test.c b/src/hdf-eos2-test.c
new file mode 100644
index 0000000..ac5f2e1
--- /dev/null
+++ b/src/hdf-eos2-test.c
@@ -0,0 +1,39 @@
+/*
+ * This file is part of MXE.
+ * See index.html for further information.
+ */
+
+#include <hdf.h>
+#include <HdfEosDef.h>
+#include <mfhdf.h>
+
+#include <stdio.h>
+
+int main() {
+ char filename[] = "test.he4";
+ int fid = SWopen(filename, DFACC_CREATE);
+ char swathname[] = "myswath";
+ int swid = SWcreate(fid, swathname);
+
+ char dimname[] = "mydim";
+ const int32 dimlen = 10;
+ int rc = SWdefdim(swid, dimname, dimlen);
+ printf("SWdefdim: %d\n", rc);
+ char fieldname[] = "test_field";
+ rc = SWdefdatafield(swid, fieldname, dimname, DFNT_FLOAT, 0);
+ printf("SWdefdatafield: %d\n", rc);
+
+ int32 start = 0;
+ int32 edge = dimlen;
+ float data[dimlen];
+ for (int i=0; i<dimlen; ++i) {
+ data[i] = 1.0 + i;
+ }
+ rc = SWwritefield(swid, fieldname, &start, NULL, &edge, data);
+ printf("SWwritefield: %d\n", rc);
+
+ rc = SWdetach(swid);
+ printf("SWdetach: %d\n", rc);
+ rc = SWclose(fid);
+ printf("SWclose: %d\n", rc);
+}