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

« back to all changes in this revision

Viewing changes to samples/he5_gd_subsetF_64.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  In this example we will (1) open the "grid.he5" HDF-EOS file, (2) attach to
 
2
c  the "PolarGrid" grid, and (3) subset data from the "Temperature" field.
 
3
 
 
4
      program      he5_gd_subsetF_64
 
5
 
 
6
      implicit     none
 
7
 
 
8
      include      'hdfeos5.inc'
 
9
 
 
10
      integer      status
 
11
      integer      gdfid
 
12
      integer      gdid
 
13
      integer      rgid
 
14
      integer      he5_gdopen
 
15
      integer      he5_gdattach
 
16
      integer      he5_gdreginfo
 
17
      integer      he5_gddefboxreg
 
18
      integer      he5_gdextreg
 
19
      integer      he5_gddetach
 
20
      integer      he5_gdclose
 
21
      integer      rk,nt
 
22
 
 
23
      integer*8    dims(8)
 
24
      integer*8    size
 
25
 
 
26
      real*8       cornerlon(2)
 
27
      real*8       cornerlat(2)
 
28
      real*8       upleft(2)
 
29
      real*8       lowright(2)
 
30
 
 
31
      real*4       datbuf(100*100)
 
32
        
 
33
      integer      FAIL
 
34
      parameter    (FAIL=-1)
 
35
 
 
36
c     Open the HDF-EOS grid file, "grid.he5"
 
37
c     --------------------------------------- 
 
38
      gdfid = he5_gdopen("grid.he5",HE5F_ACC_RDWR)
 
39
      write(*,*) 'File ID returned by he5_gdopen():  ',gdfid
 
40
 
 
41
      if (gdfid .NE. FAIL) then
 
42
 
 
43
c        Attach to the POLAR grid
 
44
c        ------------------------
 
45
         gdid = he5_gdattach(gdfid,"PolarGrid")
 
46
         write(*,*) 'Grid ID returned by he5_gdattach():  ',gdid
 
47
 
 
48
         if (gdid .NE. FAIL) then
 
49
            cornerlon(1) = 0.
 
50
            cornerlat(1) = 90.
 
51
            cornerlon(2) = 90.
 
52
            cornerlat(2) = 0.
 
53
 
 
54
c           Define box region
 
55
c           -----------------
 
56
            rgid   = he5_gddefboxreg(gdid,
 
57
     1           cornerlon,cornerlat)
 
58
            write(*,*) 'Region ID returned by he5_gddefboxreg():  ',
 
59
     1           rgid
 
60
 
 
61
c           Get region information
 
62
c           ----------------------            
 
63
            status = he5_gdreginfo(gdid,rgid,"Temperature",
 
64
     1           nt,rk, dims, size, upleft, lowright)
 
65
            write(*,*) dims(1), dims(2), rk, nt
 
66
 
 
67
c           Extract region
 
68
c           --------------
 
69
            status = he5_gdextreg(gdid,rgid,"Temperature",
 
70
     1           datbuf)
 
71
            write(*,*) 'Status returned by he5_gdextreg():  ',status
 
72
         endif
 
73
         
 
74
c        Detach from the grid
 
75
c        --------------------
 
76
         status = he5_gddetach(gdid)
 
77
         write(*,*) 'Status returned by he5_gddetach():  ',status
 
78
 
 
79
c        Close the file
 
80
c        --------------
 
81
         status = he5_gdclose(gdfid)
 
82
         write(*,*) 'Status returned by he5_gdclose():  ',status        
 
83
 
 
84
      endif
 
85
      stop
 
86
      end
 
87
        
 
88
 
 
89
 
 
90