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
C     ********************************************************************
1
C     ********************************************************************
2
 
2
 
3
      program getvarnames
3
      program getvarnames
4
 
4
 
5
C     ********************************************************************
5
C     ********************************************************************
6
 
6
 
7
      implicit none
7
      implicit none
8
 
8
 
9
      include 'netcdf.inc'
9
      include 'netcdf.inc'
10
 
10
 
11
      integer   ndims,nvars,ngatts,recdim,ierr
11
      integer   ndims,nvars,ngatts,recdim,ierr
12
      integer   vartyp,ndim,nvatts,vardim(4)
12
      integer   vartyp,ndim,nvatts,vardim(4)
13
      integer   cdfid,i
13
      integer   cdfid,i
14
      character*80 cdfname
14
      character*80 cdfname
15
      character*20 vnam(100)
15
      character*20 vnam(100)
16
 
16
 
17
      integer   iargc
17
      integer   iargc
18
      character*(80) arg
18
      character*(80) arg
19
 
19
 
20
c     check for sufficient requested arguments
20
c     check for sufficient requested arguments
21
      if (iargc().ne.1) then
21
      if (iargc().ne.1) then
22
         print*,'USAGE: getvars NetCDF-filename'
22
         print*,'USAGE: getvars NetCDF-filename'
23
         call exit(1)
23
         call exit(1)
24
      endif
24
      endif
25
 
25
 
26
c     read and transform input
26
c     read and transform input
27
      call getarg(1,arg)
27
      call getarg(1,arg)
28
      cdfname=trim(arg)
28
      cdfname=trim(arg)
29
 
29
 
30
      call cdfopn(cdfname,cdfid,ierr)
30
      call cdfopn(cdfname,cdfid,ierr)
31
 
31
 
32
      call getvars(cdfid,nvars,vnam,ierr)
32
      call getvars(cdfid,nvars,vnam,ierr)
33
 
33
 
34
C     Write variable names to output
34
C     Write variable names to output
35
 
35
 
36
      do i=1,nvars
36
      do i=1,nvars
37
        write(*,*)vnam(i)
37
        write(*,*)vnam(i)
38
      enddo
38
      enddo
39
 
39
 
40
C     Close the files
40
C     Close the files
41
 
41
 
42
      call clscdf(cdfid,ierr)
42
      call clscdf(cdfid,ierr)
43
 
43
 
44
      end 
44
      end