@@ -16,7 +16,7 @@ module dshr_stream_mod
16
16
! -------------------------------------------------------------------------------
17
17
18
18
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
20
20
use shr_const_mod , only : shr_const_cday
21
21
use shr_string_mod , only : shr_string_leftalign_and_convert_tabs, shr_string_parseCFtunit
22
22
use shr_cal_mod , only : shr_cal_noleap
@@ -210,7 +210,8 @@ subroutine shr_stream_init_from_xml(streamfilename, streamdat, isroot_task, logu
210
210
211
211
Sdoc = > parseFile(streamfilename, iostat= status)
212
212
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
214
215
endif
215
216
streamlist = > getElementsByTagname(Sdoc, " stream_info" )
216
217
nstrms = getLength(streamlist)
@@ -228,7 +229,8 @@ subroutine shr_stream_init_from_xml(streamfilename, streamdat, isroot_task, logu
228
229
if (streamdat(i)% taxmode /= shr_stream_taxis_cycle .and. &
229
230
streamdat(i)% taxmode /= shr_stream_taxis_extend .and. &
230
231
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
232
234
end if
233
235
endif
234
236
@@ -241,7 +243,8 @@ subroutine shr_stream_init_from_xml(streamfilename, streamdat, isroot_task, logu
241
243
streamdat(i)% mapalgo /= shr_stream_mapalgo_consf .and. &
242
244
streamdat(i)% mapalgo /= shr_stream_mapalgo_consd .and. &
243
245
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
245
248
end if
246
249
endif
247
250
@@ -253,7 +256,8 @@ subroutine shr_stream_init_from_xml(streamfilename, streamdat, isroot_task, logu
253
256
streamdat(i)% tInterpAlgo /= shr_stream_tinterp_nearest .and. &
254
257
streamdat(i)% tInterpAlgo /= shr_stream_tinterp_linear .and. &
255
258
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
257
261
end if
258
262
endif
259
263
@@ -266,21 +270,24 @@ subroutine shr_stream_init_from_xml(streamfilename, streamdat, isroot_task, logu
266
270
if (associated (p)) then
267
271
call extractDataContent(p, streamdat(i)% yearFirst)
268
272
else
269
- call shr_sys_abort(" yearFirst must be provided" )
273
+ call shr_log_error(" yearFirst must be provided" , rc= rc)
274
+ return
270
275
endif
271
276
272
277
p= > item(getElementsByTagname(streamnode, " year_last" ), 0 )
273
278
if (associated (p)) then
274
279
call extractDataContent(p, streamdat(i)% yearLast)
275
280
else
276
- call shr_sys_abort(" yearLast must be provided" )
281
+ call shr_log_error(" yearLast must be provided" , rc= rc)
282
+ return
277
283
endif
278
284
279
285
p= > item(getElementsByTagname(streamnode, " year_align" ), 0 )
280
286
if (associated (p)) then
281
287
call extractDataContent(p, streamdat(i)% yearAlign)
282
288
else
283
- call shr_sys_abort(" yearAlign must be provided" )
289
+ call shr_log_error(" yearAlign must be provided" , rc= rc)
290
+ return
284
291
endif
285
292
286
293
p= > item(getElementsByTagname(streamnode, " dtlimit" ), 0 )
@@ -297,28 +304,32 @@ subroutine shr_stream_init_from_xml(streamfilename, streamdat, isroot_task, logu
297
304
if (associated (p)) then
298
305
call extractDataContent(p, streamdat(i)% meshfile)
299
306
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
301
309
endif
302
310
303
311
p = > item(getElementsByTagname(streamnode, " vectors" ), 0 )
304
312
if (associated (p)) then
305
313
call extractDataContent(p, streamdat(i)% stream_vectors)
306
314
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
308
317
endif
309
318
310
319
! Determine name of vertical dimension
311
320
p = > item(getElementsByTagname(streamnode, " lev_dimname" ), 0 )
312
321
if (associated (p)) then
313
322
call extractDataContent(p, streamdat(i)% lev_dimname)
314
323
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
316
326
endif
317
327
318
328
! Determine input data files
319
329
p = > item(getElementsByTagname(streamnode, " datafiles" ), 0 )
320
330
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
322
333
endif
323
334
filelist = > getElementsByTagname(p," file" )
324
335
streamdat(i)% nfiles = getLength(filelist)
@@ -428,7 +439,8 @@ subroutine shr_stream_init_from_xml(streamfilename, streamdat, isroot_task, logu
428
439
429
440
! Error check
430
441
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
432
444
end if
433
445
! initialize flag that stream has been set
434
446
streamdat(i)% init = .true.
@@ -625,7 +637,8 @@ subroutine shr_stream_init_from_esmfconfig(streamfilename, streamdat, logunit,
625
637
if ( nstrms > 0 ) then
626
638
allocate (streamdat(nstrms))
627
639
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
629
642
endif
630
643
631
644
! fill in non-default values for the streamdat attributes
@@ -647,21 +660,24 @@ subroutine shr_stream_init_from_esmfconfig(streamfilename, streamdat, logunit,
647
660
call ESMF_ConfigGetAttribute(CF,value= streamdat(i)% yearFirst,label= " yearFirst" // mystrm// ' :' , rc= rc)
648
661
if (ChkErr(rc,__LINE__,u_FILE_u)) return
649
662
else
650
- call shr_sys_abort(" yearFirst must be provided" )
663
+ call shr_log_error(" yearFirst must be provided" , rc= rc)
664
+ return
651
665
endif
652
666
653
667
if ( ESMF_ConfigGetLen(config= CF, label= " yearLast" // mystrm// ' :' , rc= rc) > 0 ) then
654
668
call ESMF_ConfigGetAttribute(CF,value= streamdat(i)% yearLast,label= " yearLast" // mystrm// ' :' , rc= rc)
655
669
if (ChkErr(rc,__LINE__,u_FILE_u)) return
656
670
else
657
- call shr_sys_abort(" yearLast must be provided" )
671
+ call shr_log_error(" yearLast must be provided" , rc= rc)
672
+ return
658
673
endif
659
674
660
675
if ( ESMF_ConfigGetLen(config= CF, label= " yearAlign" // mystrm// ' :' , rc= rc) > 0 ) then
661
676
call ESMF_ConfigGetAttribute(CF,value= streamdat(i)% yearAlign,label= " yearAlign" // mystrm// ' :' , rc= rc)
662
677
if (ChkErr(rc,__LINE__,u_FILE_u)) return
663
678
else
664
- call shr_sys_abort(" yearAlign must be provided" )
679
+ call shr_log_error(" yearAlign must be provided" , rc= rc)
680
+ return
665
681
endif
666
682
667
683
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,
674
690
call ESMF_ConfigGetAttribute(CF,value= streamdat(i)% meshfile,label= " stream_mesh_file" // mystrm// ' :' , rc= rc)
675
691
if (ChkErr(rc,__LINE__,u_FILE_u)) return
676
692
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
678
695
endif
679
696
680
697
if ( ESMF_ConfigGetLen(config= CF, label= " stream_vectors" // mystrm// ' :' , rc= rc) > 0 ) then
681
698
call ESMF_ConfigGetAttribute(CF,value= streamdat(i)% stream_vectors,label= " stream_vectors" // mystrm// ' :' , rc= rc)
682
699
if (ChkErr(rc,__LINE__,u_FILE_u)) return
683
700
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
685
703
endif
686
704
687
705
if ( ESMF_ConfigGetLen(config= CF, label= " stream_lev_dimname" // mystrm// ' :' , rc= rc) > 0 ) then
688
706
call ESMF_ConfigGetAttribute(CF,value= streamdat(i)% lev_dimname,label= " stream_lev_dimname" // mystrm// ' :' , rc= rc)
689
707
if (ChkErr(rc,__LINE__,u_FILE_u)) return
690
708
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
692
711
endif
693
712
694
713
! Get a list of stream file names
@@ -703,7 +722,8 @@ subroutine shr_stream_init_from_esmfconfig(streamfilename, streamdat, logunit,
703
722
enddo
704
723
deallocate (strm_tmpstrings)
705
724
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
707
727
endif
708
728
709
729
! Get name of stream variables in file and model
@@ -718,7 +738,8 @@ subroutine shr_stream_init_from_esmfconfig(streamfilename, streamdat, logunit,
718
738
enddo
719
739
deallocate (strm_tmpstrings)
720
740
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
722
743
endif
723
744
724
745
! Initialize stream pio
@@ -739,7 +760,8 @@ subroutine shr_stream_init_from_esmfconfig(streamfilename, streamdat, logunit,
739
760
740
761
! Error check
741
762
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
743
765
end if
744
766
745
767
enddo ! end loop nstrm
@@ -826,7 +848,6 @@ subroutine shr_stream_findBounds(strm, mDateIn, secIn, isroot_task, &
826
848
cycle = .false.
827
849
limit = .true.
828
850
else
829
- write (strm% logunit,* ) trim (subName),' ERROR: illegal taxMode = ' ,trim (strm% taxMode)
830
851
call shr_sys_abort(trim (subName)// ' ERROR: illegal taxMode = ' // trim (strm% taxMode))
831
852
endif
832
853
@@ -872,7 +893,7 @@ subroutine shr_stream_findBounds(strm, mDateIn, secIn, isroot_task, &
872
893
if (.not. strm% file (k)% haveData) then
873
894
call shr_stream_readtCoord(strm, k, isroot_task, rCode)
874
895
if ( rCode /= 0 )then
875
- call shr_sys_abort (trim (subName)// " ERROR: readtCoord1" )
896
+ call shr_log_error (trim (subName)// " ERROR: readtCoord1" )
876
897
end if
877
898
end if
878
899
do n= 1 ,strm% file (k)% nt
@@ -886,7 +907,6 @@ subroutine shr_stream_findBounds(strm, mDateIn, secIn, isroot_task, &
886
907
end do
887
908
end do A
888
909
if (.not. strm% found_lvd) then
889
- write (strm% logunit,F00) " ERROR: LVD not found, all data is before yearFirst"
890
910
call shr_sys_abort(trim (subName)// " ERROR: LVD not found, all data is before yearFirst" )
891
911
else
892
912
!- -- LVD is in or beyond yearFirst, verify it is not beyond yearLast ---
0 commit comments