source: LMDZ6/trunk/tools/netcdf95/Attributes/nf95_put_att.f90 @ 5353

Last change on this file since 5353 was 5084, checked in by Laurent Fairhead, 5 months ago

Reverting to r4065. Updating fortran standard broke too much stuff. Will do it by smaller chunks
AB, LF

File size: 2.5 KB
RevLine 
[4918]1module nf95_put_att_m
2
[5084]3  use netcdf, only: nf90_put_att
[4918]4  use nf95_abort_m, only: nf95_abort
5  use nf95_constants, only: nf95_noerr
6
7  implicit none
8
9  interface nf95_put_att
10     module procedure nf95_put_att_text, nf95_put_att_one_FourByteInt, &
11          nf95_put_att_one_FourByteReal
12  end interface nf95_put_att
13
14  private
15  public nf95_put_att
16
17contains
18
19  subroutine nf95_put_att_text(ncid, varid, name, values, ncerr)
20
21    integer, intent(in) :: ncid, varid
22    character(len = *), intent(in) :: name
23    character(len = *), intent(in) :: values
24    integer, intent(out), optional:: ncerr
25
26    ! Variable local to the procedure:
27    integer ncerr_not_opt
28
29    !-------------------
30
31    ncerr_not_opt = nf90_put_att(ncid, varid, name, values)
32
33    if (present(ncerr)) then
34       ncerr = ncerr_not_opt
35    else
36       if (ncerr_not_opt /= nf95_noerr) call nf95_abort("nf95_put_att_text " &
37            // trim(name), ncerr_not_opt, ncid, varid)
38    end if
39
40  end subroutine nf95_put_att_text
41
42  !************************************
43
44  subroutine nf95_put_att_one_FourByteInt(ncid, varid, name, values, ncerr)
45
46    use typesizes, only: FourByteInt
47
48    integer, intent(in) :: ncid, varid
49    character(len = *), intent(in) :: name
50    integer(kind = FourByteInt), intent(in) :: values
51    integer, intent(out), optional:: ncerr
52
53    ! Variable local to the procedure:
54    integer ncerr_not_opt
55
56    !-------------------
57
58    ncerr_not_opt = nf90_put_att(ncid, varid, name, values)
59
60    if (present(ncerr)) then
61       ncerr = ncerr_not_opt
62    else
63       if (ncerr_not_opt /= nf95_noerr) call &
64            nf95_abort("nf95_put_att_one_FourByteInt " // trim(name), &
65            ncerr_not_opt, ncid, varid)
66    end if
67
68  end subroutine nf95_put_att_one_FourByteInt
69
70  !************************************
71
72  subroutine nf95_put_att_one_FourByteReal(ncid, varid, name, values, ncerr)
73
74    use typesizes, only: FourByteReal
75
76    integer, intent(in) :: ncid, varid
77    character(len = *), intent(in) :: name
78    real(kind = FourByteReal), intent(in) :: values
79    integer, intent(out), optional:: ncerr
80
81    ! Variable local to the procedure:
82    integer ncerr_not_opt
83
84    !-------------------
85
86    ncerr_not_opt = nf90_put_att(ncid, varid, name, values)
87
88    if (present(ncerr)) then
89       ncerr = ncerr_not_opt
90    else
91       if (ncerr_not_opt /= nf95_noerr) call &
92            nf95_abort("nf95_put_att_one_FourByteReal " // trim(name), &
93            ncerr_not_opt, ncid, varid)
94    end if
95
96  end subroutine nf95_put_att_one_FourByteReal
97
98end module nf95_put_att_m
Note: See TracBrowser for help on using the repository browser.