/[lmdze]/trunk/IOIPSL/Histcom/histclo.f
ViewVC logotype

Contents of /trunk/IOIPSL/Histcom/histclo.f

Parent Directory Parent Directory | Revision Log Revision Log


Revision 134 - (show annotations)
Wed Apr 29 15:47:56 2015 UTC (9 years, 1 month ago) by guez
Original Path: trunk/Sources/IOIPSL/Histcom/histclo.f
File size: 1082 byte(s)
Sources inside, compilation outside.
1 module histclo_m
2
3 implicit none
4
5 contains
6
7 SUBROUTINE histclo(fid)
8
9 ! This subroutine will close the file corresponding
10 ! to the argument, if the argument is present. Else it will close
11 ! all opened files.
12
13 USE errioipsl, ONLY: histerr
14 USE histcom_var, ONLY: nb_files, ncdf_ids
15 USE netcdf, ONLY: nf90_close, nf90_noerr
16
17 INTEGER, INTENT (IN), OPTIONAL:: fid ! file id
18
19 ! Variables local to the procedure:
20 INTEGER ifile, ncid, iret
21 INTEGER start_loop, end_loop
22 CHARACTER(len=70) str70
23
24 !---------------------------------------------------------------------
25
26 IF (present(fid)) THEN
27 start_loop = fid
28 end_loop = fid
29 ELSE
30 start_loop = 1
31 end_loop = nb_files
32 END IF
33
34 DO ifile = start_loop, end_loop
35 ncid = ncdf_ids(ifile)
36 iret = nf90_close(ncid)
37 IF (iret/=nf90_noerr) THEN
38 WRITE(str70, '("This file has already been closed:", I3)') ifile
39 CALL histerr(2, 'histclo', str70, '', '')
40 END IF
41 END DO
42
43 END SUBROUTINE histclo
44
45 end module histclo_m

  ViewVC Help
Powered by ViewVC 1.1.21