7 use netcdf,
only: nf90_inquire_attribute, nf90_inquire, &
8 nf90_inq_attname, nf90_global, nf90_max_name, nf90_enotatt, &
43 integer(i_long),
intent(in) :: file_ncdr_id
44 character(len=*),
intent(in) :: attr_name
46 integer(i_long) :: nc_err
48 logical :: attr_exists
52 nc_err = nf90_inquire_attribute(
ncdr_files(file_ncdr_id)%ncid, &
53 nf90_global, attr_name)
56 if (nc_err == nf90_enotatt)
then 62 if (nc_err /= nf90_noerr)
then 70 character(len=*),
intent(in) :: attr_name
72 logical :: attr_exists
80 integer(i_long),
intent(in) :: file_ncdr_id
81 character(len=*),
intent(in) :: attr_name
83 integer(i_long) :: attr_type
88 nf90_global, attr_name, attr_type))
92 character(len=*),
intent(in) :: attr_name
94 integer(i_long) :: attr_type
102 integer(i_long),
intent(in) :: file_ncdr_id
103 character(len=*),
intent(in) :: attr_name
105 integer(i_long) :: attr_len
110 nf90_global, attr_name, len = attr_len))
114 character(len=*),
intent(in) :: attr_name
115 integer(i_long) :: attr_len
123 integer(i_long),
intent(in) :: file_ncdr_id
124 character(len=*),
intent(in) :: attr_name
125 integer(i_long),
intent(out) :: attr_len
130 nf90_global, attr_name, len = attr_len))
134 character(len=*),
intent(in) :: attr_name
135 integer(i_long),
intent(out) :: attr_len
143 integer(i_long),
intent(in) :: file_ncdr_id
144 integer(i_long),
intent(out),
optional :: num_global_attrs
145 integer(i_long),
intent(out),
optional :: attr_name_mlen
146 character(len=:),
intent(inout),
dimension(:),
allocatable,
optional:: attr_names
148 integer(i_long) :: nattrs, attr_index, max_global_attr_name_len
150 character(len=NF90_MAX_NAME) :: attr_name
152 max_global_attr_name_len = 0
158 if (
present(num_global_attrs)) &
159 num_global_attrs = nattrs
162 do attr_index = 1, nattrs
168 if (len_trim(attr_name) > max_global_attr_name_len) &
169 max_global_attr_name_len = len_trim(attr_name)
172 if (
present(attr_name_mlen)) &
173 attr_name_mlen = max_global_attr_name_len
175 if (
present(attr_names))
then 176 if (.NOT.
allocated(attr_names))
then 177 allocate(
character(max_global_attr_name_len) :: attr_names(nattrs))
179 if (
size(attr_names) /= nattrs) &
180 call ncdr_error(
"Invalid allocated array size for attribute names storage!")
181 if (len(attr_names) < max_global_attr_name_len) &
182 call ncdr_error(
"Invalid allocated array size for attribute names storage! (String length does not match!)")
185 do attr_index = 1, nattrs
189 attr_names(attr_index)))
195 integer(i_long),
intent(out),
optional :: num_global_attrs
196 integer(i_long),
intent(out),
optional :: attr_name_mlen
197 character(len=:),
intent(inout),
dimension(:),
allocatable,
optional:: attr_names
integer, parameter, public i_long
integer(i_long) function nc_diag_read_id_ret_global_attr_len(file_ncdr_id, attr_name)
subroutine ncdr_nc_check(status)
integer(i_long) current_ncdr_id
type(ncdr_file), dimension(:), allocatable ncdr_files
subroutine ncdr_check_current_ncdr_id
integer(i_long) function nc_diag_read_noid_get_global_attr_type(attr_name)
logical function nc_diag_read_id_check_global_attr(file_ncdr_id, attr_name)
subroutine nc_diag_read_id_get_global_attr_len(file_ncdr_id, attr_name, attr_len)
subroutine ncdr_check_ncdr_id(file_ncdr_id)
integer(i_long) function nc_diag_read_noid_ret_global_attr_len(attr_name)
integer(i_long) function nc_diag_read_id_get_global_attr_type(file_ncdr_id, attr_name)
subroutine ncdr_error(err)
subroutine nc_diag_read_id_get_global_attr_names(file_ncdr_id, num_global_attrs, attr_name_mlen, attr_names)
logical function nc_diag_read_noid_check_global_attr(attr_name)
subroutine nc_diag_read_noid_get_global_attr_len(attr_name, attr_len)