29 field_dimension_sizes, &
34 character(len=*),
intent(in) :: filename
35 character(len=*),
intent(in) :: fieldname
36 integer,
dimension(:),
intent(inout) :: field_dimension_sizes
37 type(domainug),
intent(in) :: domain
39 logical,
intent(out),
optional :: field_found
43 type(domainug),
pointer :: io_domain
44 integer(INT_KIND) :: io_domain_npes
45 integer(INT_KIND),
dimension(:),
allocatable :: pelist
46 integer(INT_KIND) :: funit
47 integer(INT_KIND) :: num_axes
49 integer(INT_KIND) :: num_fields
51 integer(INT_KIND) :: num_atts
53 integer(INT_KIND) :: num_time_levels
55 type(fieldtype),
dimension(max_fields) :: file_fields
57 logical(INT_KIND) :: found
58 character(len=128) :: file_field_name
59 integer(INT_KIND) :: file_field_ndim
61 type(axistype),
dimension(max_fields) :: file_field_axes
63 character(len=128) :: file_axis_name
64 integer(INT_KIND) :: file_axis_size
65 integer(INT_KIND) :: i
66 integer(INT_KIND) :: j
71 io_domain => mpp_get_ug_io_domain(domain)
74 io_domain_npes = mpp_get_ug_domain_npes(io_domain)
75 allocate(pelist(io_domain_npes))
76 call mpp_get_ug_domain_pelist(io_domain, &
87 if (
mpp_pe() .eq. pelist(1))
then
99 if (num_fields .gt. max_fields)
then
100 call mpp_error(fatal, &
101 "fms_io_unstructured_get_field_size:" &
102 //
" the number of fields in the file " &
103 //trim(filename)//
" exceeds the maximum number" &
104 //
" of fields allowed per file (max_fields)")
109 file_fields(1:num_fields))
115 field_dimension_sizes = -1
117 call mpp_get_atts(file_fields(i), &
118 name=file_field_name)
119 if (lowercase(trim(file_field_name)) .eq. &
120 lowercase(trim(fieldname)))
then
121 call mpp_get_atts(file_fields(i), &
122 ndim=file_field_ndim)
123 call mpp_get_atts(file_fields(i), &
124 axes=file_field_axes(1:file_field_ndim))
125 do j = 1,file_field_ndim
126 call mpp_get_atts(file_field_axes(j), &
127 len=field_dimension_sizes(j))
137 if (.not. found)
then
139 file_field_axes(1:num_axes))
141 call mpp_get_atts(file_field_axes(i), &
142 name=file_axis_name, &
144 if (lowercase(trim(file_axis_name)) .eq. &
145 lowercase(trim(fieldname)))
then
146 field_dimension_sizes(1) = file_axis_size
157 if (
mpp_pe() .eq. pelist(1))
then
158 do i = 2,io_domain_npes
159 call mpp_send(found, &
162 call mpp_send(field_dimension_sizes, &
163 size(field_dimension_sizes), &
169 call mpp_recv(found, &
173 call mpp_recv(field_dimension_sizes, &
174 size(field_dimension_sizes), &
185 if (
present(field_found))
then
187 elseif (.not. found)
then
188 call mpp_error(fatal, &
189 "fms_io_unstructured_get_field_size:" &
190 //
" the inputted field "//trim(fieldname) &
191 //
" was not found in the file "//trim(filename))
subroutine fms_io_unstructured_get_field_size(filename, fieldname, field_dimension_sizes, domain, field_found)
Get the size of the dimensions of a field from a file associated with an unstructured mpp domain.
subroutine fms_io_unstructured_file_unit(filename, funit, domain)
Find the file unit for an inputted file, searching for its variants. If the file is not found,...
subroutine mpp_get_info(unit, ndim, nvar, natt, ntime)
Get some general information about a file.
subroutine mpp_get_fields(unit, variables)
Copy variable information from file (excluding data)
subroutine mpp_get_axes(unit, axes, time_axis)
Copy variable information from file (excluding data)
subroutine mpp_sync_self(pelist, check, request, msg_size, msg_type)
This is to check if current PE's outstanding puts are complete but we can't use shmem_fence because w...
integer function mpp_pe()
Returns processor ID.