gtool5 Fortran 90/95 Library 1.0.0-rc5
日本語
Loading...
Searching...
No Matches
gdncfileinquirename.f90
Go to the documentation of this file.
1!>
2!> @file gdncfileinquirename.f90
3!>
4!> @author Yasuhiro MORIKAWA, Eizi TOYODA
5!> @copyright Copyright (C) GFD Dennou Club, 2000-2026. All rights reserved. <br/>
6!> License is BSD-2-Clause. See [COPYRIGHT](@ref COPYRIGHT) in detail
7!>
8!> @en
9!> @brief Inquire the file name of an open netCDF file
10!> @enden
11!>
12!> @ja
13!> @brief オープン中の netCDF ファイルのファイル名を取得
14!> @endja
15!>
16
17!>
18!> @en
19!> @brief Inquire the file name of an open netCDF file
20!>
21!> Searches the internal file list for the specified file ID and returns
22!> the associated file name. Raises an error if the file ID is not found.
23!> @enden
24!>
25!> @ja
26!> @brief オープン中の netCDF ファイルのファイル名を取得
27!>
28!> 内部ファイルリストから指定されたファイル ID を検索し、
29!> 関連付けられたファイル名を返します。ファイル ID が見つからない場合は
30!> エラーを発生させます。
31!> @endja
32!>
33!> @param[in] fileid @en netCDF file ID @enden @ja netCDF ファイル ID @endja
34!> @param[out] name @en File name @enden @ja ファイル名 @endja
35!>
36subroutine gdncfileinquirename(fileid, name)
39 use netcdf, only: nf90_enotnc
40 use dc_error
42 integer, intent(in):: fileid
43 character(len = *), intent(out):: name
44 type(gd_nc_file_id_entry), pointer:: identptr
45 character(*), parameter:: subname = "GDNcFileName"
46 continue
47 call beginsub(subname, 'fileid=%d', i=(/fileid/))
48 if (.not. id_used) goto 999
49 identptr => id_head
50 do
51 if (.not. associated(identptr)) exit
52 if (identptr % id == fileid) then
53 name = identptr % filename
54 call endsub(subname, 'name=<%c>', c1=trim(name))
55 return
56 endif
57 identptr => identptr % next
58 enddo
59999 continue
60 call storeerror(nf90_enotnc, subname)
61 call endsub(subname, 'err')
62end subroutine gdncfileinquirename
subroutine gdncfileinquirename(fileid, name)
Error handling module.
Definition dc_error.f90:454
subroutine, public storeerror(number, where, err, cause_c, cause_i)
Definition dc_error.f90:891
Debug tracing module.
Definition dc_trace.f90:150
subroutine, public dbgmessage(fmt, i, r, d, l, n, c1, c2, c3, ca)
Definition dc_trace.f90:680
subroutine, public beginsub(name, fmt, i, r, d, l, n, c1, c2, c3, ca, version)
Definition dc_trace.f90:476
subroutine, public endsub(name, fmt, i, r, d, l, n, c1, c2, c3, ca)
Definition dc_trace.f90:599
logical, save id_used
Flag indicating whether id_head has been initialized
type(gd_nc_file_id_entry), pointer, save id_head
ID table for open/close of netCDF files