27 #if defined(OLD_PT_TO_T) || defined(OLD_COS_SG) 29 #error Compile time options -DOLD_PT_TO_T and -DOLD_COS_SG are no longer supported. Please remove them from your XML. 46 character(len=*),
intent(in):: iflnm
47 integer,
intent(out):: ncid
50 status = nf_open(iflnm, nf_nowrite, ncid)
51 if (status .ne. nf_noerr)
call handle_err(status)
58 integer,
intent(in):: ncid
61 status = nf_close(ncid)
62 if (status .ne. nf_noerr)
call handle_err(status)
69 integer,
intent(in):: ncid
70 character(len=*),
intent(in):: var1_name
71 integer,
intent(out):: im
72 integer:: status, var1id
74 status = nf_inq_dimid(ncid, var1_name, var1id)
75 if (status .ne. nf_noerr)
call handle_err(status)
77 status = nf_inq_dimlen(ncid, var1id, im)
78 if (status .ne. nf_noerr)
call handle_err(status)
86 integer,
intent(in):: ncid
87 character(len=*),
intent(in):: var1_name
88 integer,
intent(in):: im
89 logical,
intent(out),
optional:: var_exist
90 real(kind=8),
intent(out):: var1(im)
91 integer:: status, var1id
93 status = nf_inq_varid(ncid, var1_name, var1id)
94 if (status .ne. nf_noerr)
then 96 if(
present(var_exist) ) var_exist = .false.
98 status = nf_get_var_double(ncid, var1id, var1)
99 if (status .ne. nf_noerr)
call handle_err(status)
100 if(
present(var_exist) ) var_exist = .true.
108 subroutine get_var1_real( ncid, var1_name, im, var1, var_exist )
109 integer,
intent(in):: ncid
110 character(len=*),
intent(in):: var1_name
111 integer,
intent(in):: im
112 logical,
intent(out),
optional:: var_exist
113 real(kind=4),
intent(out):: var1(im)
114 integer:: status, var1id
116 status = nf_inq_varid(ncid, var1_name, var1id)
117 if (status .ne. nf_noerr)
then 119 if(
present(var_exist) ) var_exist = .false.
121 status = nf_get_var_real(ncid, var1id, var1)
122 if (status .ne. nf_noerr)
call handle_err(status)
123 if(
present(var_exist) ) var_exist = .true.
130 integer,
intent(in):: ncid
131 character(len=*),
intent(in):: var_name
132 integer,
intent(in):: im, jm
133 real(kind=4),
intent(out):: var2(im)
135 integer:: status, var1id
137 status = nf_inq_varid(ncid, var_name, var1id)
138 if (status .ne. nf_noerr)
call handle_err(status)
140 status = nf_get_var_real(ncid, var1id, var2)
141 if (status .ne. nf_noerr)
call handle_err(status)
145 subroutine get_var2_r4( ncid, var2_name, is,ie, js,je, var2, time_slice )
146 integer,
intent(in):: ncid
147 character(len=*),
intent(in):: var2_name
148 integer,
intent(in):: is, ie, js, je
149 real(kind=4),
intent(out):: var2(is:ie,js:je)
150 integer,
intent(in),
optional :: time_slice
152 real(kind=4),
dimension(1) :: time
153 integer,
dimension(3):: start, nreco
154 integer:: status, var2id
156 status = nf_inq_varid(ncid, var2_name, var2id)
157 if (status .ne. nf_noerr)
call handle_err(status)
159 start(1) = is; start(2) = js; start(3) = 1
160 if (
present(time_slice) )
then 161 start(3) = time_slice
164 nreco(1) = ie - is + 1
165 nreco(2) = je - js + 1
168 status = nf_get_vara_real(ncid, var2id, start, nreco, var2)
169 if (status .ne. nf_noerr)
call handle_err(status)
174 integer,
intent(in):: ncid
175 character(len=*),
intent(in):: var2_name
176 integer,
intent(in):: im, jm
177 real(kind=8),
intent(out):: var2(im,jm)
179 integer:: status, var2id
181 status = nf_inq_varid(ncid, var2_name, var2id)
182 if (status .ne. nf_noerr)
call handle_err(status)
184 status = nf_get_var_double(ncid, var2id, var2)
185 if (status .ne. nf_noerr)
call handle_err(status)
192 integer,
intent(in):: ncid
193 character(len=*),
intent(in):: var3_name
194 integer,
intent(in):: im, jm, km
195 real(kind=8),
intent(out):: var3(im,jm,km)
197 integer:: status, var3id
199 status = nf_inq_varid(ncid, var3_name, var3id)
201 if (status .ne. nf_noerr)
call handle_err(status)
203 status = nf_get_var_double(ncid, var3id, var3)
204 if (status .ne. nf_noerr)
call handle_err(status)
208 subroutine get_var3_real( ncid, var3_name, im, jm, km, var3 )
209 integer,
intent(in):: ncid
210 character(len=*),
intent(in):: var3_name
211 integer,
intent(in):: im, jm, km
212 real(kind=4),
intent(out):: var3(im,jm,km)
214 integer:: status, var3id
216 status = nf_inq_varid(ncid, var3_name, var3id)
218 if (status .ne. nf_noerr)
call handle_err(status)
219 status = nf_get_var_real(ncid, var3id, var3)
221 if (status .ne. nf_noerr)
call handle_err(status)
226 subroutine get_var3_r4( ncid, var3_name, is,ie, js,je, ks,ke, var3, time_slice )
227 integer,
intent(in):: ncid
228 character(len=*),
intent(in):: var3_name
229 integer,
intent(in):: is, ie, js, je, ks,ke
230 real(kind=4),
intent(out):: var3(is:ie,js:je,ks:ke)
231 integer,
intent(in),
optional :: time_slice
233 real(kind=4),
dimension(1) :: time
234 integer,
dimension(4):: start, nreco
235 integer:: status, var3id
237 status = nf_inq_varid(ncid, var3_name, var3id)
238 if (status .ne. nf_noerr)
call handle_err(status)
240 start(1) = is; start(2) = js; start(3) = ks; start(4) = 1
241 if (
present(time_slice) )
then 242 start(4) = time_slice
245 nreco(1) = ie - is + 1
246 nreco(2) = je - js + 1
247 nreco(3) = ke - ks + 1
250 status = nf_get_vara_real(ncid, var3id, start, nreco, var3)
251 if (status .ne. nf_noerr)
call handle_err(status)
254 subroutine get_var4_real( ncid, var4_name, im, jm, km, nt, var4 )
256 #include <netcdf.inc> 257 integer,
intent(in):: ncid
258 character*(*),
intent(in):: var4_name
259 integer,
intent(in):: im, jm, km, nt
260 real*4:: wk4(im,jm,km,4)
261 real*4,
intent(out):: var4(im,jm)
262 integer:: status, var4id
263 integer:: start(4), icount(4)
278 status = nf_inq_varid(ncid, var4_name, var4id)
281 status = nf_get_vara_real(ncid, var4id, start, icount, var4)
291 if (status .ne. nf_noerr)
call handle_err(status)
297 integer,
intent(in):: ncid
298 character(len=*),
intent(in):: var4_name
299 integer,
intent(in):: im, jm, km, nt
300 real(kind=8),
intent(out):: var4(im,jm,km,1)
301 integer:: status, var4id
303 integer:: start(4), icount(4)
315 status = nf_inq_varid(ncid, var4_name, var4id)
316 status = nf_get_vara_double(ncid, var4id, start, icount, var4)
318 if (status .ne. nf_noerr)
call handle_err(status)
323 subroutine get_real3( ncid, var4_name, im, jm, nt, var4 )
325 integer,
intent(in):: ncid
326 character(len=*),
intent(in):: var4_name
327 integer,
intent(in):: im, jm, nt
328 real(kind=4),
intent(out):: var4(im,jm)
329 integer:: status, var4id
330 integer:: start(3), icount(3)
341 status = nf_inq_varid(ncid, var4_name, var4id)
342 status = nf_get_vara_real(ncid, var4id, start, icount, var4)
344 if (status .ne. nf_noerr)
call handle_err(status)
349 logical function check_var( ncid, var3_name)
350 integer,
intent(in):: ncid
351 character(len=*),
intent(in):: var3_name
353 integer:: status, var3id
355 status = nf_inq_varid(ncid, var3_name, var3id)
362 #include <netcdf.inc> 363 integer,
intent(in):: ncid
364 character*(*),
intent(in):: var_name, att_name
365 character*(*),
intent(out):: att
367 integer:: status, varid
369 status = nf_inq_varid(ncid, var_name, varid)
370 status = nf_get_att_text(ncid, varid, att_name, att)
372 if (status .ne. nf_noerr)
call handle_err(status)
378 #include <netcdf.inc> 379 integer,
intent(in):: ncid
380 character*(*),
intent(in):: var_name, att_name
381 real(kind=8),
intent(out):: value
383 integer:: status, varid
385 status = nf_inq_varid(ncid, var_name, varid)
386 status = nf_get_att(ncid, varid, att_name,
value)
388 if (status .ne. nf_noerr)
call handle_err(status)
395 character(len=120) :: errstr
397 if (status .ne. nf_noerr)
then 398 write(errstr,*)
'Error in handle_err: ', nf_strerror(status)
404 subroutine calendar(year, month, day, hour)
405 integer,
intent(inout) :: year
406 integer,
intent(inout) :: month
407 integer,
intent(inout) :: day
408 integer,
intent(inout) :: hour
412 integer irem4,irem100
414 data mdays /31,28,31,30,31,30,31,31,30,31,30,31/
422 irem4 = mod( year, 4 )
423 irem100 = mod( year, 100 )
424 if( irem4 == 0 .and. irem100 /= 0) mdays(2) = 29
426 if( hour >= 24 )
then 431 if( day > mdays(month) )
then 432 day = day - mdays(month)
435 if( month > 12 )
then subroutine, public open_ncfile(iflnm, ncid)
subroutine, public get_var2_real(ncid, var_name, im, jm, var2)
subroutine, public get_var1_real(ncid, var1_name, im, var1, var_exist)
subroutine, public get_var2_r4(ncid, var2_name, is, ie, js, je, var2, time_slice)
subroutine get_var4_double(ncid, var4_name, im, jm, km, nt, var4)
subroutine get_var4_real(ncid, var4_name, im, jm, km, nt, var4)
subroutine, public get_var3_r4(ncid, var3_name, is, ie, js, je, ks, ke, var3, time_slice)
subroutine get_var_att_str(ncid, var_name, att_name, att)
subroutine, public get_var_att_double(ncid, var_name, att_name, value)
subroutine, public get_var3_double(ncid, var3_name, im, jm, km, var3)
subroutine calendar(year, month, day, hour)
subroutine, public close_ncfile(ncid)
subroutine get_real3(ncid, var4_name, im, jm, nt, var4)
subroutine, public get_var1_double(ncid, var1_name, im, var1, var_exist)
subroutine, public get_ncdim1(ncid, var1_name, im)
subroutine, public handle_err(status)
logical function, public check_var(ncid, var3_name)
subroutine, public get_var3_real(ncid, var3_name, im, jm, km, var3)
subroutine, public get_var2_double(ncid, var2_name, im, jm, var2)