14 CHARACTER(LEN=*),
INTENT(in) :: file_or_extension
15 CHARACTER(LEN=*),
INTENT(inout) :: file_to_parse
16 LOGICAL,
INTENT(out) :: lnc
20 INTEGER :: index_path, index_comp, index_nc, istat=0
22 CHARACTER(len=LEN(file_to_parse)) :: path
23 CHARACTER(len=LEN(file_to_parse)) :: temp
24 CHARACTER(LEN=1),
PARAMETER :: ch_test =
'.'
30 index_path = index(file_or_extension, trim(file_to_parse))
31 index_comp = index_path
33 IF (index_path .gt. 0)
THEN
37 index_nc = index_path + len_trim(file_to_parse)
38 index_path = index(file_or_extension(index_nc:),ch_test)
42 IF (index_path .gt. 0)
THEN
43 file_to_parse = file_or_extension
47 index_nc = index(file_to_parse,
".nc",back=.true.)
48 lnc = (index_nc .eq. (len_trim(file_to_parse)-2))
52 INQUIRE(file=file_to_parse, exist=ltxt, iostat=istat)
53 IF (istat.ne.0 .or. .not.ltxt)
THEN
54 file_to_parse = trim(file_to_parse) //
".nc"
64 IF (file_or_extension(1:1) ==
'.' .or.
65 1 file_or_extension(1:1) ==
'_')
THEN
66 temp = trim(path) // file_or_extension
67 ELSE IF (index_comp == 0)
THEN
68 temp = trim(path) //
'_' // file_or_extension
70 temp = trim(file_or_extension)
76 file_to_parse = trim(temp)
77 index_nc = index(file_to_parse,
".nc",back=.true.)
78 lnc = (index_nc .eq. (len_trim(file_to_parse)-2))
83 index_nc = index(file_to_parse,
".txt",back=.true.)
84 ltxt = (index_nc .eq. (len_trim(file_to_parse)-3))
89 file_to_parse = trim(temp) //
'.nc'
90 INQUIRE (file=file_to_parse, exist=lnc, iostat=istat)
91 IF (istat.ne.0 .or. .not.lnc)
THEN
92 file_to_parse = trim(path) //
'.'
93 1 // trim(file_or_extension) //
'.nc'
94 INQUIRE (file=file_to_parse, exist=lnc, iostat=istat)
95 IF (istat.ne.0 .or. .not.lnc)
THEN
96 file_to_parse = trim(temp) //
'.txt'
97 INQUIRE (file=file_to_parse, exist=ltxt,
100 file_to_parse = trim(path) //
'.' //
101 1 trim(file_or_extension) //
'.txt'
102 INQUIRE (file=file_to_parse, exist=ltxt,
111 IF ((istat.ne.0 .or. .not.ltxt) .and. .not.lnc)
THEN
112 file_to_parse = trim(path) //
'.' // file_or_extension