11 use netcdf,
only: nf90_open, nf90_close, nf90_inquire, &
12 nf90_inq_libvers, nf90_nowrite
70 #define INITIAL_SIZE 1024 71 #define NCDR_MULTI_BASE 1 108 character(len=*),
intent(in) :: filename
109 integer(i_long),
intent(in) :: file_ncid
110 integer(i_long),
intent(out) :: file_ncdr_id
112 integer(i_long) :: input_ndims
113 integer(i_long) :: input_nvars
114 integer(i_long) :: input_nattrs
130 call ncdr_nc_check(nf90_inquire(file_ncid, ndimensions = input_ndims, &
131 nvariables = input_nvars, nattributes = input_nattrs))
163 character(len=*),
intent(in) :: filename
164 integer(i_long) :: file_ncid
165 integer(i_long) :: file_ncdr_id
168 call ncdr_error(
"Can't open the same file more than once! (Opening, closing, and then opening again is allowed.)")
170 call ncdr_nc_check( nf90_open(filename, nf90_nowrite, file_ncid) )
176 character(len=*),
intent(in) :: filename
177 integer(i_long),
intent(out),
optional :: file_ncdr_id
178 logical,
intent(in),
optional :: from_push
179 integer(i_long) :: f_ncdr_id
182 if (.NOT. (
present(from_push) .AND. (from_push))) &
183 call ncdr_error(
"Can not initialize due to push/pop queue use! If you want to init without the stack, you must use nc_diag_read_id_init or clear the queue first!")
188 if (
present(file_ncdr_id)) &
189 file_ncdr_id = f_ncdr_id
196 character(len=*),
intent(in) :: filename
197 integer(i_long),
intent(out),
optional :: file_ncdr_id
200 call ncdr_error(
"Can not initialize due to normal caching use! If you want to init with the stack, you must close the cached file first, then use nc_diag_read_push()!")
214 if (
present(file_ncdr_id))
then 225 character(len=*),
intent(in),
optional :: filename
226 integer(i_long),
intent(in),
optional :: file_ncdr_id
227 logical,
intent(in),
optional :: from_pop
229 integer(i_long) :: f_ncdr_id, f_ncid, i
230 logical :: range_closed
235 call ncdr_error(
"No files are currently open!")
238 if ((any(
ncdr_id_stack == file_ncdr_id)) .AND. (.NOT. (
present(from_pop) .AND. (from_pop)))) &
239 call ncdr_error(
"Can not close due to push/pop queue use! If you want to use this without the stack, you must use nc_diag_read_id_init or clear the queue first!")
242 if (
present(filename))
then 245 if (f_ncdr_id == -1) &
246 call ncdr_error(
"The NetCDF file specified, " // filename //
", is not open and can't be closed.")
247 else if (
present(file_ncdr_id))
then 249 f_ncdr_id = file_ncdr_id
253 call ncdr_error(
"No arguments specified for closing a file! (Also, no current NCIDs were found!)")
283 range_closed = .true.
288 range_closed = .false.
293 if (range_closed)
then 303 range_closed = .false.
308 if (range_closed)
then 317 character(len=*),
intent(out),
optional :: filename
318 integer(i_long),
intent(out),
optional :: file_ncdr_id
324 call ncdr_error(
"BUG - current NCID differs from the current queued NCID!")
326 if (
present(filename))
then 330 if (
present(file_ncdr_id))
then 353 character(len=*),
intent(out),
optional :: filename
354 integer(i_long),
intent(out),
optional :: file_ncdr_id
356 if (
present(filename))
then 360 filename =
"(no file in queue at the moment)" 364 if (
present(file_ncdr_id))
then 375 character(len=*),
intent(out),
optional :: filename
376 integer(i_long),
intent(out),
optional :: file_ncdr_id
378 if (
present(filename))
then 382 filename =
"(no file open at the moment)" 386 if (
present(file_ncdr_id))
then
subroutine nc_diag_read_id_get_attr_1d_string(file_ncdr_id, var_name, attr_name, attr_stor)
character(len=:) function, allocatable nc_diag_read_get_type_str(var_type)
integer(i_long) function nc_diag_read_id_init(filename)
integer, parameter, public i_long
subroutine nc_diag_read_parse_file_vars(file_ncid, file_index, num_vars)
subroutine ncdr_nc_check(status)
integer(i_long) current_ncdr_id
type(ncdr_file), dimension(:), allocatable ncdr_files
subroutine ncdr_check_ncid(file_ncid)
subroutine nc_diag_read_noid_get_global_attr_1d_string(attr_name, attr_stor)
subroutine nc_diag_read_parse_file(filename, file_ncid, file_ncdr_id)
integer(i_long) ncdr_file_highest
integer(i_short), parameter ncdr_default_ent
subroutine nc_diag_read_push(filename, file_ncdr_id)
subroutine ncdr_check_ncdr_id(file_ncdr_id)
integer(i_long) ncdr_file_total
subroutine nc_diag_read_parse_file_dims(file_ncid, file_index, num_dims)
integer(i_long) function nc_diag_read_get_index_from_filename(file_name)
subroutine nc_diag_read_close(filename, file_ncdr_id, from_pop)
integer(i_long) ncdr_file_count
subroutine nc_diag_read_get_current(filename, file_ncdr_id)
subroutine nc_diag_read_id_get_global_attr_1d_string(file_ncdr_id, attr_name, attr_stor)
subroutine ncdr_error(err)
subroutine nc_diag_read_get_current_queue(filename, file_ncdr_id)
subroutine nc_diag_read_noid_get_attr_1d_string(var_name, attr_name, attr_stor)
integer(i_long), dimension(:), allocatable ncdr_id_stack
integer(i_long) ncdr_id_stack_count
subroutine nc_diag_read_init(filename, file_ncdr_id, from_push)
integer(i_long) ncdr_id_stack_size
subroutine nc_diag_read_pop(filename, file_ncdr_id)