Re: extract of an image (array)



I´m writing my diploma thesis. The subject is the analysis and
interpretation of satellite data. These data have the form of 10 bit
gray scale image (.pgm). But I need only a sector of each image
(sector=Europe). So I want to extract this sector from each image and
store it in a new file. Unfortunately I have never done somthing like
that before. These are my first steps in programming...
My tutor helped me a little and gave me something like a framework or
starting point for the final program. Here it is:
----------------------------------------------------------------------------

program test

character(256) :: name_IN =
"C:\MSG-1\Images\HRIT\200407161200-msg-ch02.pgm"
integer :: pixels = 3712
integer :: lines = 3712

integer :: stat, stato

integer(2), Dimension (:,:), Allocatable :: test_array
character(120) :: header

allocate (test_array(1:pixels,1:lines))

open(1, file=name_IN, RECL=120, FORM='BINARY', ACCESS='DIRECT',
CONVERT='BIG_ENDIAN', iostat=stato)

read (1,REC=1,iostat=stat) header
read (1,REC=2,iostat=stat) test_array

close (1)

! --> do something...

deallocate (test_array)

end program test

------------------------------------------------------------------------------

That´s why I´m quite sure that the access is direct.
So far my program (as described in the first message) creats a new
file (thanks to the command "open(2, ...)" :-)) but the file is still
empty.:-(
Does anyone have a good solution for my problem?
Thanks a lot!

Crissy

P.S.: Mike, if you would like to I could send you per e-mail a file
containing such an image (as an example).
I didn´t understand what you meant with "show the way it was
written.
.