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 14
1
      PROGRAM list2lsl
1
      PROGRAM list2lsl
2
      
2
      
3
c     ***********************************************************************
3
c     ***********************************************************************
4
c     * Convert a lat/lon/p list to a trajectory file                       *
4
c     * Convert a lat/lon/p list to a trajectory file                       *
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
      real                                   timevalue   ! Time 
25
      real                                   timevalue   ! Time 
26
 
26
 
27
c     Auxiliary variables
27
c     Auxiliary variables
28
      integer                                inpmode
28
      integer                                inpmode
29
      integer                                outmode
29
      integer                                outmode
30
      integer                                stat
30
      integer                                stat
31
      integer                                fid
31
      integer                                fid
32
      integer                                i
32
      integer                                i
33
      
33
      
34
c     ----------------------------------------------------------------------
34
c     ----------------------------------------------------------------------
35
c     Do the reformating
35
c     Do the reformating
36
c     ----------------------------------------------------------------------
36
c     ----------------------------------------------------------------------
37
 
37
 
38
c     Read parameters
38
c     Read parameters
39
      open(10,file='list2lsl.param')
39
      open(10,file='list2lsl.param')
40
       read(10,*) inpfile
40
       read(10,*) inpfile
41
       read(10,*) outfile
41
       read(10,*) outfile
42
       read(10,*) ntra
42
       read(10,*) ntra
43
       read(10,*) (refdate(i),i=1,6)
43
       read(10,*) (refdate(i),i=1,6)
44
       read(10,*) timevalue
44
       read(10,*) timevalue
45
      close(10)
45
      close(10)
46
      
46
      
47
c     Determine the formats
47
c     Determine the formats
48
      call mode_tra(outmode,outfile)
48
      call mode_tra(outmode,outfile)
49
      if (outmode.eq.-1) outmode=1
49
      if (outmode.eq.-1) outmode=1
50
 
50
 
51
c     Set parameters for output file
51
c     Set parameters for output file
52
      ntim=1
52
      ntim=1
53
      ncol=4
53
      ncol=4
54
      vars(1)='time'
54
      vars(1)='time'
55
      vars(2)='lon'
55
      vars(2)='lon'
56
      vars(3)='lat'
56
      vars(3)='lat'
57
      vars(4)='p'
57
      vars(4)='p'
58
 
58
 
59
c     Allocate memory
59
c     Allocate memory
60
      allocate(tra(ntra,ntim,ncol),stat=stat)
60
      allocate(tra(ntra,ntim,ncol),stat=stat)
61
      if (stat.ne.0) print*,'*** error allocating array tra      ***' 
61
      if (stat.ne.0) print*,'*** error allocating array tra      ***' 
62
 
62
 
63
c     Read inpufile
63
c     Read inpufile
64
      fid = 10
64
      fid = 10
65
      open(fid,file=inpfile)
65
      open(fid,file=inpfile)
66
       do i=1,ntra
66
       do i=1,ntra
67
          tra(i,1,1) = timevalue
67
          tra(i,1,1) = timevalue
68
          read(fid,*) tra(i,1,2),tra(i,1,3),tra(i,1,4)
68
          read(fid,*) tra(i,1,2),tra(i,1,3),tra(i,1,4)
69
       enddo
69
       enddo
70
      close(fid)
70
      close(fid)
71
 
71
 
72
c     Write output file
72
c     Write output file
73
      call wopen_tra(fid,outfile,ntra,ntim,ncol,refdate,vars,outmode)
73
      call wopen_tra(fid,outfile,ntra,ntim,ncol,refdate,vars,outmode)
74
      call write_tra(fid,tra,ntra,ntim,ncol,outmode)
74
      call write_tra(fid,tra,ntra,ntim,ncol,outmode)
75
      call close_tra(fid,outmode)
75
      call close_tra(fid,outmode)
76
      
76
      
77
      end
77
      end
78
 
78
 
79
      
79
      
80
 
80
 
81
      
81