Subversion Repositories lagranto.wrf

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

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