8 use netcdf,
only: nf90_inquire_attribute, nf90_inquire_variable, &
9 nf90_inq_attname, nf90_enotatt, nf90_noerr, nf90_max_name
40 integer(i_long),
intent(in) :: file_ncdr_id
41 character(len=*),
intent(in) :: var_name
42 character(len=*),
intent(in) :: attr_name
44 integer(i_long) :: var_id, nc_err
46 logical :: attr_exists
53 nc_err = nf90_inquire_attribute(
ncdr_files(file_ncdr_id)%ncid, &
57 if (nc_err == nf90_enotatt)
then 63 if (nc_err /= nf90_noerr)
then 71 character(len=*),
intent(in) :: var_name
72 character(len=*),
intent(in) :: attr_name
74 logical :: attr_exists
82 integer(i_long),
intent(in) :: file_ncdr_id
83 character(len=*),
intent(in) :: var_name
84 character(len=*),
intent(in) :: attr_name
86 integer(i_long) :: var_id, attr_type
94 var_id, attr_name, attr_type))
98 character(len=*),
intent(in) :: var_name
99 character(len=*),
intent(in) :: attr_name
101 integer(i_long) :: attr_type
109 integer(i_long),
intent(in) :: file_ncdr_id
110 character(len=*),
intent(in) :: var_name
111 character(len=*),
intent(in) :: attr_name
113 integer(i_long) :: var_id
114 integer(i_long) :: attr_len
122 var_id, attr_name, len = attr_len))
126 character(len=*),
intent(in) :: var_name
127 character(len=*),
intent(in) :: attr_name
128 integer(i_long) :: attr_len
136 integer(i_long),
intent(in) :: file_ncdr_id
137 character(len=*),
intent(in) :: var_name
138 character(len=*),
intent(in) :: attr_name
139 integer(i_long),
intent(out) :: attr_len
141 integer(i_long) :: var_id
149 var_id, attr_name, len = attr_len))
153 character(len=*),
intent(in) :: var_name
154 character(len=*),
intent(in) :: attr_name
155 integer(i_long),
intent(out) :: attr_len
163 integer(i_long),
intent(in) :: file_ncdr_id
164 character(len=*),
intent(in) :: var_name
165 integer(i_long),
intent(out),
optional :: num_attrs
166 integer(i_long),
intent(out),
optional :: attr_name_mlen
167 character(len=:),
intent(inout),
dimension(:),
allocatable,
optional:: attr_names
169 integer(i_long) :: var_id, nattrs, attr_index, max_attr_name_len
171 character(len=NF90_MAX_NAME) :: attr_name
173 max_attr_name_len = 0
180 var_id, natts = nattrs))
182 if (
present(num_attrs)) &
186 do attr_index = 1, nattrs
192 if (len_trim(attr_name) > max_attr_name_len) &
193 max_attr_name_len = len_trim(attr_name)
196 if (
present(attr_name_mlen)) &
197 attr_name_mlen = max_attr_name_len
199 if (
present(attr_names))
then 200 if (.NOT.
allocated(attr_names))
then 201 allocate(
character(max_attr_name_len) :: attr_names(nattrs))
203 if (
size(attr_names) /= nattrs) &
204 call ncdr_error(
"Invalid allocated array size for attribute names storage!")
205 if (len(attr_names) < max_attr_name_len) &
206 call ncdr_error(
"Invalid allocated array size for attribute names storage! (String length does not match!)")
209 do attr_index = 1, nattrs
213 attr_names(attr_index)))
219 character(len=*),
intent(in) :: var_name
220 integer(i_long),
intent(out),
optional :: num_attrs
221 integer(i_long),
intent(out),
optional :: attr_name_mlen
222 character(len=:),
intent(inout),
dimension(:),
allocatable,
optional:: attr_names
integer(i_long) function nc_diag_read_noid_get_attr_type(var_name, attr_name)
integer, parameter, public i_long
subroutine ncdr_nc_check(status)
logical function nc_diag_read_id_check_attr(file_ncdr_id, var_name, attr_name)
integer(i_long) current_ncdr_id
type(ncdr_file), dimension(:), allocatable ncdr_files
subroutine ncdr_check_current_ncdr_id
subroutine nc_diag_read_noid_get_attr_names(var_name, num_attrs, attr_name_mlen, attr_names)
subroutine nc_diag_read_noid_get_attr_len(var_name, attr_name, attr_len)
integer(i_long) function nc_diag_read_id_ret_attr_len(file_ncdr_id, var_name, attr_name)
integer(i_long) function nc_diag_read_id_get_attr_type(file_ncdr_id, var_name, attr_name)
subroutine ncdr_check_ncdr_id(file_ncdr_id)
subroutine nc_diag_read_id_get_attr_names(file_ncdr_id, var_name, num_attrs, attr_name_mlen, attr_names)
subroutine ncdr_error(err)
integer(i_long) function nc_diag_read_noid_ret_attr_len(var_name, attr_name)
subroutine nc_diag_read_id_get_attr_len(file_ncdr_id, var_name, attr_name, attr_len)
logical function nc_diag_read_noid_check_attr(var_name, attr_name)