Skip to content

Commit 28f4aa0

Browse files
committed
some need to remain shr_sys_abort (no return code available)
1 parent 3cd9f5b commit 28f4aa0

File tree

2 files changed

+65
-37
lines changed

2 files changed

+65
-37
lines changed

streams/dshr_stream_mod.F90

Lines changed: 46 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ module dshr_stream_mod
1616
! -------------------------------------------------------------------------------
1717

1818
use shr_kind_mod , only : r8=>shr_kind_r8, cs=>shr_kind_cs, cl=>shr_kind_cl, cxx=>shr_kind_cxx, cx=>shr_kind_cx
19-
use shr_sys_mod , only : shr_sys_abort
19+
use shr_log_mod , only : shr_log_error
2020
use shr_const_mod , only : shr_const_cday
2121
use shr_string_mod , only : shr_string_leftalign_and_convert_tabs, shr_string_parseCFtunit
2222
use shr_cal_mod , only : shr_cal_noleap
@@ -210,7 +210,8 @@ subroutine shr_stream_init_from_xml(streamfilename, streamdat, isroot_task, logu
210210

211211
Sdoc => parseFile(streamfilename, iostat=status)
212212
if (status /= 0) then
213-
call shr_sys_abort("Could not parse file "//trim(streamfilename))
213+
call shr_log_error("Could not parse file "//trim(streamfilename), rc=rc)
214+
return
214215
endif
215216
streamlist => getElementsByTagname(Sdoc, "stream_info")
216217
nstrms = getLength(streamlist)
@@ -228,7 +229,8 @@ subroutine shr_stream_init_from_xml(streamfilename, streamdat, isroot_task, logu
228229
if (streamdat(i)%taxmode /= shr_stream_taxis_cycle .and. &
229230
streamdat(i)%taxmode /= shr_stream_taxis_extend .and. &
230231
streamdat(i)%taxmode /= shr_stream_taxis_limit) then
231-
call shr_sys_abort("tintalgo must have a value of either cycle, extend or limit")
232+
call shr_log_error("tintalgo must have a value of either cycle, extend or limit", rc=rc)
233+
return
232234
end if
233235
endif
234236

@@ -241,7 +243,8 @@ subroutine shr_stream_init_from_xml(streamfilename, streamdat, isroot_task, logu
241243
streamdat(i)%mapalgo /= shr_stream_mapalgo_consf .and. &
242244
streamdat(i)%mapalgo /= shr_stream_mapalgo_consd .and. &
243245
streamdat(i)%mapalgo /= shr_stream_mapalgo_none) then
244-
call shr_sys_abort("mapaglo must have a value of either bilinear, redist, nn, consf or consd")
246+
call shr_log_error("mapaglo must have a value of either bilinear, redist, nn, consf or consd", rc=rc)
247+
return
245248
end if
246249
endif
247250

@@ -253,7 +256,8 @@ subroutine shr_stream_init_from_xml(streamfilename, streamdat, isroot_task, logu
253256
streamdat(i)%tInterpAlgo /= shr_stream_tinterp_nearest .and. &
254257
streamdat(i)%tInterpAlgo /= shr_stream_tinterp_linear .and. &
255258
streamdat(i)%tInterpAlgo /= shr_stream_tinterp_coszen) then
256-
call shr_sys_abort("tintalgo must have a value of either lower, upper, nearest, linear or coszen")
259+
call shr_log_error("tintalgo must have a value of either lower, upper, nearest, linear or coszen", rc=rc)
260+
return
257261
end if
258262
endif
259263

@@ -266,21 +270,24 @@ subroutine shr_stream_init_from_xml(streamfilename, streamdat, isroot_task, logu
266270
if(associated(p)) then
267271
call extractDataContent(p, streamdat(i)%yearFirst)
268272
else
269-
call shr_sys_abort("yearFirst must be provided")
273+
call shr_log_error("yearFirst must be provided", rc=rc)
274+
return
270275
endif
271276

272277
p=> item(getElementsByTagname(streamnode, "year_last"), 0)
273278
if(associated(p)) then
274279
call extractDataContent(p, streamdat(i)%yearLast)
275280
else
276-
call shr_sys_abort("yearLast must be provided")
281+
call shr_log_error("yearLast must be provided", rc=rc)
282+
return
277283
endif
278284

279285
p=> item(getElementsByTagname(streamnode, "year_align"), 0)
280286
if(associated(p)) then
281287
call extractDataContent(p, streamdat(i)%yearAlign)
282288
else
283-
call shr_sys_abort("yearAlign must be provided")
289+
call shr_log_error("yearAlign must be provided", rc=rc)
290+
return
284291
endif
285292

286293
p=> item(getElementsByTagname(streamnode, "dtlimit"), 0)
@@ -297,28 +304,32 @@ subroutine shr_stream_init_from_xml(streamfilename, streamdat, isroot_task, logu
297304
if (associated(p)) then
298305
call extractDataContent(p, streamdat(i)%meshfile)
299306
else
300-
call shr_sys_abort("mesh file name must be provided")
307+
call shr_log_error("mesh file name must be provided", rc=rc)
308+
return
301309
endif
302310

303311
p => item(getElementsByTagname(streamnode, "vectors"), 0)
304312
if (associated(p)) then
305313
call extractDataContent(p, streamdat(i)%stream_vectors)
306314
else
307-
call shr_sys_abort("stream vectors must be provided")
315+
call shr_log_error("stream vectors must be provided", rc=rc)
316+
return
308317
endif
309318

310319
! Determine name of vertical dimension
311320
p => item(getElementsByTagname(streamnode, "lev_dimname"), 0)
312321
if (associated(p)) then
313322
call extractDataContent(p, streamdat(i)%lev_dimname)
314323
else
315-
call shr_sys_abort("stream vertical level dimension name must be provided")
324+
call shr_log_error("stream vertical level dimension name must be provided", rc=rc)
325+
return
316326
endif
317327

318328
! Determine input data files
319329
p => item(getElementsByTagname(streamnode, "datafiles"), 0)
320330
if (.not. associated(p)) then
321-
call shr_sys_abort("stream data files must be provided")
331+
call shr_log_error("stream data files must be provided", rc=rc)
332+
return
322333
endif
323334
filelist => getElementsByTagname(p,"file")
324335
streamdat(i)%nfiles = getLength(filelist)
@@ -428,7 +439,8 @@ subroutine shr_stream_init_from_xml(streamfilename, streamdat, isroot_task, logu
428439

429440
! Error check
430441
if (trim(streamdat(i)%taxmode) == shr_stream_taxis_extend .and. streamdat(i)%dtlimit < 1.e10) then
431-
call shr_sys_abort(trim(subName)//" ERROR: if taxmode value is extend set dtlimit to 1.e30")
442+
call shr_log_error(trim(subName)//" ERROR: if taxmode value is extend set dtlimit to 1.e30", rc=rc)
443+
return
432444
end if
433445
! initialize flag that stream has been set
434446
streamdat(i)%init = .true.
@@ -625,7 +637,8 @@ subroutine shr_stream_init_from_esmfconfig(streamfilename, streamdat, logunit,
625637
if( nstrms > 0 ) then
626638
allocate(streamdat(nstrms))
627639
else
628-
call shr_sys_abort("no stream_info in config file "//trim(streamfilename))
640+
call shr_log_error("no stream_info in config file "//trim(streamfilename), rc=rc)
641+
return
629642
endif
630643

631644
! fill in non-default values for the streamdat attributes
@@ -647,21 +660,24 @@ subroutine shr_stream_init_from_esmfconfig(streamfilename, streamdat, logunit,
647660
call ESMF_ConfigGetAttribute(CF,value=streamdat(i)%yearFirst,label="yearFirst"//mystrm//':', rc=rc)
648661
if (ChkErr(rc,__LINE__,u_FILE_u)) return
649662
else
650-
call shr_sys_abort("yearFirst must be provided")
663+
call shr_log_error("yearFirst must be provided", rc=rc)
664+
return
651665
endif
652666

653667
if( ESMF_ConfigGetLen(config=CF, label="yearLast"//mystrm//':', rc=rc) > 0 ) then
654668
call ESMF_ConfigGetAttribute(CF,value=streamdat(i)%yearLast,label="yearLast"//mystrm//':', rc=rc)
655669
if (ChkErr(rc,__LINE__,u_FILE_u)) return
656670
else
657-
call shr_sys_abort("yearLast must be provided")
671+
call shr_log_error("yearLast must be provided", rc=rc)
672+
return
658673
endif
659674

660675
if( ESMF_ConfigGetLen(config=CF, label="yearAlign"//mystrm//':', rc=rc) > 0 ) then
661676
call ESMF_ConfigGetAttribute(CF,value=streamdat(i)%yearAlign,label="yearAlign"//mystrm//':', rc=rc)
662677
if (ChkErr(rc,__LINE__,u_FILE_u)) return
663678
else
664-
call shr_sys_abort("yearAlign must be provided")
679+
call shr_log_error("yearAlign must be provided", rc=rc)
680+
return
665681
endif
666682

667683
call ESMF_ConfigGetAttribute(CF,value=streamdat(i)%dtlimit,label="dtlimit"//mystrm//':', rc=rc)
@@ -674,21 +690,24 @@ subroutine shr_stream_init_from_esmfconfig(streamfilename, streamdat, logunit,
674690
call ESMF_ConfigGetAttribute(CF,value=streamdat(i)%meshfile,label="stream_mesh_file"//mystrm//':', rc=rc)
675691
if (ChkErr(rc,__LINE__,u_FILE_u)) return
676692
else
677-
call shr_sys_abort("stream_mesh_file must be provided")
693+
call shr_log_error("stream_mesh_file must be provided", rc=rc)
694+
return
678695
endif
679696

680697
if( ESMF_ConfigGetLen(config=CF, label="stream_vectors"//mystrm//':', rc=rc) > 0 ) then
681698
call ESMF_ConfigGetAttribute(CF,value=streamdat(i)%stream_vectors,label="stream_vectors"//mystrm//':', rc=rc)
682699
if (ChkErr(rc,__LINE__,u_FILE_u)) return
683700
else
684-
call shr_sys_abort("stream_vectors must be provided")
701+
call shr_log_error("stream_vectors must be provided", rc=rc)
702+
return
685703
endif
686704

687705
if( ESMF_ConfigGetLen(config=CF, label="stream_lev_dimname"//mystrm//':', rc=rc) > 0 ) then
688706
call ESMF_ConfigGetAttribute(CF,value=streamdat(i)%lev_dimname,label="stream_lev_dimname"//mystrm//':', rc=rc)
689707
if (ChkErr(rc,__LINE__,u_FILE_u)) return
690708
else
691-
call shr_sys_abort("stream_lev_dimname must be provided")
709+
call shr_log_error("stream_lev_dimname must be provided", rc=rc)
710+
return
692711
endif
693712

694713
! Get a list of stream file names
@@ -703,7 +722,8 @@ subroutine shr_stream_init_from_esmfconfig(streamfilename, streamdat, logunit,
703722
enddo
704723
deallocate(strm_tmpstrings)
705724
else
706-
call shr_sys_abort("stream data files must be provided")
725+
call shr_log_error("stream data files must be provided", rc=rc)
726+
return
707727
endif
708728

709729
! Get name of stream variables in file and model
@@ -718,7 +738,8 @@ subroutine shr_stream_init_from_esmfconfig(streamfilename, streamdat, logunit,
718738
enddo
719739
deallocate(strm_tmpstrings)
720740
else
721-
call shr_sys_abort("stream data variables must be provided")
741+
call shr_log_error("stream data variables must be provided", rc=rc)
742+
return
722743
endif
723744

724745
! Initialize stream pio
@@ -739,7 +760,8 @@ subroutine shr_stream_init_from_esmfconfig(streamfilename, streamdat, logunit,
739760

740761
! Error check
741762
if (trim(streamdat(i)%taxmode) == shr_stream_taxis_extend .and. streamdat(i)%dtlimit < 1.e10) then
742-
call shr_sys_abort(trim(subName)//" ERROR: if taxmode value is extend set dtlimit to 1.e30")
763+
call shr_log_error(trim(subName)//" ERROR: if taxmode value is extend set dtlimit to 1.e30", rc=rc)
764+
return
743765
end if
744766

745767
enddo ! end loop nstrm
@@ -826,7 +848,6 @@ subroutine shr_stream_findBounds(strm, mDateIn, secIn, isroot_task, &
826848
cycle = .false.
827849
limit = .true.
828850
else
829-
write(strm%logunit,*) trim(subName),' ERROR: illegal taxMode = ',trim(strm%taxMode)
830851
call shr_sys_abort(trim(subName)//' ERROR: illegal taxMode = '//trim(strm%taxMode))
831852
endif
832853

@@ -872,7 +893,7 @@ subroutine shr_stream_findBounds(strm, mDateIn, secIn, isroot_task, &
872893
if (.not. strm%file(k)%haveData) then
873894
call shr_stream_readtCoord(strm, k, isroot_task, rCode)
874895
if ( rCode /= 0 )then
875-
call shr_sys_abort(trim(subName)//" ERROR: readtCoord1")
896+
call shr_log_error(trim(subName)//" ERROR: readtCoord1")
876897
end if
877898
end if
878899
do n=1,strm%file(k)%nt
@@ -886,7 +907,6 @@ subroutine shr_stream_findBounds(strm, mDateIn, secIn, isroot_task, &
886907
end do
887908
end do A
888909
if (.not. strm%found_lvd) then
889-
write(strm%logunit,F00) "ERROR: LVD not found, all data is before yearFirst"
890910
call shr_sys_abort(trim(subName)//" ERROR: LVD not found, all data is before yearFirst")
891911
else
892912
!--- LVD is in or beyond yearFirst, verify it is not beyond yearLast ---

streams/dshr_tinterp_mod.F90

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ module dshr_tInterp_mod
77
use ESMF , only : ESMF_Time, ESMF_TimeInterval, ESMF_TimeIntervalGet
88
use ESMF , only : ESMF_SUCCESS, operator(<), operator(-), operator(>), operator(==)
99
use shr_kind_mod , only : i8=>shr_kind_i8, r8=>shr_kind_r8, cs=>shr_kind_cs, cl=>shr_kind_cl, shr_kind_in
10-
use shr_sys_mod , only : shr_sys_abort
10+
use shr_log_mod , only : shr_log_error
1111
use shr_cal_mod , only : shr_cal_timeSet, shr_cal_advDateInt, shr_cal_date2julian
1212
use shr_orb_mod , only : shr_orb_cosz, shr_orb_decl, SHR_ORB_UNDEF_REAL
1313
use shr_const_mod , only : SHR_CONST_PI
@@ -88,7 +88,8 @@ subroutine shr_tInterp_getFactors(D1,S1,D2,S2,Din,Sin,f1,f2,calendar,logunit,alg
8888
! --- always check that 1 <= 2, although we could relax this requirement ---
8989
if (itime2 < itime1) then
9090
write(logunit,F01) ' ERROR: itime2 < itime1 D=',D1,S1,D2,S2
91-
call shr_sys_abort(subName//' itime2 < itime1 ')
91+
call shr_log_error(subName//' itime2 < itime1 ', rc=rc)
92+
return
9293
endif
9394

9495
f1 = -1.0
@@ -121,7 +122,8 @@ subroutine shr_tInterp_getFactors(D1,S1,D2,S2,Din,Sin,f1,f2,calendar,logunit,alg
121122
!--- check that itimein is between itime1 and itime2 ---
122123
if (itime2 < itimein .or. itime1 > itimein) then
123124
write(logunit,F02) ' ERROR illegal linear times: ',D1,S1,Din,Sin,D2,S2
124-
call shr_sys_abort(subName//' illegal itimes ')
125+
call shr_log_error(subName//' illegal itimes ', rc=rc)
126+
return
125127
endif
126128
if (itime2 == itime1) then
127129
f1 = 0.5_r8
@@ -135,8 +137,8 @@ subroutine shr_tInterp_getFactors(D1,S1,D2,S2,Din,Sin,f1,f2,calendar,logunit,alg
135137
f1 = real(snum,r8)/real(sden,r8)
136138
endif
137139
else
138-
if (debug > 0) write(logunit,F00) 'ERROR: illegal lalgo option: ',trim(lalgo)
139-
call shr_sys_abort(subName//' illegal algo option '//trim(lalgo))
140+
call shr_log_error(subName//' illegal algo option '//trim(lalgo), rc=rc)
141+
return
140142
endif
141143

142144
f2 = c1 - f1
@@ -145,8 +147,8 @@ subroutine shr_tInterp_getFactors(D1,S1,D2,S2,Din,Sin,f1,f2,calendar,logunit,alg
145147
if (f1 < c0-eps .or. f1 > c1+eps .or. &
146148
f2 < c0-eps .or. f2 > c1+eps .or. &
147149
abs(f1+f2-c1) > eps) then
148-
if (debug > 0) write(logunit,F01) 'ERROR: illegal tInterp values ',f1,f2
149-
call shr_sys_abort(subName//' illegal tInterp values ')
150+
call shr_log_error(subName//' illegal tInterp values ', rc=rc)
151+
return
150152
endif
151153

152154
if (debug > 0) then
@@ -204,9 +206,11 @@ subroutine shr_tInterp_getAvgCosz(tavCosz, lon, lat, &
204206

205207
! error checks
206208
if (eccen == SHR_ORB_UNDEF_REAL) then
207-
call shr_sys_abort(subname//' ERROR in orb params for coszen tinterp')
209+
call shr_log_error(subname//' ERROR in orb params for coszen tinterp', rc=rc)
210+
return
208211
else if (modeldt < 1) then
209-
call shr_sys_abort(subname//' ERROR: model dt < 1 for coszen tinterp')
212+
call shr_log_error(subname//' ERROR: model dt < 1 for coszen tinterp', rc=rc)
213+
return
210214
endif
211215

212216
!-------------------------------------------------------------------------------
@@ -216,7 +220,10 @@ subroutine shr_tInterp_getAvgCosz(tavCosz, lon, lat, &
216220
!--- get LB & UB dates ---
217221
call shr_cal_timeSet(reday1,ymd1,tod1,calendar)
218222
call shr_cal_timeSet(reday2,ymd2,tod2,calendar)
219-
if (reday1 > reday2) call shr_sys_abort(subname//'ERROR: lower-bound > upper-bound')
223+
if (reday1 > reday2) then
224+
call shr_log_error(subname//'ERROR: lower-bound > upper-bound', rc=rc)
225+
return
226+
endif
220227

221228
timeint = reday2-reday1
222229
call ESMF_TimeIntervalGet(timeint, s_i8=dtsec, rc=rc)
@@ -299,7 +306,8 @@ subroutine shr_tInterp_getCosz(cosz, lon, lat, ymd, tod, &
299306
lsize = size(lon)
300307
if (lsize < 1 .or. size(lat) /= lsize .or. size(cosz) /= lsize) then
301308
write(6,*)'ERROR: lsize,size(lat),size(cosz) = ',lsize,size(lat),size(cosz)
302-
call shr_sys_abort(subname//' ERROR: lon lat cosz sizes disagree')
309+
call shr_log_error(subname//' ERROR: lon lat cosz sizes disagree', rc=rc)
310+
return
303311
endif
304312

305313
call shr_cal_date2julian(ymd, tod, calday, calendar)

0 commit comments

Comments
 (0)