25 class(fmsnetcdffile_t),
intent(in) :: fileobj
26 integer,
intent(in) :: varid
27 character(len=*),
intent(in) :: varname
28 class(*),
intent(inout) :: var_data
31 character(len=128) :: msg
32 real(kind=r4_kind) :: buf_r4_kind
33 real(kind=r8_kind) :: buf_r8_kind
36 msg =
"Check your read_data call for the variable:"//trim(varname)//&
37 " in file:"//trim(fileobj%path)
39 if (attribute_exists(fileobj%ncid, varid,
"scale_factor") .or. &
40 attribute_exists(fileobj%ncid, varid,
"add_offset"))
then
43 type is (real(kind=r4_kind))
44 err = nf90_get_att(fileobj%ncid, varid,
"scale_factor", buf_r4_kind )
45 call check_netcdf_code(err, msg)
46 var_data = var_data * buf_r4_kind
48 err = nf90_get_att(fileobj%ncid, varid,
"add_offset", buf_r4_kind )
49 call check_netcdf_code(err, msg)
50 var_data = var_data + buf_r4_kind
52 type is (real(kind=r8_kind))
53 err = nf90_get_att(fileobj%ncid, varid,
"scale_factor", buf_r8_kind )
54 call check_netcdf_code(err, msg)
55 var_data = var_data * buf_r8_kind
57 err = nf90_get_att(fileobj%ncid, varid,
"add_offset", buf_r8_kind )
58 call check_netcdf_code(err, msg)
59 var_data = var_data + buf_r8_kind
62 call error(
"If using the scale_factor and add_offset variable, the buffer reading the data to needs to be &
63 &r4_kind or r8_kind."//trim(msg))
69 class(fmsnetcdffile_t),
intent(in) :: fileobj
70 integer,
intent(in) :: varid
71 character(len=*),
intent(in) :: varname
72 class(*),
intent(inout) :: var_data(:)
75 character(len=128) :: msg
76 real(kind=r4_kind) :: buf_r4_kind
77 real(kind=r8_kind) :: buf_r8_kind
80 msg =
"Check your read_data call for the variable:"//trim(varname)//&
81 " in file:"//trim(fileobj%path)
83 if (attribute_exists(fileobj%ncid, varid,
"scale_factor") .or. &
84 attribute_exists(fileobj%ncid, varid,
"add_offset"))
then
87 type is (real(kind=r4_kind))
88 err = nf90_get_att(fileobj%ncid, varid,
"scale_factor", buf_r4_kind )
89 call check_netcdf_code(err, msg)
90 var_data = var_data * buf_r4_kind
92 err = nf90_get_att(fileobj%ncid, varid,
"add_offset", buf_r4_kind )
93 call check_netcdf_code(err, msg)
94 var_data = var_data + buf_r4_kind
96 type is (real(kind=r8_kind))
97 err = nf90_get_att(fileobj%ncid, varid,
"scale_factor", buf_r8_kind )
98 call check_netcdf_code(err, msg)
99 var_data = var_data * buf_r8_kind
101 err = nf90_get_att(fileobj%ncid, varid,
"add_offset", buf_r8_kind )
102 call check_netcdf_code(err, msg)
103 var_data = var_data + buf_r8_kind
106 call error(
"If using the scale_factor and add_offset variable, the buffer reading the data to needs to be &
107 &r4_kind or r8_kind."//trim(msg))
113 class(fmsnetcdffile_t),
intent(in) :: fileobj
114 integer,
intent(in) :: varid
115 character(len=*),
intent(in) :: varname
116 class(*),
intent(inout) :: var_data(:,:)
119 character(len=128) :: msg
120 real(kind=r4_kind) :: buf_r4_kind
121 real(kind=r8_kind) :: buf_r8_kind
124 msg =
"Check your read_data call for the variable:"//trim(varname)//&
125 " in file:"//trim(fileobj%path)
127 if (attribute_exists(fileobj%ncid, varid,
"scale_factor") .or. &
128 attribute_exists(fileobj%ncid, varid,
"add_offset"))
then
130 select type(var_data)
131 type is (real(kind=r4_kind))
132 err = nf90_get_att(fileobj%ncid, varid,
"scale_factor", buf_r4_kind )
133 call check_netcdf_code(err, msg)
134 var_data = var_data * buf_r4_kind
136 err = nf90_get_att(fileobj%ncid, varid,
"add_offset", buf_r4_kind )
137 call check_netcdf_code(err, msg)
138 var_data = var_data + buf_r4_kind
140 type is (real(kind=r8_kind))
141 err = nf90_get_att(fileobj%ncid, varid,
"scale_factor", buf_r8_kind )
142 call check_netcdf_code(err, msg)
143 var_data = var_data * buf_r8_kind
145 err = nf90_get_att(fileobj%ncid, varid,
"add_offset", buf_r8_kind )
146 call check_netcdf_code(err, msg)
147 var_data = var_data + buf_r8_kind
150 call error(
"If using the scale_factor and add_offset variable, the buffer reading the data to needs to be &
151 &r4_kind or r8_kind."//trim(msg))
157 class(fmsnetcdffile_t),
intent(in) :: fileobj
158 integer,
intent(in) :: varid
159 character(len=*),
intent(in) :: varname
160 class(*),
intent(inout) :: var_data(:,:,:)
163 character(len=128) :: msg
164 real(kind=r4_kind) :: buf_r4_kind
165 real(kind=r8_kind) :: buf_r8_kind
168 msg =
"Check your read_data call for the variable:"//trim(varname)//&
169 " in file:"//trim(fileobj%path)
171 if (attribute_exists(fileobj%ncid, varid,
"scale_factor") .or. &
172 attribute_exists(fileobj%ncid, varid,
"add_offset"))
then
174 select type(var_data)
175 type is (real(kind=r4_kind))
176 err = nf90_get_att(fileobj%ncid, varid,
"scale_factor", buf_r4_kind )
177 call check_netcdf_code(err, msg)
178 var_data = var_data * buf_r4_kind
180 err = nf90_get_att(fileobj%ncid, varid,
"add_offset", buf_r4_kind )
181 call check_netcdf_code(err, msg)
182 var_data = var_data + buf_r4_kind
184 type is (real(kind=r8_kind))
185 err = nf90_get_att(fileobj%ncid, varid,
"scale_factor", buf_r8_kind )
186 call check_netcdf_code(err, msg)
187 var_data = var_data * buf_r8_kind
189 err = nf90_get_att(fileobj%ncid, varid,
"add_offset", buf_r8_kind )
190 call check_netcdf_code(err, msg)
191 var_data = var_data + buf_r8_kind
194 call error(
"If using the scale_factor and add_offset variable, the buffer reading the data to needs to be &
195 &r4_kind or r8_kind."//trim(msg))
201 class(fmsnetcdffile_t),
intent(in) :: fileobj
202 integer,
intent(in) :: varid
203 character(len=*),
intent(in) :: varname
204 class(*),
intent(inout) :: var_data(:,:,:,:)
207 character(len=128) :: msg
208 real(kind=r4_kind) :: buf_r4_kind
209 real(kind=r8_kind) :: buf_r8_kind
212 msg =
"Check your read_data call for the variable:"//trim(varname)//&
213 " in file:"//trim(fileobj%path)
215 if (attribute_exists(fileobj%ncid, varid,
"scale_factor") .or. &
216 attribute_exists(fileobj%ncid, varid,
"add_offset"))
then
218 select type(var_data)
219 type is (real(kind=r4_kind))
220 err = nf90_get_att(fileobj%ncid, varid,
"scale_factor", buf_r4_kind )
221 call check_netcdf_code(err, msg)
222 var_data = var_data * buf_r4_kind
224 err = nf90_get_att(fileobj%ncid, varid,
"add_offset", buf_r4_kind )
225 call check_netcdf_code(err, msg)
226 var_data = var_data + buf_r4_kind
228 type is (real(kind=r8_kind))
229 err = nf90_get_att(fileobj%ncid, varid,
"scale_factor", buf_r8_kind )
230 call check_netcdf_code(err, msg)
231 var_data = var_data * buf_r8_kind
233 err = nf90_get_att(fileobj%ncid, varid,
"add_offset", buf_r8_kind )
234 call check_netcdf_code(err, msg)
235 var_data = var_data + buf_r8_kind
238 call error(
"If using the scale_factor and add_offset variable, the buffer reading the data to needs to be &
239 &r4_kind or r8_kind."//trim(msg))
245 class(fmsnetcdffile_t),
intent(in) :: fileobj
246 integer,
intent(in) :: varid
247 character(len=*),
intent(in) :: varname
248 class(*),
intent(inout) :: var_data(:,:,:,:,:)
251 character(len=128) :: msg
252 real(kind=r4_kind) :: buf_r4_kind
253 real(kind=r8_kind) :: buf_r8_kind
256 msg =
"Check your read_data call for the variable:"//trim(varname)//&
257 " in file:"//trim(fileobj%path)
259 if (attribute_exists(fileobj%ncid, varid,
"scale_factor") .or. &
260 attribute_exists(fileobj%ncid, varid,
"add_offset"))
then
262 select type(var_data)
263 type is (real(kind=r4_kind))
264 err = nf90_get_att(fileobj%ncid, varid,
"scale_factor", buf_r4_kind )
265 call check_netcdf_code(err, msg)
266 var_data = var_data * buf_r4_kind
268 err = nf90_get_att(fileobj%ncid, varid,
"add_offset", buf_r4_kind )
269 call check_netcdf_code(err, msg)
270 var_data = var_data + buf_r4_kind
272 type is (real(kind=r8_kind))
273 err = nf90_get_att(fileobj%ncid, varid,
"scale_factor", buf_r8_kind )
274 call check_netcdf_code(err, msg)
275 var_data = var_data * buf_r8_kind
277 err = nf90_get_att(fileobj%ncid, varid,
"add_offset", buf_r8_kind )
278 call check_netcdf_code(err, msg)
279 var_data = var_data + buf_r8_kind
282 call error(
"If using the scale_factor and add_offset variable, the buffer reading the data to needs to be &
283 &r4_kind or r8_kind."//trim(msg))
subroutine unpack_data_2d(fileobj, varid, varname, var_data)
subroutine unpack_data_1d(fileobj, varid, varname, var_data)
subroutine unpack_data_5d(fileobj, varid, varname, var_data)
subroutine unpack_data_0d(fileobj, varid, varname, var_data)
subroutine unpack_data_3d(fileobj, varid, varname, var_data)
subroutine unpack_data_4d(fileobj, varid, varname, var_data)