      implicit none

      integer,parameter :: mx=360
      integer,parameter :: my=181

      real :: values(mx,my),results(mx,my)
      integer :: vari(7),id,i,j,iyear,imonth,iday,ihour
      character(len=70) :: snd(2),sno(2),input,model
      character(len=3) :: sea

      data snd /'_Hs_','.txt'/
      data sno /'_Hs_Max_','.txt'/

      call get_command_argument(1,input)
      read(input,*) model
      call get_command_argument(2,input)
      read(input,*) sea

      open(3,file=trim(model)//trim(snd(1))//
     & trim(sea)//trim(snd(2)))

      results=-2000.
      print*,trim(model)//trim(sno(1))//
     & trim(sea)//trim(sno(2))

      do
         read(3,'(i6,3i4.2)',end=99) iyear,imonth,iday,ihour
         read(3,'(10f9.3)')((values(i,j),i=1,mx),j=1,my)
         do j=1,my
            do i=1,mx
               if(values(i,j).gt.results(i,j)) then
                  results(i,j)=values(i,j)
               endif
            enddo
         enddo
      enddo

99    open(2,file=trim(model)//trim(sno(1))//
     & trim(sea)//trim(sno(2)))

      write(2,'(10f9.3)') ((results(i,j),i=1,mx),j=1,my)

      close(3)
      close(2)
      end
