| 1 | ! $Id$ |
|---|
| 2 | module nf95_put_att_m |
|---|
| 3 | |
|---|
| 4 | implicit none |
|---|
| 5 | |
|---|
| 6 | interface nf95_put_att |
|---|
| 7 | module procedure nf95_put_att_text, nf95_put_att_one_FourByteInt |
|---|
| 8 | end interface |
|---|
| 9 | |
|---|
| 10 | private |
|---|
| 11 | public nf95_put_att |
|---|
| 12 | |
|---|
| 13 | contains |
|---|
| 14 | |
|---|
| 15 | subroutine nf95_put_att_text(ncid, varid, name, values, ncerr) |
|---|
| 16 | |
|---|
| 17 | use netcdf, only: nf90_put_att |
|---|
| 18 | use handle_err_m, only: handle_err |
|---|
| 19 | |
|---|
| 20 | integer, intent(in) :: ncid, varid |
|---|
| 21 | character(len = *), intent(in) :: name |
|---|
| 22 | character(len = *), intent(in) :: values |
|---|
| 23 | integer, intent(out), optional:: ncerr |
|---|
| 24 | |
|---|
| 25 | ! Variable local to the procedure: |
|---|
| 26 | integer ncerr_not_opt |
|---|
| 27 | |
|---|
| 28 | !------------------- |
|---|
| 29 | |
|---|
| 30 | ncerr_not_opt = nf90_put_att(ncid, varid, name, values) |
|---|
| 31 | if (present(ncerr)) then |
|---|
| 32 | ncerr = ncerr_not_opt |
|---|
| 33 | else |
|---|
| 34 | call handle_err("nf95_put_att_text", ncerr_not_opt, ncid, varid) |
|---|
| 35 | end if |
|---|
| 36 | |
|---|
| 37 | end subroutine nf95_put_att_text |
|---|
| 38 | |
|---|
| 39 | !************************************ |
|---|
| 40 | |
|---|
| 41 | subroutine nf95_put_att_one_FourByteInt(ncid, varid, name, values, ncerr) |
|---|
| 42 | |
|---|
| 43 | use netcdf, only: nf90_put_att |
|---|
| 44 | use handle_err_m, only: handle_err |
|---|
| 45 | use typesizes, only: FourByteInt |
|---|
| 46 | |
|---|
| 47 | integer, intent(in) :: ncid, varid |
|---|
| 48 | character(len = *), intent(in) :: name |
|---|
| 49 | integer(kind = FourByteInt), intent(in) :: values |
|---|
| 50 | integer, intent(out), optional:: ncerr |
|---|
| 51 | |
|---|
| 52 | ! Variable local to the procedure: |
|---|
| 53 | integer ncerr_not_opt |
|---|
| 54 | |
|---|
| 55 | !------------------- |
|---|
| 56 | |
|---|
| 57 | ncerr_not_opt = nf90_put_att(ncid, varid, name, values) |
|---|
| 58 | if (present(ncerr)) then |
|---|
| 59 | ncerr = ncerr_not_opt |
|---|
| 60 | else |
|---|
| 61 | call handle_err("nf95_put_att_one_FourByteInt", ncerr_not_opt, ncid, & |
|---|
| 62 | varid) |
|---|
| 63 | end if |
|---|
| 64 | |
|---|
| 65 | end subroutine nf95_put_att_one_FourByteInt |
|---|
| 66 | |
|---|
| 67 | end module nf95_put_att_m |
|---|