1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
|
c
c In this example we will (1) open the "SwathFile" HDF file, (2) attach to
c the "Swath1" swath, and (3) subset data from the "Spectra" field.
c
program subsetswath
integer status, swextreg, swreginfo, swdetach
integer swextper, swperinfo, swclose
integer*4 swfid, swid, swopen, swattach, dims(8)
integer*4 rank, ntype, size, swdefboxreg, swdeftmeper
integer*4 regionid, periodid
real*8 cornerlon(2), cornerlat(2)
real*8 datbuf(40,20,15), tmebuf(20)
integer DFACC_READ
parameter (DFACC_READ=1)
integer HDFE_MIDPOINT
parameter (HDFE_MIDPOINT=0)
integer HDFE_INTERNAL
parameter (HDFE_INTERNAL=0)
c
c Open the HDF swath file, "SwathFile.hdf"
c
swfid = swopen("SwathFile_created_with_hadeos_sample_file_write"//
1"r_of_HDFEOS2_version_219_or_higher_release.hdf", DFACC_READ)
if (swfid .NE. -1) then
swid = swattach(swfid, "Swath1")
if (swid .NE. -1) then
cornerlon(1) = 3.
cornerlat(1) = 5.
cornerlon(2) = 7.
cornerlat(2) = 12.
regionid = swdefboxreg(swid, cornerlon, cornerlat,
1 HDFE_MIDPOINT)
write(*,*) regionid,swid
status = swreginfo(swid, regionid, "Spectra", ntype,
1 rank, dims, size)
write(*,*) dims(1), dims(2), dims(3), rank, ntype, size
status = swextreg(swid, regionid, "Spectra",
1 HDFE_INTERNAL, datbuf)
c Time Subsetting
periodid = swdeftmeper(swid, 35232487.2d0, 36609898.1d0,
1 HDFE_MIDPOINT)
write(*,*) 'Time Subset: ', periodid,swid
status = swperinfo(swid, periodid, "Time", ntype,
1 rank, dims, size)
write(*,*) 'Time Subset: ', rank, dims(1), size
status = swextper(swid, periodid, "Time",
1 HDFE_INTERNAL, tmebuf)
do 10 i=1,size/8
write(*,*) i, tmebuf(i)
10 continue
endif
status = swdetach(swid)
status = swclose(swfid)
endif
stop
end
|