Subversion Repositories lagranto.icon

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
3 michaesp 1
      program getvarnames
2
 
3
c     ***********************************************************************
4
c     * Get list of variables on netCDF file                                *
5
c     * Michael Sprenger / Spring, summer 2016                              *
6
c     ***********************************************************************
7
 
8
      use netcdf
9
 
10
      implicit none
11
 
12
      integer      nvars,ierr
13
      integer      cdfid,i
14
      character*80 cdfname
15
      character*80 vnam(200)
16
 
17
      integer   iargc
18
      character*(80) arg
19
 
20
c     check for sufficient requested arguments
21
      if (iargc().ne.1) then
22
         print*,'USAGE: getvars NetCDF-filename'
23
         call exit(1)
24
      endif
25
 
26
c     read and transform input
27
      call getarg(1,arg)
28
      cdfname=trim(arg)
29
 
30
c     Get list and write to standard out      
31
      call input_open    (cdfid,cdfname)
32
      call input_getvars (cdfid,vnam,nvars)
33
      call input_close   (cdfid)
34
      do i=1,nvars
35
        write(*,*)  " ",trim(vnam(i))," "
36
      enddo
37
 
38
      end