Subversion Repositories lagranto.20cr

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
4 michaesp 1
      PROGRAM reformat
2
 
3
c     ***********************************************************************
4
c     * Change format of 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
 
26
c     Auxiliary variables
27
      integer                                inpmode
28
      integer                                outmode
29
      integer                                stat
30
      integer                                fid
31
      integer                                i
32
 
33
c     ----------------------------------------------------------------------
34
c     Do the reformating
35
c     ----------------------------------------------------------------------
36
 
37
c     Read parameters
38
      open(10,file='reformat.param')
39
       read(10,*) inpfile
40
       read(10,*) outfile
41
       read(10,*) ntra,ntim,ncol
42
      close(10)
43
 
44
c     Determine the formats
45
      call mode_tra(inpmode,inpfile)
46
      if (inpmode.eq.-1) inpmode=1
47
      call mode_tra(outmode,outfile)
48
      if (outmode.eq.-1) outmode=1
49
 
50
c     Allocate memory
51
      allocate(tra(ntra,ntim,ncol),stat=stat)
52
      if (stat.ne.0) print*,'*** error allocating array tra      ***' 
53
 
54
c     Read inpufile
55
      call ropen_tra(fid,inpfile,ntra,ntim,ncol,refdate,vars,inpmode)
56
      call read_tra (fid,tra,ntra,ntim,ncol,inpmode)
57
      call close_tra(fid,inpmode)
58
 
59
c     Write output file
60
      call wopen_tra(fid,outfile,ntra,ntim,ncol,refdate,vars,outmode)
61
      call write_tra(fid,tra,ntra,ntim,ncol,outmode)
62
      call close_tra(fid,outmode)
63
 
64
      end
65
 
66
 
67
 
68