Subversion Repositories lagranto.um

Rev

Rev 3 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3 Rev 12
1
      PROGRAM lsl2list
1
      PROGRAM lsl2list
2
      
2
      
3
c     ***********************************************************************
3
c     ***********************************************************************
4
c     * Convert a trajectory file into a lat/lon/p list                     *
4
c     * Convert a trajectory file into a lat/lon/p list                     *
5
c     * Michael Sprenger / Spring, summer 2010                              *
5
c     * Michael Sprenger / Spring, summer 2010                              *
6
c     ***********************************************************************
6
c     ***********************************************************************
7
 
7
 
8
      implicit none
8
      implicit none
9
      
9
      
10
c     ----------------------------------------------------------------------
10
c     ----------------------------------------------------------------------
11
c     Declaration of variables
11
c     Declaration of variables
12
c     ----------------------------------------------------------------------
12
c     ----------------------------------------------------------------------
13
 
13
 
14
c     Input and output format for trajectories (see iotra.f)
14
c     Input and output format for trajectories (see iotra.f)
15
      character*80                           inpfile     ! Input filename
15
      character*80                           inpfile     ! Input filename
16
      character*80                           outfile     ! Output filename
16
      character*80                           outfile     ! Output filename
17
 
17
 
18
c     Trajectories
18
c     Trajectories
19
      integer                                ntra        ! Number of trajectories
19
      integer                                ntra        ! Number of trajectories
20
      integer                                ntim        ! Number of times
20
      integer                                ntim        ! Number of times
21
      integer                                ncol        ! Number of columns
21
      integer                                ncol        ! Number of columns
22
      real,allocatable, dimension (:,:,:) :: tra         ! Trajectories (ntra,ntim,ncol)
22
      real,allocatable, dimension (:,:,:) :: tra         ! Trajectories (ntra,ntim,ncol)
23
      character*80                           vars(100)   ! Variable names
23
      character*80                           vars(100)   ! Variable names
24
      integer                                refdate(6)  ! Reference date
24
      integer                                refdate(6)  ! Reference date
25
 
25
 
26
c     Auxiliary variables
26
c     Auxiliary variables
27
      integer                                inpmode
27
      integer                                inpmode
28
      integer                                stat
28
      integer                                stat
29
      integer                                fid
29
      integer                                fid
30
      integer                                i,j
30
      integer                                i,j
31
      
31
      
32
c     ----------------------------------------------------------------------
32
c     ----------------------------------------------------------------------
33
c     Do the reformating
33
c     Do the reformating
34
c     ----------------------------------------------------------------------
34
c     ----------------------------------------------------------------------
35
 
35
 
36
c     Read parameters
36
c     Read parameters
37
      open(10,file='lsl2list.param')
37
      open(10,file='lsl2list.param')
38
       read(10,*) inpfile
38
       read(10,*) inpfile
39
       read(10,*) outfile
39
       read(10,*) outfile
40
       read(10,*) ntra,ntim,ncol
40
       read(10,*) ntra,ntim,ncol
41
      close(10)
41
      close(10)
42
      
42
      
43
c     Determine the formats
43
c     Determine the formats
44
      call mode_tra(inpmode,inpfile)
44
      call mode_tra(inpmode,inpfile)
45
      if (inpmode.eq.-1) inpmode=1
45
      if (inpmode.eq.-1) inpmode=1
46
 
46
 
47
c     Allocate memory
47
c     Allocate memory
48
      allocate(tra(ntra,ntim,ncol),stat=stat)
48
      allocate(tra(ntra,ntim,ncol),stat=stat)
49
      if (stat.ne.0) print*,'*** error allocating array tra      ***' 
49
      if (stat.ne.0) print*,'*** error allocating array tra      ***' 
50
 
50
 
51
c     Read inpufile
51
c     Read inpufile
52
      call ropen_tra(fid,inpfile,ntra,ntim,ncol,refdate,vars,inpmode)
52
      call ropen_tra(fid,inpfile,ntra,ntim,ncol,refdate,vars,inpmode)
53
      call read_tra (fid,tra,ntra,ntim,ncol,inpmode)
53
      call read_tra (fid,tra,ntra,ntim,ncol,inpmode)
54
      call close_tra(fid,inpmode)
54
      call close_tra(fid,inpmode)
55
 
55
 
56
c     Write output file inpufile
56
c     Write output file inpufile
57
      fid = 10
57
      fid = 10
58
      open(fid,file=outfile)
58
      open(fid,file=outfile)
59
       do i=1,ntra
59
       do i=1,ntra
60
          do j=1,ntim
60
          do j=1,ntim
61
             write(fid,'(f9.2,f8.2,i6)') 
61
             write(fid,'(f9.2,f8.2,i6)') 
62
     >               tra(i,j,2),tra(i,j,3),nint(tra(i,j,4))
62
     >               tra(i,j,2),tra(i,j,3),nint(tra(i,j,4))
63
          enddo
63
          enddo
64
       enddo
64
       enddo
65
      close(fid)
65
      close(fid)
66
 
66
 
67
      end
67
      end
68
 
68
 
69
      
69
      
70
 
70
 
71
      
71