~ubuntu-branches/ubuntu/trusty/hdf-eos4/trusty

« back to all changes in this revision

Viewing changes to samples/subsetgrid.f

  • Committer: Bazaar Package Importer
  • Author(s): Alastair McKinstry
  • Date: 2009-09-02 23:03:37 UTC
  • Revision ID: james.westby@ubuntu.com-20090902230337-bvelmonz8io8vq9f
Tags: upstream-2.16v1.00.dfsg.1
ImportĀ upstreamĀ versionĀ 2.16v1.00.dfsg.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
c
 
2
c  In this example we will (1) open the "GridFile" HDF file, (2) attach to
 
3
c  the "PolarGrid" grid, and (3) subset data from the "Temperature" field.
 
4
 
5
 
 
6
 
 
7
        program subsetgrid
 
8
 
 
9
        integer            status, gdextreg, gdreginfo, gddetach, gdclose
 
10
        integer*4          gdfid, gdid, gdopen, gdattach, dims(8)
 
11
        integer*4          rank, ntype, gddefboxreg
 
12
 
 
13
        real*8             cornerlon(2), cornerlat(2)
 
14
        real*8             upleft(2), lowright(2)
 
15
        real*4             datbuf(100*100)
 
16
        
 
17
        integer DFACC_READ
 
18
        parameter (DFACC_READ=1)
 
19
 
 
20
 
 
21
c    
 
22
c     Open the HDF grid file, "GridFile.hdf"
 
23
 
24
 
 
25
        gdfid = gdopen("GridFile.hdf", DFACC_READ)
 
26
 
 
27
        if (gdfid .NE. -1) then
 
28
 
 
29
           gdid = gdattach(gdfid, "PolarGrid")
 
30
 
 
31
           if (gdid .NE. -1) then
 
32
 
 
33
              cornerlon(1) = 0
 
34
              cornerlat(1) = 90.
 
35
              cornerlon(2) = 90
 
36
              cornerlat(2) = 0
 
37
 
 
38
              regionid = gddefboxreg(gdid, cornerlon, cornerlat)
 
39
              
 
40
              status = gdreginfo(gdid, regionid, "Temperature", ntype,
 
41
     1                           rank, dims, size, upleft, lowright)
 
42
              write(*,*) dims(1), dims(2), dims(3), rank, ntype
 
43
              
 
44
              status = gdextreg(gdid, regionid, "Temperature", 
 
45
     1                          datbuf)
 
46
            
 
47
 
 
48
           endif
 
49
        
 
50
           status = gddetach(gdid)
 
51
           status = gdclose(gdfid)
 
52
 
 
53
        endif
 
54
        stop
 
55
        end
 
56