2323! run_seaice_analysis_navy to reflect use of
2424! ESPC-D or GOFS data. Also fixed uninitialized
2525! variable.
26+ ! 15 Oct 2024 Eric Kemp Updated error_message logic.
2627!
2728! DESCRIPTION:
2829! Source code for Air Force snow depth analysis.
@@ -331,7 +332,8 @@ subroutine getfrac (date10, fracdir)
331332 character * 255 :: file_path ! FULLY-QUALIFIED FILE NAME
332333 character * 7 :: iofunc ! ACTION TO BE PERFORMED
333334 character * 90 :: message (msglns) ! ERROR MESSAGE
334- character * 12 :: routine_name ! NAME OF THIS SUBROUTINE
335+ character * 20 :: routine_name ! NAME OF THIS SUBROUTINE
336+ character * 10 :: yyyymmddhh
335337 integer :: fracnt ! NUMBER OF FRACTIONAL POINTS
336338 integer :: i ! SNODEP I-COORDINATE
337339 integer :: icount ! LOOP COUNTER
@@ -352,6 +354,8 @@ subroutine getfrac (date10, fracdir)
352354 allocate (pntcnt( ldt_rc% lnc(1 ), ldt_rc% lnr(1 )))
353355 allocate (snocum( ldt_rc% lnc(1 ), ldt_rc% lnr(1 )))
354356
357+ yyyymmddhh = date10
358+
355359 ! INITIALIZE VARIABLES.
356360 fracnt = 0
357361 icount = 1
@@ -440,7 +444,8 @@ subroutine getfrac (date10, fracdir)
440444 usafsi_settings% usefrac = .false.
441445 message(1 ) = ' [WARN] FRACTIONAL SNOW FILE NOT FOUND'
442446 message(2 ) = ' [WARN] PATH = ' // trim (file_path)
443- call error_message (program_name, routine_name, message)
447+ call error_message (program_name, routine_name, yyyymmddhh, &
448+ message)
444449 write (LDT_logunit, 6400 ) routine_name, file_path
445450
446451 end if
@@ -548,7 +553,7 @@ subroutine getgeo (month, static, nc, nr, elevations)
548553 character * 4 :: file_ext ! LAST PORTION OF FILE NAME
549554 character * 255 :: file_path ! FULLY-QUALIFIED FILE NAME
550555 character * 90 :: message (msglns) ! ERROR MESSAGE
551- character * 12 :: routine_name ! NAME OF THIS SUBROUTINE
556+ character * 20 :: routine_name ! NAME OF THIS SUBROUTINE
552557 real , allocatable :: climo_0p25deg(:,:)
553558 integer * 1 , allocatable :: snow_poss_0p25deg(:,:)
554559 type (proj_info) :: snodep_0p25deg_proj
@@ -793,7 +798,8 @@ subroutine getobs (date10, month, sfcobs, netid, staid, stacnt, &
793798 character * 5 , allocatable :: oldnet (:) ! ARRAY OF NETWORKS FOR OLDSTA
794799 character * 32 , allocatable :: oldsta (:) ! ARRAY OF PROCESSED STATIONS WITH SNOW DEPTHS
795800
796- character * 12 :: routine_name ! NAME OF THIS SUBROUTINE
801+ character * 20 :: routine_name ! NAME OF THIS SUBROUTINE
802+ character * 10 :: yyyymmddhh
797803 integer :: ctrgrd ! TEMP HOLDER FOR GROUND OBS INFO
798804 integer :: ctrtmp ! TEMP HOLDER FOR TOO WARM TEMPERATURE OBS
799805 integer :: ctrtrs ! TEMP HOLDER FOR TEMP THRES OBS
@@ -833,6 +839,8 @@ subroutine getobs (date10, month, sfcobs, netid, staid, stacnt, &
833839 allocate (oldnet (usafsi_settings% maxsobs))
834840 allocate (oldsta (usafsi_settings% maxsobs))
835841
842+ yyyymmddhh = date10
843+
836844 ! INITIALIZE VARIABLES.
837845 depth = missing
838846 istat = 0
@@ -1115,7 +1123,8 @@ subroutine getobs (date10, month, sfcobs, netid, staid, stacnt, &
11151123 ' [WARN] NO SURFACE OBSERVATIONS READ FOR ' // &
11161124 date10
11171125 end if
1118- call error_message (program_name, routine_name, message)
1126+ call error_message (program_name, routine_name, &
1127+ yyyymmddhh, message)
11191128
11201129 end if
11211130
@@ -1132,7 +1141,8 @@ subroutine getobs (date10, month, sfcobs, netid, staid, stacnt, &
11321141 // date10
11331142 end if
11341143 message(2 ) = ' [WARN] Looked for ' // trim (obsfile)
1135- call error_message (program_name, routine_name, message)
1144+ call error_message (program_name, routine_name, &
1145+ yyyymmddhh, message)
11361146
11371147 end if file_check
11381148
@@ -1255,7 +1265,8 @@ subroutine getsfc ( date10, stmpdir, sfctmp_found, sfctmp_lis )
12551265 character * 7 :: iofunc ! ACTION TO BE PERFORMED
12561266 character * 90 :: message (msglns) ! ERROR MESSAGE
12571267
1258- character * 12 :: routine_name ! NAME OF THIS ROUTINE
1268+ character * 20 :: routine_name ! NAME OF THIS ROUTINE
1269+ character * 10 :: yyyymmddhh
12591270 integer :: icount ! LOOP COUNTER
12601271 integer :: julhr ! AFWA JULIAN HOUR
12611272 logical :: isfile ! FLAG FOR INPUT FILE FOUND
@@ -1269,6 +1280,8 @@ subroutine getsfc ( date10, stmpdir, sfctmp_found, sfctmp_lis )
12691280
12701281 allocate (sfctmp_lis_0p25deg(igrid, jgrid_lis))
12711282
1283+ yyyymmddhh = date10
1284+
12721285 ! GET LATEST LIS SHELTER TEMPERATURES.
12731286 dtglis = date10
12741287 icount = 1
@@ -1309,7 +1322,8 @@ subroutine getsfc ( date10, stmpdir, sfctmp_found, sfctmp_lis )
13091322 ! IF NOT FOUND FOR PAST 24 HOURS, SEND ERROR MESSAGE.
13101323 if (.not. sfctmp_found) then
13111324 message(1 ) = ' [WARN] LIS DATA NOT FOUND FOR PAST 24 HOURS'
1312- call error_message (program_name, routine_name, message)
1325+ call error_message (program_name, routine_name, yyyymmddhh, &
1326+ message)
13131327 write (ldt_logunit, 6400 ) routine_name
13141328 end if
13151329
@@ -1458,7 +1472,8 @@ subroutine getsmi (date10, ssmis)
14581472 character * 6 :: interval ! TIME INTERVAL FOR FILENAME
14591473 character * 90 :: message (msglns) ! ERROR MESSAGE
14601474 character * 4 :: msgval ! PLACEHOLDER FOR ERROR MESSAGE VALUES
1461- character * 12 :: routine_name ! NAME OF THIS SUBROUTINE
1475+ character * 20 :: routine_name ! NAME OF THIS SUBROUTINE
1476+ character * 10 :: yyyymmddhh
14621477 integer :: edri16 ! EDR 16TH MESH I-COORDINATE
14631478 integer :: edrj16 ! EDR 16TH MESH J-COORDINATE
14641479 integer :: edrlat ! EDR LATITUDE (100THS OF DEGREES)
@@ -1501,6 +1516,8 @@ subroutine getsmi (date10, ssmis)
15011516 data lunsrc / 43 , 44 /
15021517 data routine_name / ' GETSMI ' /
15031518
1519+ yyyymmddhh = date10
1520+
15041521 ! ALLOCATE ARRAYS.
15051522 allocate (icecount_0p25deg (igrid , jgrid))
15061523 allocate (icetotal_0p25deg (igrid , jgrid))
@@ -1658,7 +1675,7 @@ subroutine getsmi (date10, ssmis)
16581675 end if
16591676 end do
16601677 end do
1661-
1678+
16621679 ! Interpolate the 0.25deg data to the LDT grid
16631680 nr = LDT_rc% lnr(1 )
16641681 nc = LDT_rc% lnc(1 )
@@ -1702,7 +1719,8 @@ subroutine getsmi (date10, ssmis)
17021719
17031720 if (msgline > 1 ) then
17041721
1705- call error_message (program_name, routine_name, message)
1722+ call error_message (program_name, routine_name, yyyymmddhh, &
1723+ message)
17061724
17071725 end if
17081726
@@ -1812,7 +1830,7 @@ subroutine getsno (date10, modif, unmod, nc, nr, landice, julhr_beg, &
18121830 character * 10 :: date10_prev ! PREVIOUS CYCLE DATE-TIME GROUP
18131831 character * 255 :: file_path ! INPUT FILE PATH AND NAME
18141832 character * 90 :: message (msglns) ! ERROR MESSAGE
1815- character * 12 :: routine_name ! NAME OF THIS SUBROUTINE
1833+ character * 20 :: routine_name ! NAME OF THIS SUBROUTINE
18161834 character * 255 :: prevdir ! PATH TO PREVIOUS CYCLE'S DATA
18171835 integer :: runcycle ! CYCLE HOUR
18181836 integer :: julhr ! AFWA JULIAN HOUR
@@ -2111,7 +2129,7 @@ subroutine getsno (date10, modif, unmod, nc, nr, landice, julhr_beg, &
211121294200 continue
21122130 message(1 ) = ' [ERR] ERROR CONVERTING DATA FROM CHARACTER TO INTEGER'
21132131 message(2 ) = ' [ERR] DATE10 = ' // date10
2114- call abort_message (program_name, program_name , message)
2132+ call abort_message (program_name, routine_name , message)
21152133 call LDT_endrun()
21162134
21172135 ! FORMAT STATEMENTS.
@@ -2145,7 +2163,7 @@ subroutine getsno_nc(date10, julhr_beg, ierr)
21452163 integer :: limit, tries
21462164 integer :: runcycle
21472165 integer :: julhr
2148- character * 12 :: routine_name
2166+ character * 20 :: routine_name
21492167 character * 10 :: date10_prev
21502168 character * 90 :: message(msglns)
21512169
@@ -2214,7 +2232,7 @@ subroutine getsno_nc(date10, julhr_beg, ierr)
221422324200 continue
22152233 message(1 ) = ' [ERR] ERROR CONVERTING DATA FROM CHARACTER TO INTEGER'
22162234 message(2 ) = ' [ERR] DATE10 = ' // date10
2217- call abort_message (program_name, program_name , message)
2235+ call abort_message (program_name, routine_name , message)
22182236 call LDT_endrun()
22192237
22202238 ! Other format statements
@@ -2292,7 +2310,8 @@ subroutine getsst (date10, stmpdir, sstdir)
22922310 character * 7 :: iofunc ! ACTION TO BE PERFORMED
22932311 ! character*90 :: message (msglns) ! ERROR MESSAGE
22942312 character * 255 :: message (msglns) ! ERROR MESSAGE
2295- character * 12 :: routine_name ! NAME OF THIS SUBROUTINE
2313+ character * 20 :: routine_name ! NAME OF THIS SUBROUTINE
2314+ character * 10 :: yyyymmddhh
22962315 integer :: runcycle ! CYCLE TIME
22972316 integer :: hrdiff ! DIFFERENCE BETWEEN HOURS
22982317 integer :: julsno ! JULIAN HOUR OF SNODEP CYCLE
@@ -2312,6 +2331,8 @@ subroutine getsst (date10, stmpdir, sstdir)
23122331
23132332 data routine_name / ' GETSST ' /
23142333
2334+ yyyymmddhh = date10
2335+
23152336 ! FIND THE DATE/TIME GROUP OF THE PREVIOUS CYCLE.
23162337 ! GET SEA SURFACE TEMPERATURE DATA.
23172338 iofunc = ' READING'
@@ -2387,14 +2408,16 @@ subroutine getsst (date10, stmpdir, sstdir)
23872408 else
23882409 message(1 ) = ' [ERR] ERROR READING FILE'
23892410 message(2 ) = ' [ERR] PATH = ' // file_grib
2390- call error_message(program_name, routine_name, message)
2411+ call error_message(program_name, routine_name, &
2412+ yyyymmddhh, message)
23912413 write (ldt_logunit, 6400 ) routine_name, iofunc, file_grib, &
23922414 grstat
23932415 end if
23942416 else
23952417 message(1 ) = ' [ERR] ERROR OPENING FILE'
23962418 message(2 ) = ' [ERR] PATH = ' // file_grib
2397- call error_message(program_name, routine_name, message)
2419+ call error_message(program_name, routine_name, &
2420+ yyyymmddhh, message)
23982421 write (ldt_logunit, 6400 ) routine_name, iofunc, file_grib, grstat
23992422 end if
24002423 end if
@@ -2414,7 +2437,8 @@ subroutine getsst (date10, stmpdir, sstdir)
24142437 message(1 ) = ' SST DATA IS MORE THAN 24 HOURS OLD'
24152438 message(2 ) = ' USAFSI CYCLE = ' // date10
24162439 message(3 ) = ' SEA SFC TEMP = ' // date10_sst
2417- call error_message (program_name, routine_name, message)
2440+ call error_message (program_name, routine_name, &
2441+ yyyymmddhh, message)
24182442
24192443 end if
24202444
@@ -2423,7 +2447,8 @@ subroutine getsst (date10, stmpdir, sstdir)
24232447 else
24242448
24252449 message(1 ) = ' [WARN] SEA SURFACE TEMPERATURE DATA NOT FOUND'
2426- call error_message (program_name, routine_name, message)
2450+ call error_message (program_name, routine_name, &
2451+ yyyymmddhh, message)
24272452 write (ldt_logunit, 6600 ) routine_name
24282453
24292454 end if
@@ -2557,7 +2582,8 @@ subroutine getviirs (date10, viirsdir)
25572582 character (255 ) :: snoage_path ! FULLY-QUALIFIED SNOAGE FILE NAME
25582583 character (7 ) :: iofunc ! ACTION TO BE PERFORMED
25592584 character (90 ) :: message (msglns) ! ERROR MESSAGE
2560- character (12 ) :: routine_name ! NAME OF THIS SUBROUTINE
2585+ character (20 ) :: routine_name ! NAME OF THIS SUBROUTINE
2586+ character (10 ) :: yyyymmddhh
25612587 integer :: i ! SNODEP I-COORDINATE
25622588 integer :: icount ! LOOP COUNTER
25632589 integer :: julhr ! AFWA JULIAN HOUR
@@ -2583,12 +2609,14 @@ subroutine getviirs (date10, viirsdir)
25832609 write (LDT_logunit,* )&
25842610 ' [ERR] Recompile with LIBGEOTIFF support and try again!'
25852611 call LDT_endrun()
2586-
2612+
25872613#else
25882614 external :: ztif_frac_slice ! EMK 20220113
25892615
25902616 data routine_name / ' GETVIIRS ' /
25912617
2618+ yyyymmddhh = date10
2619+
25922620 ! ALLOCATE DATA ARRAYS.
25932621 nc = LDT_rc% lnc(1 )
25942622 nr = LDT_rc% lnr(1 )
@@ -2611,7 +2639,7 @@ subroutine getviirs (date10, viirsdir)
26112639 idim = igrid_viirs, &
26122640 jdim = jgrid_viirs, &
26132641 proj= viirs_0p005deg_proj)
2614-
2642+
26152643 ! INITIALIZE VARIABLES.
26162644 icount = 0
26172645 iofunc = ' READING'
@@ -2694,7 +2722,7 @@ subroutine getviirs (date10, viirsdir)
26942722
26952723 ! No error for this slice, so process
26962724 do i_viirs = 1 , igrid_viirs
2697-
2725+
26982726 ! Find lat/lon of VIIRS pixel, and then determine which
26992727 ! LDT grid box this falls in.
27002728 ri_viirs = real (i_viirs)
@@ -2720,13 +2748,13 @@ subroutine getviirs (date10, viirsdir)
27202748 j = 1
27212749 else if (j > nr) then
27222750 j = nr
2723- end if
2751+ end if
27242752 pixels(i,j) = pixels(i,j) + 1
27252753
27262754 ! Skip if the pixel age is too old.
27272755 if (agebuf_slice(i_viirs) > &
27282756 usafsi_settings% maxpixage) cycle
2729-
2757+
27302758 ! Increment the appropriate snow/bare counter
27312759 if (mapbuf_slice(i_viirs) .eq. 0 ) then
27322760 bare(i,j) = bare(i,j) + 1
@@ -2754,7 +2782,7 @@ subroutine getviirs (date10, viirsdir)
27542782
27552783 end do file_search
27562784
2757- if (map_exists .and. age_exists .and. ierr .eq. 0 ) then
2785+ if (map_exists .and. age_exists .and. ierr .eq. 0 ) then
27582786
27592787 ! From the geolocated data, create the final VIIRS snow cover map
27602788 do j = 1 , nr
@@ -2780,15 +2808,17 @@ subroutine getviirs (date10, viirsdir)
27802808 usafsi_settings% useviirs = .false.
27812809 message(1 ) = ' [WARN] VIIRS SNOW MAP FILE NOT FOUND'
27822810 ! message(2) = '[WARN] PATH = ' // trim(snomap_path)
2783- call error_message (program_name, routine_name, message)
2811+ call error_message (program_name, routine_name, &
2812+ yyyymmddhh, message)
27842813 write (ldt_logunit, 6400 ) routine_name, snomap_path
27852814 end if
27862815
27872816 if (.not. age_exists) then
27882817 usafsi_settings% useviirs = .false.
27892818 message(1 ) = ' [WARN] VIIRS SNOW AGE FILE NOT FOUND'
27902819 ! message(2) = '[WARN] PATH = ' // trim(snoage_path)
2791- call error_message (program_name, routine_name, message)
2820+ call error_message (program_name, routine_name, &
2821+ yyyymmddhh, message)
27922822 write (ldt_logunit, 6400 ) routine_name, snoage_path
27932823 end if
27942824
0 commit comments