Subversion Repositories lagranto.ecmwf

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
3 michaesp 1
      program changetime
2
 
3
C     Changes the time value of a NetCDF file.
4
 
5
 
6
C-----declarations------------------------------------------------
7
 
8
      integer   ierr,ntimes
9
      real      tstart,time
10
      integer   cdfid,varid
11
      character*30  filnam
12
 
13
C-----start of program--------------------------------------------
14
 
15
      include 'netcdf.inc'
16
 
17
      call ncpopt(NCVERBOS)
18
 
19
      read(9,10)filnam
20
   10 format(a30)
21
      read(9,*)time
22
 
23
C     Open the data file
24
 
25
      cdfid=ncopn(filnam,NCWRITE,ierr)
26
 
27
C     Get time value from file
28
 
29
      call gettimes(cdfid,tstart,ntimes,ierr)
30
 
31
C     Get index for time variable
32
 
33
      varid=ncvid(cdfid,'time',ierr)
34
 
35
C     Overwrite time-value
36
 
37
      call ncvpt1(cdfid,varid,1,time,ierr)
38
 
39
      write(*,20)'file ',trim(filnam),' time value changed from ',
40
     >           tstart,' to ',time
41
   20 format(a,a,a,f8.2,a,f8.2)
42
 
43
C     Close open NetCDF files
44
 
45
      call clscdf(cdfid,ierr)
46
 
47
      end