3 |
michaesp |
1 |
PROGRAM lsl2list
|
|
|
2 |
|
|
|
3 |
c ***********************************************************************
|
|
|
4 |
c * Convert a trajectory file into a lat/lon/p list *
|
|
|
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 stat
|
|
|
29 |
integer fid
|
|
|
30 |
integer i,j
|
|
|
31 |
|
|
|
32 |
c ----------------------------------------------------------------------
|
|
|
33 |
c Do the reformating
|
|
|
34 |
c ----------------------------------------------------------------------
|
|
|
35 |
|
|
|
36 |
c Read parameters
|
|
|
37 |
open(10,file='lsl2list.param')
|
|
|
38 |
read(10,*) inpfile
|
|
|
39 |
read(10,*) outfile
|
|
|
40 |
read(10,*) ntra,ntim,ncol
|
|
|
41 |
close(10)
|
|
|
42 |
|
|
|
43 |
c Determine the formats
|
|
|
44 |
call mode_tra(inpmode,inpfile)
|
|
|
45 |
if (inpmode.eq.-1) inpmode=1
|
|
|
46 |
|
|
|
47 |
c Allocate memory
|
|
|
48 |
allocate(tra(ntra,ntim,ncol),stat=stat)
|
|
|
49 |
if (stat.ne.0) print*,'*** error allocating array tra ***'
|
|
|
50 |
|
|
|
51 |
c Read inpufile
|
|
|
52 |
call ropen_tra(fid,inpfile,ntra,ntim,ncol,refdate,vars,inpmode)
|
|
|
53 |
call read_tra (fid,tra,ntra,ntim,ncol,inpmode)
|
|
|
54 |
call close_tra(fid,inpmode)
|
|
|
55 |
|
|
|
56 |
c Write output file inpufile
|
|
|
57 |
fid = 10
|
|
|
58 |
open(fid,file=outfile)
|
|
|
59 |
do i=1,ntra
|
|
|
60 |
do j=1,ntim
|
|
|
61 |
write(fid,'(f9.2,f8.2,i6)')
|
|
|
62 |
> tra(i,j,2),tra(i,j,3),nint(tra(i,j,4))
|
|
|
63 |
enddo
|
|
|
64 |
enddo
|
|
|
65 |
close(fid)
|
|
|
66 |
|
|
|
67 |
end
|
|
|
68 |
|
|
|
69 |
|
|
|
70 |
|
|
|
71 |
|