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
|
c
c In this example we will write to an appendable field.
c
program appendfield
integer status, i, swfldinfo, swdetach, swclose
integer swwrfld, swrdfld
integer*2 inarray(5), outarray(20)
integer*4 swfid, swid, rank, dims(1), ntype
integer*4 start(1), stride(1), count(1)
integer*4 swopen, swattach
character*72 dimlist
integer*4 DFACC_RDWR
parameter (DFACC_RDWR=3)
do i=1,5
inarray(i) = i
enddo
swfid = swopen("SwathFile_created_with_hadeos_sample_file_write"//
1"r_of_HDFEOS2_version_219_or_higher_release.hdf", DFACC_RDWR)
swid = swattach(swfid, "Swath1")
c Write 5 records to field
c ------------------------
start(1) = 0
stride(1) = 1
count(1) = 5
status = swwrfld(swid, "Count", start, stride, count, inarray)
status = swfldinfo(swid, "Count", rank, dims, ntype, dimlist)
write(*,*) 'Number of elements after first write:' ,dims(1)
c Append 1 record to field
c ------------------------
start(1) = dims(1)
count(1) = 1
status = swwrfld(swid, "Count", start, stride, count, inarray)
status = swfldinfo(swid, "Count", rank, dims, ntype, dimlist)
write(*,*) 'Number of elements after append:' ,dims(1)
start(1) = 0
count(1) = dims(1)
status = swrdfld(swid, "Count", start, stride, dims, outarray)
do i=1,dims(1)
write(*,*) 'Data Element:', outarray(i)
enddo
status = swdetach(swid)
status = swclose(swfid)
stop
end
|