source: LMDZ5/trunk/libf/misc/nf95_def_var_m.F90 @ 3682

Last change on this file since 3682 was 1907, checked in by lguez, 11 years ago

Added a copyright property to every file of the distribution, except
for the fcm files (which have their own copyright). Use svn propget on
a file to see the copyright. For instance:

$ svn propget copyright libf/phylmd/physiq.F90
Name of program: LMDZ
Creation date: 1984
Version: LMDZ5
License: CeCILL version 2
Holder: Laboratoire de m\'et\'eorologie dynamique, CNRS, UMR 8539
See the license file in the root directory

Also added the files defining the CeCILL version 2 license, in French
and English, at the top of the LMDZ tree.

  • Property copyright set to
    Name of program: LMDZ
    Creation date: 1984
    Version: LMDZ5
    License: CeCILL version 2
    Holder: Laboratoire de m\'et\'eorologie dynamique, CNRS, UMR 8539
    See the license file in the root directory
File size: 2.8 KB
Line 
1! $Id$
2module nf95_def_var_m
3
4  ! The generic procedure name "nf90_def_var" applies to
5  ! "nf90_def_var_Scalar" but we cannot apply the generic procedure name
6  ! "nf95_def_var" to "nf95_def_var_scalar" because of the additional
7  ! optional argument.
8  ! "nf95_def_var_scalar" cannot be distinguished from "nf95_def_var_oneDim".
9
10  implicit none
11
12  interface nf95_def_var
13    module procedure nf95_def_var_oneDim, nf95_def_var_ManyDims
14  end interface
15
16  private
17  public nf95_def_var, nf95_def_var_scalar
18
19contains
20
21  subroutine nf95_def_var_scalar(ncid, name, xtype, varid, ncerr)
22
23    use netcdf, only: nf90_def_var
24    use handle_err_m, only: handle_err
25
26    integer,               intent( in) :: ncid
27    character (len = *),   intent( in) :: name
28    integer,               intent( in) :: xtype
29    integer,               intent(out) :: varid
30    integer, intent(out), optional:: ncerr
31
32    ! Variable local to the procedure:
33    integer ncerr_not_opt
34
35    !-------------------
36
37    ncerr_not_opt = nf90_def_var(ncid, name, xtype, varid)
38    if (present(ncerr)) then
39       ncerr = ncerr_not_opt
40    else
41       call handle_err("nf95_def_var_scalar " // name, ncerr_not_opt, ncid)
42    end if
43
44  end subroutine nf95_def_var_scalar
45
46  !***********************
47
48  subroutine nf95_def_var_oneDim(ncid, name, xtype, dimids, varid, ncerr)
49
50    use netcdf, only: nf90_def_var
51    use handle_err_m, only: handle_err
52
53    integer,               intent( in) :: ncid
54    character (len = *),   intent( in) :: name
55    integer,               intent( in) :: xtype
56    integer,               intent( in) :: dimids
57    integer,               intent(out) :: varid
58    integer, intent(out), optional:: ncerr
59
60    ! Variable local to the procedure:
61    integer ncerr_not_opt
62
63    !-------------------
64
65    ncerr_not_opt = nf90_def_var(ncid, name, xtype, dimids, varid)
66    if (present(ncerr)) then
67       ncerr = ncerr_not_opt
68    else
69       call handle_err("nf95_def_var_oneDim " // name, ncerr_not_opt, ncid)
70    end if
71
72  end subroutine nf95_def_var_oneDim
73
74  !***********************
75
76  subroutine nf95_def_var_ManyDims(ncid, name, xtype, dimids, varid, ncerr)
77
78    use netcdf, only: nf90_def_var
79    use handle_err_m, only: handle_err
80
81    integer,               intent( in) :: ncid
82    character (len = *),   intent( in) :: name
83    integer,               intent( in) :: xtype
84    integer, dimension(:), intent( in) :: dimids
85    integer,               intent(out) :: varid
86    integer, intent(out), optional:: ncerr
87
88    ! Variable local to the procedure:
89    integer ncerr_not_opt
90
91    !-------------------
92
93    ncerr_not_opt = nf90_def_var(ncid, name, xtype, dimids, varid)
94    if (present(ncerr)) then
95       ncerr = ncerr_not_opt
96    else
97       call handle_err("nf95_def_var_ManyDims " // name, ncerr_not_opt, ncid)
98    end if
99
100  end subroutine nf95_def_var_ManyDims
101
102end module nf95_def_var_m
Note: See TracBrowser for help on using the repository browser.