@@ -28,7 +28,8 @@ module read_climate_nudge_data_mod
28
28
get_dimension_names, get_dimension_size, FmsNetcdfFile_t, &
29
29
get_num_variables, get_variable_names, get_variable_size, &
30
30
get_variable_num_dimensions, get_variable_units, &
31
- get_time_calendar, read_data, variable_att_exists
31
+ get_time_calendar, read_data, variable_att_exists, &
32
+ is_dimension_unlimited
32
33
use mpp_mod, only: input_nml_file, mpp_npes, mpp_get_current_pelist
33
34
use constants_mod, only: PI, GRAV, RDGAS, RVGAS
34
35
@@ -107,6 +108,7 @@ subroutine read_climate_nudge_data_init (nlon, nlat, nlev, ntime)
107
108
character (len= 32 ), allocatable :: fields(:)
108
109
type (FmsNetcdfFile_t) :: fileobj
109
110
integer , allocatable , dimension (:) :: pes ! < Array of ther pes in the current pelist
111
+ character (len= 128 ), dimension (:), allocatable :: names
110
112
111
113
if (module_is_initialized) return
112
114
! initial file names to blanks
@@ -147,22 +149,32 @@ subroutine read_climate_nudge_data_init (nlon, nlat, nlev, ntime)
147
149
if (open_file(fileobj, trim (filenames(n)), " read" , pelist= pes)) then
148
150
Files(n)% ndim= get_num_dimensions(fileobj)
149
151
150
- allocate (Files(n)% length_axes(Files(n)% ndim))
152
+ allocate (files(n)% length_axes(Files(n)% ndim))
153
+ allocate (names(files(n)% ndim))
154
+ call get_dimension_names(fileobj, names)
155
+ files(n)% axes(:) = " "
151
156
152
157
! inquire dimension sizes
153
158
do i = 1 , Files(n)% ndim
154
- call get_dimension_names(fileobj, Files(n)% axes)
155
159
do j = 1 , NUM_REQ_AXES
156
- if (trim (Files(n)% axes(j)) .eq. trim (required_axis_names(j))) then
160
+ if (trim (names(i)) .eq. trim (required_axis_names(j))) then
161
+ files(n)% axes(j) = trim (names(i))
157
162
call get_dimension_size(fileobj, Files(n)% axes(j), Files(n)% length_axes(j))
158
163
call check_axis_size (j,Files(n)% length_axes(j))
159
164
Files(n)% axis_index(j) = i
160
165
exit
161
166
endif
162
167
enddo
168
+ if (j .gt. num_req_axes) then
169
+ if (is_dimension_unlimited(fileobj, trim (names(i)))) then
170
+ ! time axis indexing
171
+ files(n)% axes(index_time) = trim (names(i))
172
+ call get_dimension_size(fileobj, files(n)% axes(index_time), &
173
+ files(n)% length_axes(index_time))
174
+ endif
175
+ endif
163
176
enddo
164
- ! time axis indexing
165
- call get_dimension_size(fileobj, Files(n)% axes(INDEX_TIME), Files(n)% length_axes(INDEX_TIME))
177
+ deallocate (names)
166
178
Files(n)% ntim = Files(n)% length_axes(INDEX_TIME)
167
179
Files(n)% time_offset = numtime
168
180
numtime = numtime + Files(n)% ntim
@@ -173,7 +185,7 @@ subroutine read_climate_nudge_data_init (nlon, nlat, nlev, ntime)
173
185
Files(n)% field_index = 0
174
186
do i = 1 , Files(n)% nvar
175
187
nd = get_variable_num_dimensions(fileobj, fields(i))
176
- call get_variable_size(fileobj, fields(i), siz)
188
+ call get_variable_size(fileobj, fields(i), siz( 1 :nd) )
177
189
do j = 1 , NUM_REQ_FLDS
178
190
if (trim (fields(i)) .eq. trim (required_field_names(j))) then
179
191
Files(n)% field_index(j) = i
0 commit comments