Subversion Repositories lagranto.ecmwf

Rev

Rev 13 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 13 Rev 21
1
C     ********************************************************************
-
 
2
 
-
 
3
      program getvarnames
1
      program getvarnames
-
 
2
      
-
 
3
c     ***********************************************************************
-
 
4
c     * Get list of variables on netCDF file                                *
-
 
5
c     * Michael Sprenger / Spring, summer 2016                              *
-
 
6
c     ***********************************************************************
4
 
7
 
5
C     ********************************************************************
8
      use netcdf
6
 
9
      
7
      implicit none
10
      implicit none
8
 
11
 
9
      include 'netcdf.inc'
-
 
10
 
-
 
11
      integer   ndims,nvars,ngatts,recdim,ierr
12
      integer      nvars,ierr
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*80 vnam(100)
15
      character*80 vnam(200)
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
c     Get list and write to standard out      
30
      call cdfopn(cdfname,cdfid,ierr)
31
      call input_open    (cdfid,cdfname)
31
 
-
 
32
      call getvars(cdfid,nvars,vnam,ierr)
32
      call input_getvars (cdfid,vnam,nvars)
33
 
-
 
34
C     Write variable names to output
33
      call input_close   (cdfid)
35
 
-
 
36
      do i=1,nvars
34
      do i=1,nvars
37
        write(*,*)vnam(i)
35
        write(*,*)  vnam(i)
38
      enddo
36
      enddo
39
 
37
 
40
C     Close the files
-
 
41
 
-
 
42
      call clscdf(cdfid,ierr)
-
 
43
 
-
 
44
      end 
38
      end