~ubuntu-branches/ubuntu/lucid/hdf-eos5/lucid

« back to all changes in this revision

Viewing changes to samples/he5_sw_defexternalfld.c

  • Committer: Bazaar Package Importer
  • Author(s): Alastair McKinstry
  • Date: 2009-08-17 23:07:29 UTC
  • Revision ID: james.westby@ubuntu.com-20090817230729-gzbwp1ny01hv2nlk
Tags: upstream-5.1.12.dfsg.1
ImportĀ upstreamĀ versionĀ 5.1.12.dfsg.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 ----------------------------------------------------------------------------
 
3
 |    Copyright (C) 1999   Emergent IT Inc. and Raytheon Systems Company    |
 
4
 ----------------------------------------------------------------------------
 
5
 */
 
6
 
 
7
#include    <HE5_HdfEosDef.h>
 
8
 
 
9
 
 
10
/* ----------------------------------------------------------- */
 
11
/*   In this program we (1) open the "Swath.h5" HDF-EOS file,  */
 
12
/*   (2) attach to the "Swath1" swath, and (3) define the      */
 
13
/*   external data field "ExtData".                            */
 
14
/* ----------------------------------------------------------- */
 
15
 
 
16
int main()
 
17
{
 
18
  
 
19
  herr_t      status = FAIL;
 
20
  
 
21
  hid_t       swfid = FAIL;
 
22
  hid_t       SWid  = FAIL;
 
23
 
 
24
  off_t       offset[3];
 
25
 
 
26
  hsize_t     size[3];
 
27
  
 
28
 
 
29
  /* Open the file, "Swath.h5", using the H5F_ACC_RDWR access code */
 
30
  /* ------------------------------------------------------------- */
 
31
  swfid = HE5_SWopen("Swath.h5", H5F_ACC_RDWR);
 
32
  if (swfid != FAIL)
 
33
    {
 
34
          /* Attach to the "Swath1" swath */
 
35
          /* ---------------------------- */
 
36
          SWid = HE5_SWattach(swfid, "Swath1"); 
 
37
          if (SWid != FAIL)
 
38
                {
 
39
                  /* Set the data sizes and offsets in external files */
 
40
                  /* ------------------------------------------------ */
 
41
                  size[0] = 10 * sizeof(int);       offset[0] = 0;
 
42
                  size[1] = 20 * sizeof(int);       offset[1] = 40;
 
43
                  size[2] = 30 * sizeof(int);       offset[2] = 80;
 
44
 
 
45
                  /* Set external data files first */
 
46
                  /* ----------------------------- */
 
47
                  status = HE5_SWsetextdata(SWid, "external_1.data,external_2.data,external_3.data", offset, size);
 
48
                  printf("Status returned by HE5_SWsetextdata(...) :                        %d\n",status);
 
49
 
 
50
                  /* Define field containing external data */
 
51
                  /* ------------------------------------- */
 
52
                  status = HE5_SWdefdatafield(SWid, "ExtData", "ExtDim", NULL, H5T_NATIVE_INT, 0);
 
53
                  printf("Status returned by HE5_SWdefdatafield(...\"ExtData\",...) :         %d\n",status);              
 
54
                }
 
55
    }
 
56
 
 
57
  /* Detach from the swath */
 
58
  /* --------------------- */
 
59
  status = HE5_SWdetach(SWid);
 
60
  printf("Status returned by HE5_SWdetach(...) :                            %d\n",status);
 
61
 
 
62
  /* Close the file */
 
63
  /* -------------- */
 
64
  status = HE5_SWclose(swfid);
 
65
  printf("Status returned by HE5_SWclose(...) :                             %d\n",status);
 
66
  
 
67
  return 0;
 
68
}
 
69
 
 
70
 
 
71
 
 
72
 
 
73