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

« back to all changes in this revision

Viewing changes to samples/he5_sw_wrexternaldataF_32.f

  • 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
c
 
2
c ----------------------------------------------------------------------------
 
3
c |    Copyright (C) 1999   Emergent IT Inc. and Raytheon Systems Company    |
 
4
c ----------------------------------------------------------------------------
 
5
c
 
6
 
 
7
      program            he5_sw_wrexternaldataF_32
 
8
 
 
9
      implicit           none
 
10
 
 
11
      include            'hdfeos5.inc'
 
12
 
 
13
      integer            i
 
14
      integer            status
 
15
      integer            he5_swopen
 
16
      integer            he5_swattach
 
17
      integer            he5_swwrfld
 
18
      integer            he5_ehrdwrfile
 
19
      integer            he5_swdetach
 
20
      integer            he5_swclose
 
21
      integer            swfid, swid
 
22
 
 
23
      integer            data_out_1(100)
 
24
      integer            data_out_2(100)
 
25
      integer            data_out_3(100)
 
26
      integer            data(60)
 
27
 
 
28
      integer*4          start(2)
 
29
      integer*4          stride(2)
 
30
      integer*4          count(2)
 
31
      integer*4          num_elements
 
32
 
 
33
      integer            FAIL
 
34
      parameter          (FAIL=-1)
 
35
 
 
36
c.....Use this for writing (only) to an existing file
 
37
      integer            WRITE_EXISTING_ONLY
 
38
      parameter          (WRITE_EXISTING_ONLY=0)
 
39
 
 
40
c.....Use this for reading (only) from an existing file
 
41
      integer            READ_ONLY
 
42
      parameter          (READ_ONLY=1)
 
43
 
 
44
c.....Use this for creating and writing to a file
 
45
      integer            WRITE_NEW
 
46
      parameter          (WRITE_NEW=2)
 
47
 
 
48
 
 
49
c     Create the new data buffer
 
50
c     --------------------------
 
51
      do 10 i=1,60
 
52
         data(i) = 9999
 
53
 10   continue
 
54
      
 
55
c     Open HDF-EOS swath file, "swath.he5"
 
56
c     ------------------------------------
 
57
          swfid = he5_swopen("swath.he5", HE5F_ACC_RDWR)
 
58
      write(*,*) 'File ID returned from he5_swopen():  ',swfid
 
59
 
 
60
          if (swfid .NE. FAIL) then
 
61
                 swid = he5_swattach(swfid, "Swath1")
 
62
         write(*,*) 'Swath ID returned from he5_swattach():  ',swid
 
63
 
 
64
                 if (swid .NE. FAIL) then
 
65
                        
 
66
c     Write new data to the external files 
 
67
c     ------------------------------------
 
68
      start(1)  = 0
 
69
      stride(1) = 1
 
70
      count(1)  = 60
 
71
 
 
72
      status = he5_swwrfld(swid,"ExtData",
 
73
     1     start,stride,count,data)
 
74
      write(*,*) 'Status returned from he5_swrdfld():  ',status
 
75
 
 
76
      num_elements = 100
 
77
 
 
78
      status = he5_ehrdwrfile("extf1.dat",READ_ONLY,
 
79
     1HE5T_NATIVE_INT,num_elements,data_out_1)
 
80
      write(*,*) 'Status returned from he5_ehrdwrfile:   ',status
 
81
 
 
82
      status = he5_ehrdwrfile("extf2.dat",READ_ONLY,
 
83
     1HE5T_NATIVE_INT,num_elements,data_out_2)
 
84
      write(*,*) 'Status returned from he5_ehrdwrfile:   ',status
 
85
 
 
86
      status = he5_ehrdwrfile("extf3.dat",READ_ONLY,
 
87
     1HE5T_NATIVE_INT,num_elements,data_out_3)
 
88
      write(*,*) 'Status returned from he5_ehrdwrfile:   ',status
 
89
 
 
90
      write(*,*)'External file extf1.dat:'
 
91
      write(*,*) data_out_1
 
92
      write(*,*) '  '
 
93
 
 
94
      write(*,*)'External file extf2.dat:'
 
95
      write(*,*) data_out_2
 
96
      write(*,*) '  '
 
97
 
 
98
      write(*,*)'External file extf3.dat:'
 
99
      write(*,*) data_out_3
 
100
      write(*,*) '  '
 
101
 
 
102
                 endif
 
103
          endif
 
104
        
 
105
c     Detach from swath
 
106
c     -----------------
 
107
          status = he5_swdetach(swid)
 
108
      write(*,*) 'Status returned from he5_swdetach():  ',status
 
109
 
 
110
c     Close the file
 
111
c     --------------
 
112
          status = he5_swclose(swfid)
 
113
      write(*,*) 'Status returned from he5_swclose():  ',status
 
114
      
 
115
          stop
 
116
          end
 
117
 
 
118
 
 
119
 
 
120
 
 
121
 
 
122
 
 
123
 
 
124
 
 
125