Subversion Repositories lagranto.ecmwf

Rev

Rev 21 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
3 michaesp 1
      program getvarnames
21 michaesp 2
 
3
c     ***********************************************************************
4
c     * Get list of variables on netCDF file                                *
5
c     * Michael Sprenger / Spring, summer 2016                              *
6
c     ***********************************************************************
3 michaesp 7
 
21 michaesp 8
      use netcdf
9
 
3 michaesp 10
      implicit none
11
 
21 michaesp 12
      integer      nvars,ierr
13
      integer      cdfid,i
3 michaesp 14
      character*80 cdfname
21 michaesp 15
      character*80 vnam(200)
3 michaesp 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)
21 michaesp 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)
3 michaesp 34
      do i=1,nvars
38 michaesp 35
        write(*,*)  " ",trim(vnam(i))," "
3 michaesp 36
      enddo
37
 
38
      end