[4918] | 1 | Attributes |
---|
| 2 | === |
---|
| 3 | |
---|
| 4 | This page describles procedures handling NetCDF attributes. |
---|
| 5 | |
---|
| 6 | See the [improvements page](improvements.md) for an explanation of |
---|
| 7 | the mnemonics "basic change", "interface change", "functionality |
---|
| 8 | change", "additional procedure". |
---|
| 9 | |
---|
| 10 | `nf95_copy_att` |
---|
| 11 | --- |
---|
| 12 | |
---|
| 13 | (basic change) |
---|
| 14 | |
---|
| 15 | subroutine nf95_copy_att(ncid_in, varid_in, name, ncid_out, varid_out, ncerr) |
---|
| 16 | integer, intent( in):: ncid_in, varid_in |
---|
| 17 | character(len=*), intent( in):: name |
---|
| 18 | integer, intent( in):: ncid_out, varid_out |
---|
| 19 | integer, intent(out), optional:: ncerr |
---|
| 20 | |
---|
| 21 | Reference: |
---|
| 22 | [`nf90_copy_att`](https://docs.unidata.ucar.edu/netcdf-fortran/current/f90-attributes.html#f90-copy-attribute-from-one-netcdf-to-another-nf90_copy_att) |
---|
| 23 | |
---|
| 24 | `nf95_get_att` |
---|
| 25 | --- |
---|
| 26 | |
---|
| 27 | (functionality change) |
---|
| 28 | |
---|
| 29 | subroutine nf95_get_att(ncid, varid, name, values, ncerr) |
---|
| 30 | integer, intent( in) :: ncid, varid |
---|
| 31 | character(len = *), intent( in) :: name |
---|
| 32 | character(len = *), integer or real(any kind), intent(out) :: values |
---|
| 33 | integer, intent(out), optional:: ncerr |
---|
| 34 | |
---|
| 35 | `nf95_get_att` is more secure than `nf90_get_att`. For an argument |
---|
| 36 | `values` of type `character`, `nf95_get_att` checks that the `values` |
---|
| 37 | argument is long enough and removes the null terminator, if any. For a |
---|
| 38 | numeric scalar `values` argument, `nf95_get_att` checks that the |
---|
| 39 | attribute contains a single value. |
---|
| 40 | |
---|
| 41 | Reference: |
---|
| 42 | [`nf90_get_att`](https://docs.unidata.ucar.edu/netcdf-fortran/current/f90-attributes.html#f90-get-attributes-values-nf90_get_att) |
---|
| 43 | |
---|
| 44 | `nf95_get_missing` |
---|
| 45 | --- |
---|
| 46 | |
---|
| 47 | (additional procedure) |
---|
| 48 | |
---|
| 49 | ``` |
---|
| 50 | subroutine nf95_get_missing(ncid, varid, missing) |
---|
| 51 | |
---|
| 52 | integer, intent(in):: ncid, varid |
---|
| 53 | |
---|
| 54 | real or double precision or integer or character, intent(out):: missing |
---|
| 55 | ! missing or fill value |
---|
| 56 | ``` |
---|
| 57 | |
---|
| 58 | Returns the `missing_value` attribute if present, else the `_FillValue` |
---|
| 59 | if present, else `nf90_fill_real` or `nf90_fill_double`. |
---|
| 60 | |
---|
| 61 | `nf95_inquire_attribute` |
---|
| 62 | --- |
---|
| 63 | |
---|
| 64 | (interface change) |
---|
| 65 | |
---|
| 66 | ``` |
---|
| 67 | subroutine nf95_inquire_attribute(ncid, varid, name, xtype, nclen, attnum, & |
---|
| 68 | ncerr) |
---|
| 69 | |
---|
| 70 | integer, intent( in) :: ncid, varid |
---|
| 71 | character (len = *), intent( in) :: name |
---|
| 72 | integer, intent(out), optional :: xtype, nclen, attnum |
---|
| 73 | integer, intent(out), optional:: ncerr |
---|
| 74 | ``` |
---|
| 75 | |
---|
| 76 | The argument for the number of values or characters of the attribute is |
---|
| 77 | called `nclen` in `nf95_inquire_attribute`, instead of `len` in |
---|
| 78 | `nf90_inquire_attribute`. `len` is not a good choice for a variable name |
---|
| 79 | because it is the name of a Fortran intrinsic procedure. |
---|
| 80 | |
---|
| 81 | Reference: |
---|
| 82 | [`nf90_inquire_attribute`](https://docs.unidata.ucar.edu/netcdf-fortran/current/f90-attributes.html#f90-get-information-about-an-attribute-nf90_inquire_attribute-and-nf90_inq_attname) |
---|
| 83 | |
---|
| 84 | `nf95_put_att` |
---|
| 85 | --- |
---|
| 86 | |
---|
| 87 | (basic change) |
---|
| 88 | |
---|
| 89 | ``` |
---|
| 90 | subroutine nf95_put_att(ncid, varid, name, values, ncerr) |
---|
| 91 | integer, intent(in) :: ncid, varid |
---|
| 92 | character(len = *), intent(in) :: name |
---|
| 93 | character(len = *) or integer(any kind) or real(any kind), intent(in) :: values |
---|
| 94 | integer, intent(out), optional:: ncerr |
---|
| 95 | ``` |
---|
| 96 | |
---|
| 97 | Reference: |
---|
| 98 | [`nf90_put_att`](https://docs.unidata.ucar.edu/netcdf-fortran/current/f90-attributes.html#f90-create-an-attribute-nf90_put_att) |
---|