source: LMDZ5/trunk/libf/bibio/nf95_def_var_m.F90 @ 1856

Last change on this file since 1856 was 1279, checked in by Laurent Fairhead, 15 years ago

Merged LMDZ4-dev branch changes r1241:1278 into the trunk
Running trunk and LMDZ4-dev in LMDZOR configuration on local
machine (sequential) and SX8 (4-proc) yields identical results
(restart and restartphy are identical binarily)
Log history from r1241 to r1278 is available by switching to
source:LMDZ4/branches/LMDZ4-dev-20091210

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.