diff --git a/deps/ops/CMakeLists.txt b/deps/ops/CMakeLists.txt index 0e55dcb8..99d60820 100644 --- a/deps/ops/CMakeLists.txt +++ b/deps/ops/CMakeLists.txt @@ -35,7 +35,6 @@ set(OPS_SOURCE_FILES code/OpsMod_Utilities/OpsMod_Utilities.f90 code/OpsMod_VarobsLib/OpsMod_VarobsLib.f90 code/OpsProg_Utils/OpsMod_UtilsProgs.f90 - public/GenMod_Control/GenMod_Control.F90 public/GenMod_Control/GenMod_Setup.F90 public/GenMod_Core/GenMod_Core.F90 public/GenMod_Platform/GenMod_Matmul.F90 @@ -70,6 +69,7 @@ set(OPS_SOURCE_FILES stubs/Ops_Constants/OpsMod_SatIds.f90 stubs/Ops_Constants/OpsMod_Stash.f90 stubs/Ops_Constants/OpsMod_Varfields.f90 + stubs/GenMod_Control.F90 stubs/OpsMod_AODGeneral/OpsMod_AODGeneral.f90 stubs/OpsMod_GPSRO/OpsMod_GPSRO.f90 stubs/OpsMod_GPSRO/OpsMod_GPSROInfo.f90 diff --git a/deps/ops/public/GenMod_Core/GenMod_Core.F90 b/deps/ops/public/GenMod_Core/GenMod_Core.F90 index e12bab1a..7042dc88 100644 --- a/deps/ops/public/GenMod_Core/GenMod_Core.F90 +++ b/deps/ops/public/GenMod_Core/GenMod_Core.F90 @@ -105,7 +105,6 @@ MODULE GenMod_Core INTEGER, PARAMETER :: MessageIn = 5 ! unit number for standard input INTEGER, PARAMETER :: MessageOut = 6 ! unit number for standard output INTEGER, PARAMETER :: ErrorOut = 0 ! unit number for standard error output -INTEGER, PARAMETER :: StatsOut = 7 ! unit number for statistics output INTEGER :: WarningCount = 0 ! number of warning messages INTEGER, PARAMETER :: MaxFileNameLen = 255 ! maximum file name length @@ -146,7 +145,6 @@ MODULE GenMod_Core MODULE PROCEDURE gen_warn_scalar END INTERFACE gen_warn -PUBLIC :: gen_close_stats_file PUBLIC :: gen_do_trace PUBLIC :: gen_error_report PUBLIC :: gen_free_unit @@ -157,7 +155,6 @@ MODULE GenMod_Core PUBLIC :: gen_fail PUBLIC :: gen_message PUBLIC :: gen_message_report_sync -PUBLIC :: gen_open_stats_file PUBLIC :: Gen_ReadConfigNL PUBLIC :: gen_replace_text PUBLIC :: Gen_StringSplit @@ -174,7 +171,6 @@ MODULE GenMod_Core PUBLIC :: MaxFileNameLen PUBLIC :: MessageIn PUBLIC :: MessageOut -PUBLIC :: StatsOut PUBLIC :: StatusFatal PUBLIC :: StatusOK PUBLIC :: StatusWarning @@ -210,10 +206,8 @@ MODULE GenMod_Core INCLUDE 'gen_write_trace_js_file.inc' #include "gen_fortran_version.h" -#include "gen_close_stats_file.inc" #include "gen_get_env.inc" #include "gen_get_env_a.inc" #include "gen_message_report_sync.inc" -#include "gen_open_stats_file.inc" END MODULE GenMod_Core diff --git a/deps/ops/public/GenMod_Core/Gen_ReadConfigNL.inc b/deps/ops/public/GenMod_Core/Gen_ReadConfigNL.inc index 17557023..6f13a34a 100755 --- a/deps/ops/public/GenMod_Core/Gen_ReadConfigNL.inc +++ b/deps/ops/public/GenMod_Core/Gen_ReadConfigNL.inc @@ -28,8 +28,7 @@ USE GenMod_Control, ONLY: & GCOMBitRep, & GenMode, & WarningToError, & - WarningsMax, & - StatsAppend + WarningsMax IMPLICIT NONE @@ -46,8 +45,7 @@ NAMELIST / Gen_ConfigNL / & GCOMBitRep, & GenMode, & WarningToError, & - WarningsMax, & - StatsAppend + WarningsMax CALL gen_get_unit_from_env (file_unit, & (/'GEN_CONFIG_NL'/), & diff --git a/deps/ops/public/GenMod_Core/gen_close_stats_file.inc b/deps/ops/public/GenMod_Core/gen_close_stats_file.inc deleted file mode 100755 index e0e7d287..00000000 --- a/deps/ops/public/GenMod_Core/gen_close_stats_file.inc +++ /dev/null @@ -1,69 +0,0 @@ -!------------------------------------------------------------------------------- -! (C) Crown copyright Met Office. All rights reserved. -!------------------------------------------------------------------------------- -! Close the file for the statistics output. -!------------------------------------------------------------------------------- - -SUBROUTINE gen_close_stats_file (ErrorStatus, & - content_msg) - -USE GenMod_Control, ONLY: & - ProduceHTML, & - mype - -IMPLICIT NONE - -! Subroutine arguments -INTEGER, INTENT(OUT) :: ErrorStatus -CHARACTER(len=*), INTENT(IN), OPTIONAL :: content_msg - -! Local declarations: -CHARACTER(len=*), PARAMETER :: this = 'gen_close_stats_file' -CHARACTER(len=255) :: io_msg -CHARACTER(len=255) :: read_msg -CHARACTER(len=6) :: close_status = 'KEEP' - -IF (UseTrace) CALL gen_trace_entry (this) - -ErrorStatus = 0 -IF (mype == 0) THEN - - ! Set flag to delete the file if its only contents are "content_msg" - IF (PRESENT (content_msg)) THEN - BACKSPACE (UNIT = StatsOut, IOSTAT = ErrorStatus) - IF (ErrorStatus /= 0) THEN - WRITE (io_msg, '(A,I0)') 'IOSTAT=', ErrorStatus - CALL gen_warn (this, & - TRIM (gen_stats_file_name) // & - ': cannot backspace, stats file will not be deleted if empty: ' // TRIM (io_msg)) - ELSE - READ (StatsOut, '(A)') read_msg - IF (ProduceHTML) THEN - IF (TRIM (read_msg) == '

' // TRIM (content_msg) // '

') THEN - close_status = 'DELETE' - END IF - ELSE - IF (TRIM (read_msg) == TRIM (content_msg)) close_status = 'DELETE' - END IF - END IF - END IF - - ! Close the file - CLOSE (UNIT = StatsOut, & - STATUS = close_status, & -#if FORTRAN_VERSION >= 2003 - IOMSG = io_msg, & -#endif - IOSTAT = ErrorStatus) - IF (ErrorStatus /= 0) THEN -#if FORTRAN_VERSION < 2003 - WRITE (io_msg, '(A,I0)') 'IOSTAT=', ErrorStatus -#endif - CALL gen_fail (this, & - TRIM (gen_stats_file_name) // ': cannot close: ' // TRIM (io_msg)) - END IF -END IF - -IF (UseTrace) CALL gen_trace_exit (this) - -END SUBROUTINE gen_close_stats_file diff --git a/deps/ops/public/GenMod_Core/gen_open_stats_file.inc b/deps/ops/public/GenMod_Core/gen_open_stats_file.inc deleted file mode 100755 index f916da3f..00000000 --- a/deps/ops/public/GenMod_Core/gen_open_stats_file.inc +++ /dev/null @@ -1,101 +0,0 @@ -!------------------------------------------------------------------------------- -! (C) Crown copyright Met Office. All rights reserved. -!------------------------------------------------------------------------------- -! Open the file for the statistics output. -!------------------------------------------------------------------------------- - -SUBROUTINE gen_open_stats_file (Message, & - ErrorStatus) - -USE GenMod_Control, ONLY: & - ProduceHTML, & - mype, & - StatsAppend - -IMPLICIT NONE - -! Subroutine arguments: -CHARACTER(len=*), INTENT(IN) :: Message -INTEGER, INTENT(OUT) :: ErrorStatus - -! Local declarations: -CHARACTER(len=*), PARAMETER :: this = 'gen_open_stats_file' -CHARACTER(len=*), PARAMETER :: gen_stats_file_env = 'GEN_STDSTATS_FILE' -CHARACTER(len=*), PARAMETER :: rose_task_log_root_env = 'ROSE_TASK_LOG_ROOT' -CHARACTER(len=*), PARAMETER :: gen_stats_file_name_default = 'stats' -#ifndef REC_LEN -#define REC_LEN 2000 -#endif -INTEGER, PARAMETER :: rec_len = REC_LEN - -#if FORTRAN_VERSION >= 2003 -INTEGER, PARAMETER :: len_rose_task_log_root = LEN (gen_stats_file_name) - LEN (gen_stats_file_name_default) - 1 -CHARACTER(len=len_rose_task_log_root) :: rose_task_log_root -#else -CHARACTER(len=1000) :: rose_task_log_root -#endif - -CHARACTER(len=255) :: io_msg -INTEGER :: env_len -INTEGER :: i_status - -IF (UseTrace) CALL gen_trace_entry (this) - -ErrorStatus = 0 -IF (mype == 0) THEN - CALL gen_get_env (gen_stats_file_env, & - env_len, & - gen_stats_file_name, & - i_status) - IF (i_status /= 0 .OR. env_len <= 0) THEN - CALL gen_get_env (rose_task_log_root_env, & - env_len, & - rose_task_log_root, & - i_status) - IF (i_status == 0 .OR. env_len <= 0) THEN - gen_stats_file_name = TRIM (rose_task_log_root) // '.' // TRIM (gen_stats_file_name_default) - ELSE - gen_stats_file_name = gen_stats_file_name_default - END IF - END IF - - IF (StatsAppend) THEN - OPEN (UNIT = StatsOut, & - FILE = gen_stats_file_name, & - POSITION = 'APPEND', & - RECL = rec_len, & -#if FORTRAN_VERSION >= 2003 - IOMSG = io_msg, & -#endif - IOSTAT = ErrorStatus) - ELSE - OPEN (UNIT = StatsOut, & - FILE = "fort.7", & - STATUS = 'REPLACE', & - RECL = rec_len, & -#if FORTRAN_VERSION >= 2003 - IOMSG = io_msg, & -#endif - IOSTAT = ErrorStatus) - END IF - - IF (ErrorStatus /= 0) THEN -#if FORTRAN_VERSION < 2003 - WRITE (io_msg, '(A,I0)') 'IOSTAT=', ErrorStatus -#endif - CALL gen_fail (this, & - TRIM (gen_stats_file_name) // ': cannot open: ' // TRIM (io_msg)) - END IF - - ! Initial message: - ! FIXME: why? - IF (ProduceHTML) THEN - WRITE (StatsOut, '(A)') '

' // TRIM (Message) // '

' - ELSE - WRITE (StatsOut, '(A)') TRIM (Message) - END IF -END IF - -IF (UseTrace) CALL gen_trace_exit (this) - -END SUBROUTINE gen_open_stats_file diff --git a/deps/ops/public/GenMod_Control/GenMod_Control.F90 b/deps/ops/stubs/GenMod_Control.F90 similarity index 96% rename from deps/ops/public/GenMod_Control/GenMod_Control.F90 rename to deps/ops/stubs/GenMod_Control.F90 index b294caa3..38caec3b 100755 --- a/deps/ops/public/GenMod_Control/GenMod_Control.F90 +++ b/deps/ops/stubs/GenMod_Control.F90 @@ -39,7 +39,6 @@ MODULE GenMod_Control LOGICAL :: GCOMBitRep = .FALSE. REAL :: ErrorSleep = 2.5 ! Seconds to sleep when exiting program on error LOGICAL :: WarningToError = .FALSE. ! Convert calls to gen_warn to calls to gen_fail -LOGICAL :: StatsAppend = .FALSE. ! Allow capability to revert to old behaviour INTEGER :: UM_SECTOR_SIZE = 2048 diff --git a/deps/ops/stubs/OpsMod_ODB/OpsProg_CreateODB.f90 b/deps/ops/stubs/OpsMod_ODB/OpsProg_CreateODB.f90 index 9b704a63..2de647b0 100644 --- a/deps/ops/stubs/OpsMod_ODB/OpsProg_CreateODB.f90 +++ b/deps/ops/stubs/OpsMod_ODB/OpsProg_CreateODB.f90 @@ -14,18 +14,14 @@ PROGRAM OpsProg_CreateODB QuietMode, & mype -USE GenMod_Core, ONLY: & - gen_close_stats_file, & - gen_fail, & - gen_open_stats_file, & - gen_summary, & - gen_trace_entry, & - gen_trace_exit, & - gen_trace_report, & - gen_warn, & - MessageOut, & - StatsOut, & - StatusOK, & +USE GenMod_Core, ONLY: & + gen_fail, & + gen_summary, & + gen_trace_entry, & + gen_trace_exit, & + gen_trace_report, & + gen_warn, & + MessageOut, & UseTrace USE GenMod_MiscUMScienceConstants, ONLY: & @@ -149,7 +145,6 @@ PROGRAM OpsProg_CreateODB ! Local declarations: CHARACTER(len=*), PARAMETER :: ProgName = "OpsProg_CreateODB" INTEGER :: Error -INTEGER :: rc TYPE (ODBSession_type) :: ecma INTEGER :: i INTEGER :: j @@ -185,13 +180,6 @@ PROGRAM OpsProg_CreateODB IF (UseTrace) CALL gen_trace_entry (ProgName) -CALL gen_open_stats_file ("OpsProg_CreateODB statistics", & - rc) -IF (rc /= StatusOK) THEN - CALL gen_fail (ProgName, & - "Error in gen_open_stats_file") -END IF - CALL Ops_ReadODBControlNL odb1_mode = .NOT. ops_env_is_true ("OPS_CREATEODB_FORMAT_ODB2") @@ -210,12 +198,6 @@ PROGRAM OpsProg_CreateODB CALL Ops_ReadCycleTime -IF (mype == 0) THEN - WRITE (StatsOut, "(A,2(I2.2,A),I4.4,A,I2.2)") " " // TRIM (Runid) // " ",& - CycleTime(cycle_day), "/", CycleTime(cycle_month), "/", & - CycleTime(cycle_year), " ", cycleTime(cycle_hour) -END IF - CALL Ops_ReadObsGroupSwitches (obs_group_list) CALL Ops_ReadOutputSwitches @@ -351,18 +333,6 @@ PROGRAM OpsProg_CreateODB END IF END IF - IF (mype == 0) THEN - WRITE (StatsOut, "(A)") & - " --------------------------------------------------------------------" - StatsString = " Total " // TRIM (OpsFn_ObsourcetoString(MainObsource)) // " " // & - TRIM (OpsFn_ObsGroupNumToName(obs_group_list(i))) // " obs " - WRITE (StatsString(35:44), "(A2,I8)") "= ", & - SUM (TempMDBData % SubTypeData(:) % TotalNumObs) - WRITE (StatsOut, "(A)") TRIM (StatsString) - WRITE (StatsOut, "(A)") & - " --------------------------------------------------------------------" - WRITE (StatsOut, "(A)") " " - END IF IF (TempMDBData % NumSubTypes > 0) THEN DEALLOCATE (TempMDBData % SubTypeData) END IF @@ -381,12 +351,6 @@ PROGRAM OpsProg_CreateODB 9999 CONTINUE -CALL gen_close_stats_file (Error) -IF (Error /= StatusOK) THEN - CALL gen_fail (ProgName, & - "Cannot close stats file") -END IF - CALL gen_summary IF (UseTrace) THEN diff --git a/deps/ops/stubs/OpsMod_Varobs/Ops_CreateVarobs.inc b/deps/ops/stubs/OpsMod_Varobs/Ops_CreateVarobs.inc index ef374d54..2f1742ea 100644 --- a/deps/ops/stubs/OpsMod_Varobs/Ops_CreateVarobs.inc +++ b/deps/ops/stubs/OpsMod_Varobs/Ops_CreateVarobs.inc @@ -26,17 +26,13 @@ USE GenMod_Control, ONLY: & nproc, & mype -USE GenMod_Core, ONLY: & - gen_close_stats_file, & - gen_fail, & - gen_open_stats_file, & - gen_trace_entry, & - gen_trace_exit, & - gen_warn, & - MaxFileNameLen, & - MessageOut, & - StatsOut, & - StatusOK, & +USE GenMod_Core, ONLY: & + gen_fail, & + gen_trace_entry, & + gen_trace_exit, & + gen_warn, & + MaxFileNameLen, & + MessageOut, & UseTrace USE GenMod_MiscUMScienceConstants, ONLY: & @@ -141,7 +137,6 @@ INTEGER :: varfield_array_size TYPE (varobs_type) :: varobs CHARACTER(len=MaxFileNameLen) :: Filename CHARACTER(len=80) :: StatsString -INTEGER :: rc !------------------------------------------------------------------------------- ! 0. Tracing and initialisation @@ -468,28 +463,6 @@ IF (mype == 0) THEN CALL Ops_TouchFile (Filename) END IF - CALL gen_open_stats_file ("VarObsWriter statistics", & - rc) - IF (rc /= StatusOK) THEN - CALL gen_fail (RoutineName, & - "Error in gen_open_stats_file") - END IF - WRITE (StatsOut, '(A)') & - ' --------------------------------------------------------------------' - StatsString = ' Total Varobs ' // TRIM (Observations % Header % ObsGroupName) // ' obs ' - WRITE (StatsString(35:44),'(A2,I8)') '= ', NumVarObsTotal - - WRITE (StatsOut, '(A)') TRIM (StatsString) - WRITE (StatsOut, '(A)') & - ' --------------------------------------------------------------------' - WRITE (StatsOut, '(A)') '' - - CALL gen_close_stats_file (rc) - IF (rc /= StatusOK) THEN - CALL gen_fail (RoutineName, & - "Cannot close stats file") - END IF - END IF IF (UseTrace) CALL gen_trace_exit (RoutineName)